ServiceLifecycle (Java EE 5)

Java EE API


javax.xml.rpc.server Interface ServiceLifecycle


public interface ServiceLifecycle


javax.xml.rpc.server.ServiceLifecycle 定义用于 JAX-RPC 服务端点的生命周期接口。如果该服务端点类实现 ServiceLifeycle 接口,则要求基于 servlet 容器的 JAX-RPC 运行时系统管理相应服务端点对象的生命周期。
英文文档:

The javax.xml.rpc.server.ServiceLifecycle defines a lifecycle interface for a JAX-RPC service endpoint. If the service endpoint class implements the ServiceLifeycle interface, the servlet container based JAX-RPC runtime system is required to manage the lifecycle of the corresponding service endpoint objects.

Version:
1.0
Author:
Rahul Sharma

Method Summary
 void
 void
 

Method Detail

public void init(Object context) throws ServiceException
此方法用于初始化服务端点。在初始化服务端点实例(服务端点类实例)之后,JAX-RPC 运行时系统将调用 init 方法。服务端点类使用 init 方法初始化其配置,并建立对所有外部资源的访问。init 方法中的 context 参数使端点实例能够访问底层 JAX-RPC 运行时系统提供的端点上下文。

init 方法实现应该将 context 参数的类型强制转换为相应的 Java 类型。对于基于 servlet 容器的 JAX-RPC 运行时系统上部署的服务端点,context 参数的类型为 Java 类型 javax.xml.rpc.server.ServletEndpointContextServletEndpointContext 提供由底层基于 servlet 容器的 JAX-RPC 运行时系统所维护的端点上下文。

context JAX-RPC 服务端点的端点上下文
ThrowsServiceException: 如果初始化服务端点过程中出现错误;如果在 init 方法中提供了非法上下文

英文文档:

init

void init(Object context)
          throws ServiceException
Used for initialization of a service endpoint. After a service endpoint instance (an instance of a service endpoint class) is instantiated, the JAX-RPC runtime system invokes the init method. The service endpoint class uses the init method to initialize its configuration and setup access to any external resources. The context parameter in the init method enables the endpoint instance to access the endpoint context provided by the underlying JAX-RPC runtime system.

The init method implementation should typecast the context parameter to an appropriate Java type. For service endpoints deployed on a servlet container based JAX-RPC runtime system, the context parameter is of the Java type javax.xml.rpc.server.ServletEndpointContext. The ServletEndpointContext provides an endpoint context maintained by the underlying servlet container based JAX-RPC runtime system

Parameters:
context - Endpoint context for a JAX-RPC service endpoint
Throws:
ServiceException - If any error in initialization of the service endpoint; or if any illegal context has been provided in the init method

public void destroy()
JAX-RPC 运行时系统通过调用 destroy 方法结束服务端点实例的生命周期。服务端点释放它在 destroy 方法实现中占用的资源。
英文文档:

destroy

void destroy()
JAX-RPC runtime system ends the lifecycle of a service endpoint instance by invoking the destroy method. The service endpoint releases its resourcesin the implementation of the destroy method.



Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!