8.3.2 Clean Shutdown of a Reaction Client

When a Reaction client is being shut down, the OSGi framework will call the bundle activator's stop method while the client is still bound to the Reaction service. This allows the client bundle to perform a clean shutdown - cancelling any outstanding transactions with the Reaction service. The way in which this is handled in the example lifecycle wrapper code is illustrated in Listing 8.6.


\begin{listing}
% latex2html id marker 1785\begin{verbatim}public synchroniz...
...);
}\end{verbatim}
\caption{Reaction Client Activator Stop Method}
\end{listing}

The final action of the activator's stop method is to close the Reaction service tracker. This will then cause the framework to issue a callback to the service tracker's removedService method, as shown in Listing 8.7. Since the lifecycle handler has already undergone a clean shutdown at this stage, no further action is required.


\begin{listing}
% latex2html id marker 1794\begin{verbatim}public synchroniz...
...null;
}
}\end{verbatim}
\caption{Reaction Service Removed Method}
\end{listing}