Class Adapter<TK extends Adapter.Toolkit>
- All Implemented Interfaces:
Component,Reconfigurable
- Direct Known Subclasses:
HttpAdapter,TCPAdapter
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:
-
To hide the logic of converting a transport-specific connection
to a
Packetand do the other way around. -
To manage thread-unsafe resources, such as
WSEndpoint.PipeHead, andCodec.
Adapters 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<TK extends Adapter.Toolkit>.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.
- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassObject that groups all thread-unsafe resources. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final WSEndpoint<?>Pool ofAdapter<TK extends Adapter.Toolkit>.Toolkits. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAdapter(WSEndpoint endpoint) Creates anAdapterthat delivers messages to the given endpoint. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract TKCreates aAdapter<TK extends Adapter.Toolkit>.Toolkitinstance.WSEndpoint<?>Gets the endpoint that thisAdapteris serving.protected ComponentgetPool()Returns a reference to the pool of Toolkits for this adapter.<S> SGets the specified SPI.voidThe pool instance needs to be recreated to prevent reuse of old Toolkit instances.
-
Field Details
-
endpoint
-
pool
Pool ofAdapter<TK extends Adapter.Toolkit>.Toolkits. 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.
-
-
Constructor Details
-
Adapter
Creates anAdapterthat delivers messages to the given endpoint.
-
-
Method Details
-
getEndpointComponent
-
reconfigure
public void reconfigure()The pool instance needs to be recreated to prevent reuse of old Toolkit instances.- Specified by:
reconfigurein interfaceReconfigurable
-
getSPI
Description copied from interface:ComponentGets the specified SPI.This method works as a kind of directory service for SPIs, allowing various components to define private contract and talk to each other.
-
getEndpoint
Gets the endpoint that thisAdapteris serving.- Returns:
- always non-null.
-
getPool
Returns a reference to the pool of Toolkits for this adapter. The pool may be recreated during runtime reconfiguration and this method will then return a reference to a new instance. When you recycle a toolkit, you must make sure that you return it to the same pool instance that you took it from. -
createToolkit
Creates aAdapter<TK extends Adapter.Toolkit>.Toolkitinstance.If the derived class doesn't have to add any per-thread state to
Adapter<TK extends Adapter.Toolkit>.Toolkit, simply implement this asnew Toolkit().
-