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:
  1. The handler finishes processing any active messages.
  2. The runtime invokes the method decorated with the @PreDestroy annotation.
    This method should clean up any resources used by the handler.
  3. The handler's destructor is called.