| Receives incoming messages from a transport (such as HTTP, JMS, etc)
in a transport specific way, and delivers it to
WSEndpoint.PipeHead.process .
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
Packet and do the other way around.
-
To manage thread-unsafe resources, such as
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
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 |