Show Table of Contents
41.9. Releasing a Handler
Overview
The runtime releases a handler when the service or service proxy to which the handler is bound is shutdown. The runtime will invoke an optional release method before invoking the handler's destructor. This optional release method can be used to release any resources used by the handler or perform other actions that would not be appropriate in the handler's destructor.
Tip
You do not have to provide any clean-up methods for a handler.
Order of release
The following happens when the handler is released:
- The handler finishes processing any active messages.
- The runtime invokes the method decorated with the
@PreDestroyannotation.This method should clean up any resources used by the handler. - The handler's destructor is called.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.