Unlike
run-of-the-mill HTTP, NetworkList uses chunked-encoding to keep an HTTP
connection alive for the duration of the session. When you connect to a
peer, a single HTTP connection is created and maintained. Each time a
list event is created, an HTTP chunk is sent to all peers.
We would have liked to implement the NetworkList stuff on top
of the servlet API, but unfortunately the goals of each are
dramatically different. NetworkLists wants a long lived connection,
wheras servlets are designed for a single, quick connection.
What you can do is use the Glazed Lists network stuff for other data transport. Here's the layers:
CTP, Chunked Transfer Protocol
This is an abstract pipe that sits on top of HTTP and allows you to push data in two ways with the methods
CTPConnection.sendChunk() CTPHandler.receiveChunk()
RBP, Resource Block Peer
This is an abstract layer on top of CTP that allows you to publish
objects with a URL and observe them over a wire. For this, implement
the Resource interface to publish a resource and the ResourceListener
interface to observe a resource. This class uses our arbitrary-length
ByteBuffer class which I call 'Bufferlo' since it's a BUFFER designed
to make a LOW number of data copies.
NetworkList
Sits on top of RBP to publish list changes over the wire.
|