|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.xml.ws.api.server.InstanceResolver<T>
public abstract class InstanceResolver<T>
Determines the instance that serves the given request packet.
The JAX-WS spec always use a singleton instance to serve all the requests, but this hook provides a convenient way to route messages to a proper receiver.
Externally, an instance of InstanceResolver is
associated with WSEndpoint.
One can use WS-Addressing message properties to decide which instance to deliver a message. This would be an important building block for a stateful web services.
One can associate an instance of a service with a specific WS-RM session.
| Constructor Summary | |
|---|---|
InstanceResolver()
|
|
| Method Summary | ||
|---|---|---|
static
|
createDefault(Class<T> clazz)
Creates a default InstanceResolver that serves the given class. |
|
static
|
createDefault(Class<T> clazz,
boolean bool)
Deprecated. This is added here because a Glassfish integration happened with this signature. Please do not use this. Will be removed after the next GF integration. |
|
static
|
createFromInstanceResolverAnnotation(Class<T> clazz)
Checks for InstanceResolverAnnotation and creates an instance resolver from it if any. |
|
Invoker |
createInvoker()
Wraps this InstanceResolver into an Invoker. |
|
protected static
|
createNewInstance(Class<T> cl)
|
|
static
|
createSingleton(T singleton)
Creates a InstanceResolver implementation that always
returns the specified singleton instance. |
|
void |
dispose()
Called by WSEndpoint
when WSEndpoint.dispose() is called. |
|
void |
postInvoke(Packet request,
T servant)
Called by the default Invoker after the method call is done. |
|
abstract T |
resolve(Packet request)
Decides which instance of 'T' serves the given request message. |
|
void |
start(WebServiceContext wsc)
Deprecated. Use start(WSWebServiceContext,WSEndpoint). |
|
void |
start(WSWebServiceContext wsc,
WSEndpoint endpoint)
Called by WSEndpoint when it's set up. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public InstanceResolver()
| Method Detail |
|---|
@NotNull
public abstract T resolve(@NotNull
Packet request)
This method is called concurrently by multiple threads. It is also on a criticail path that affects the performance. A good implementation should try to avoid any synchronization, and should minimize the amount of work as much as possible.
request - Always non-null. Represents the request message to be served.
The caller may not consume the Message.
public void postInvoke(@NotNull
Packet request,
@NotNull
T servant)
Invoker after the method call is done.
This gives InstanceResolver a chance to do clean up.
Alternatively, one could override createInvoker() to
create a custom invoker to do this in more flexible way.
The default implementation is a no-op.
request - The same request packet given to resolve(Packet) method.servant - The object returned from the resolve(Packet) method.
public void start(@NotNull
WSWebServiceContext wsc,
@NotNull
WSEndpoint endpoint)
WSEndpoint when it's set up.
This is an opportunity for InstanceResolver
to do a endpoint-specific initialization process.
wsc - The WebServiceContext instance to be injected
to the user instances (assuming InstanceResolver
public void start(@NotNull
WebServiceContext wsc)
start(WSWebServiceContext,WSEndpoint).
public void dispose()
WSEndpoint
when WSEndpoint.dispose() is called.
This allows InstanceResolver to do final clean up.
This method is guaranteed to be only called once by WSEndpoint.
public static <T> InstanceResolver<T> createSingleton(T singleton)
InstanceResolver implementation that always
returns the specified singleton instance.
public static <T> InstanceResolver<T> createDefault(@NotNull
Class<T> clazz,
boolean bool)
public static <T> InstanceResolver<T> createDefault(@NotNull
Class<T> clazz)
InstanceResolver that serves the given class.
public static <T> InstanceResolver<T> createFromInstanceResolverAnnotation(@NotNull
Class<T> clazz)
InstanceResolverAnnotation and creates an instance resolver from it if any.
Otherwise null.
protected static <T> T createNewInstance(Class<T> cl)
@NotNull public Invoker createInvoker()
InstanceResolver into an Invoker.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||