forked from avitorovic/squall
-
Notifications
You must be signed in to change notification settings - Fork 0
Implementation
ferhatelmas edited this page Dec 26, 2012
·
4 revisions
- Register
- Connection
- Store
- Sender
- SquallReceiver
- SquallReceiverHandler
- Connection List(
CopyOnWriteArrayList) keeps a list of open connections to server. - Thread Pool (
ExecutorService) handles new connections not to keep busy main server socket thread. Handling a new connection includes creating a newConnectionobject, which is a wrapper forjava.net.Socketwith some settings such asTcpNoDelay, and putting new connection to connections list.
- Tuple Storage(
ConcurrentLinkedQueue) keeps the tuples to be sent to requesting clients. - Thread Pool(
ExecutorService) does the actual sending to each client.
- Socket(
java.net.Socket) currently keeps the open socket alive and sets its configuration. There are two ways of creating a connection: client initiated(Registeris actually a TCP server) or server initiated(server tries to connect to the client with given parameters viaConfig)
StoreRegisterTuple
It is responsible for adding new tuple to store and then polling the store to push tuples, that are already in store, to the service of store to be sent each connection of the register.
- Storage(ConcurrentLinkedQueue)
This thread opens a connection to the server, and waits for tuples. If it gets a tuple, it is added to the store for further retrieval by the main thread of the client application or calls the assigned handler on a separate thread to process arriving tuple.
-
newTupleArrivedconsumes new arriving tuple.