Skip to content
ferhatelmas edited this page Dec 26, 2012 · 4 revisions

Classes

Server

  • Register
  • Connection
  • Store
  • Sender

Client

  • SquallReceiver

Details

Register (Thread)

  • 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 new Connection object, which is a wrapper for java.net.Socket with some settings such as TcpNoDelay, and putting new connection to connections list.

Store

  • Tuple Storage(ConcurrentLinkedQueue) keeps the tuples to be sent to requesting clients.
  • Thread Pool(ExecutorService) does the actual sending to each client.

Connection

  • Socket(java.net.Socket) currently keeps the open socket alive and sets its configuration. There are two ways of creating a connection: client initiated(Register is actually a TCP server) or server initiated(server tries to connect to the client with given parameters via Config)

Sender (Thread)

  • Store
  • Register
  • Tuple

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.

SquallReceiver (Thread)

  • 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.

Clone this wiki locally