MCPcopy Create free account
hub / github.com/CppMicroServices/CppMicroServices / StopAllBundles

Method StopAllBundles

framework/src/util/FrameworkPrivate.cpp:366–404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364 }
365
366 void
367 FrameworkPrivate::StopAllBundles()
368 {
369 // Stop all active bundles, in reverse bundle ID order
370 auto activeBundles = coreCtx->bundleRegistry.GetActiveBundles();
371 for (auto iter = activeBundles.rbegin(); iter != activeBundles.rend(); ++iter)
372 {
373 auto b = *iter;
374 try
375 {
376 if (((Bundle::STATE_ACTIVE | Bundle::STATE_STARTING) & b->state) != 0)
377 {
378 // Stop bundle without changing its autostart setting.
379 b->Stop(Bundle::StopOptions::STOP_TRANSIENT);
380 }
381 }
382 catch (...)
383 {
384 coreCtx->listeners.SendFrameworkEvent(
385 FrameworkEvent(FrameworkEvent(FrameworkEvent::Type::FRAMEWORK_ERROR,
386 MakeBundle(b),
387 std::string(),
388 std::current_exception())));
389 }
390 }
391
392 auto allBundles = coreCtx->bundleRegistry.GetBundles();
393
394 // Set state to BUNDLE_INSTALLED
395 for (auto b : allBundles)
396 {
397 if (b->id != 0)
398 {
399 auto l = coreCtx->resolver.Lock();
400 US_UNUSED(l);
401 b->SetStateInstalled(false);
402 }
403 }
404 }
405
406 void
407 FrameworkPrivate::SystemShuttingdownDone_unlocked(FrameworkEventInternal const& fe)

Callers

nothing calls this directly

Calls 8

MakeBundleFunction · 0.85
GetActiveBundlesMethod · 0.80
SendFrameworkEventMethod · 0.80
LockMethod · 0.80
SetStateInstalledMethod · 0.80
FrameworkEventClass · 0.50
StopMethod · 0.45
GetBundlesMethod · 0.45

Tested by

no test coverage detected