ServletEndpointContext

   
ServiceLifecycle javax.xml.rpc.server

JAX-RPC 1.0; JWSDP 1.0, J2EE 1.4
 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 implement it. Such a service can detect the start and end of its life cycle by implementing the ejbCreate( ) and ejbRemove( ) methods of the SessionBean interface, and can access the container environment by using the SessionContext object passed to its setSessionContext( ) method. Additionally, the service can access its JNDI naming context in the usual way by instantiating a javax.naming.InitialContext object.


   


Java Web Services in a Nutshell
Java Web Services in a Nutshell
ISBN: 0596003994
EAN: 2147483647
Year: 2003
Pages: 257
Authors: Kim Topley

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net