Thanks to visit codestin.com
Credit goes to github.com

Skip to content
wanly3643 edited this page Oct 29, 2014 · 3 revisions

Here is the basic architecture of this framwork:

# When new socket arrives:

Note: The name within rectangle is the java class name.

You could see that when a new socket come in the acceptor (which runs as a seperate thread) will create a PushClientSocket object and send it to the ClientFacotory, the ClientFacotory will create a PhyscialConnection for this socket and save it as pending status, then send it to the Dispatcher to initialize.

# When the first request arrives:

In the first line, when the first request come in, there will be a IOEvent in the IOQueue, so the worker thread of Demultiplexor (Demultiplexor contains lots of worker threads which will always try to read IOEvent from the IOQueue) will read the event, and find the PhysicalConnection of the event, then send the PhysicalConnection to the Dispatcher.

In the second line, when the Dispatcher receives the PhysicalConnection, the PhysicalConnection will read the binary data from the socket and send these data as byte array to the ProtocolManager, the ProtocolManager will use the protocols to decode the data into IncomingPacket and send it to ClientFactory, then ClientFactory will process it.

In the third line, if the first request is processed successfully, the Dispatcher will create a LogicalConnection attached with the PhysicalConnection and register it into the BroadcastStreamer so that the client could receive the broadcast messages.

Clone this wiki locally