Name

ServiceLifecycle

Synopsis

public interface ServiceLifecycle {
// Public Instance Methods
    public abstract void destroy(  ); 
    public abstract void init( Object context) throws javax.xml.rpc.ServiceException; 
}

This interface is implemented by a web service implementation class that wishes to be notified of the start and end of its life cycle.

The init( ) method is called when an instance of the service implementation class is created and before its first service endpoint interface method is invoked. The argument passed to this method is of unspecified type and is intended to be dependent on the nature of the container within which the service is running. In fact, the ServiceLifecycle interface is provided only by web containers; in this case, the object passed to the init( ) method is of type javax.xml.rpc.server.ServletEndpointContext.

The init( ) method is permitted to report an unrecoverable error or an illegal context object by throwing a javax.xml.rpc.ServiceException. The container typically responds to this exception by discarding the instance.

The destroy( ) method is called to notify a service instance of the end of its life cycle. Once this method completes, the container does not dispatch any further web service interface method calls to the instance and may make the instance eligible for garbage collection.

The J2EE specification does not require an EJB container to honor the ServiceLifecycle interface; therefore, a service implemented as a stateless session bean should not ...

Get Java Web Services in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.