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

Method Stop1

framework/src/bundle/BundlePrivate.cpp:122–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120 }
121
122 std::exception_ptr
123 BundlePrivate::Stop1()
124 {
125 std::exception_ptr res;
126
127 coreCtx->listeners.BundleChanged(
128 BundleEvent(BundleEvent::BUNDLE_STOPPING, MakeBundle(this->shared_from_this())));
129
130 if (wasStarted && bactivator != nullptr)
131 {
132 try
133 {
134 bactivator->Stop(MakeBundleContext(bundleContext.Load()));
135 }
136 catch (...)
137 {
138 res = std::make_exception_ptr(
139 std::runtime_error("Bundle " + symbolicName + " (location=" + location
140 + "), BundleActivator::Stop() failed: " + util::GetLastExceptionStr()));
141 }
142
143 // if stop was aborted (uninstall or timeout), make sure
144 // FinalizeActivation() has finished before checking aborted/state
145 {
146 std::string cause;
147 if (aborted == static_cast<uint8_t>(Aborted::YES))
148 {
149 if (Bundle::STATE_UNINSTALLED == state)
150 {
151 cause = "Bundle uninstalled during Stop()";
152 }
153 else
154 {
155 cause = "Bundle activator Stop() time-out";
156 }
157 }
158 else
159 {
160 aborted = static_cast<uint8_t>(Aborted::NO);
161 if (Bundle::STATE_STOPPING != state)
162 {
163 cause = "Bundle changed state because of refresh during Stop()";
164 }
165 }
166 if (!cause.empty())
167 {
168 res = std::make_exception_ptr(std::runtime_error("Bundle " + symbolicName + " (location=" + location
169 + ") stop failed: " + cause));
170 }
171 }
172 bactivator = nullptr;
173 }
174
175 if (operation == OP_DEACTIVATING)
176 {
177 Stop2();
178 }
179

Callers

nothing calls this directly

Calls 9

MakeBundleFunction · 0.85
MakeBundleContextFunction · 0.85
GetLastExceptionStrFunction · 0.85
shared_from_thisMethod · 0.80
BundleEventClass · 0.70
BundleChangedMethod · 0.45
StopMethod · 0.45
LoadMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected