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.
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.