public abstract class Adapter<TK extends Adapter.Toolkit> extends Object implements Reconfigurable, Component
WSEndpoint.PipeHead.process(com.sun.xml.ws.api.message.Packet, com.sun.xml.ws.api.server.WebServiceContextDelegate, com.sun.xml.ws.api.server.TransportBackChannel)
.
Since this class mostly concerns itself with converting a
transport-specific message representation to a Packet
,
the name is the "adapter".
The purpose of this class is twofolds:
Packet
and do the other way around.
WSEndpoint.PipeHead
,
and Codec
.
Adapter
s are extended to work with each kind of transport,
and therefore Adapter
class itself is not all that
useful by itself --- it merely provides a design template
that can be followed.
For managing resources, an adapter uses an object called Adapter.Toolkit
(think of it as a tray full of tools that a dentist uses ---
trays are identical, but each patient has to get one. You have
a pool of them and you assign it to a patient.)
Adapter.Toolkit
can be extended by derived classes.
That actual type is the TK
type parameter this class takes.
Modifier and Type | Class and Description |
---|---|
class |
Adapter.Toolkit
Object that groups all thread-unsafe resources.
|
Modifier and Type | Field and Description |
---|---|
protected WSEndpoint<?> |
endpoint |
protected Pool<TK> |
pool
Pool of
Adapter.Toolkit s. |
Modifier | Constructor and Description |
---|---|
protected |
Adapter(WSEndpoint endpoint)
Creates an
Adapter that delivers
messages to the given endpoint. |
Modifier and Type | Method and Description |
---|---|
protected abstract TK |
createToolkit()
Creates a
Adapter.Toolkit instance. |
WSEndpoint<?> |
getEndpoint()
Gets the endpoint that this
Adapter is serving. |
protected Component |
getEndpointComponent() |
protected Pool<TK> |
getPool()
Returns a reference to the pool of Toolkits for this adapter.
|
<S> S |
getSPI(Class<S> spiType)
Gets the specified SPI.
|
void |
reconfigure()
The pool instance needs to be recreated to prevent reuse of old Toolkit instances.
|
protected final WSEndpoint<?> endpoint
protected volatile Pool<TK extends Adapter.Toolkit> pool
Adapter.Toolkit
s.
Instances of this pool may be replaced at runtime. Therefore, when you take
an object out of the pool, you must make sure that it is recycled by the
same instance of the pool.protected Adapter(WSEndpoint endpoint)
Adapter
that delivers
messages to the given endpoint.protected Component getEndpointComponent()
public void reconfigure()
reconfigure
in interface Reconfigurable
public <S> S getSPI(Class<S> spiType)
Component
This method works as a kind of directory service for SPIs, allowing various components to define private contract and talk to each other.
public WSEndpoint<?> getEndpoint()
Adapter
is serving.protected Pool<TK> getPool()
protected abstract TK createToolkit()
Adapter.Toolkit
instance.
If the derived class doesn't have to add any per-thread state
to Adapter.Toolkit
, simply implement this as new Toolkit()
.
Copyright © 2015 Oracle Corporation. All rights reserved.