Receives incoming messages from a transport (such as HTTP, JMS, etc) in a transport specific way, and delivers it to {@link WSEndpoint.PipeHead#process}.
Since this class mostly concerns itself with converting a transport-specific message representation to a {@link 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 {@link Packet} and do the other way around.
- To manage thread-unsafe resources, such as {@link WSEndpoint.PipeHead}, and {@link Codec}.
{@link Adapter}s are extended to work with each kind of transport, and therefore {@link Adapter} class itself is not all thatuseful by itself --- it merely provides a design template that can be followed.
For managing resources, an adapter uses an object called {@link 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.) {@link Adapter.Toolkit} can be extended by derived classes.That actual type is the {@code TK} type parameter this class takes.
@author Kohsuke Kawaguchi