gr.uoa.di.madgik.grs.proxy.tcp
Class TCPConnectionHandler

java.lang.Object
  extended by gr.uoa.di.madgik.grs.proxy.tcp.TCPConnectionHandler
All Implemented Interfaces:
gr.uoa.di.madgik.commons.server.ITCPConnectionManagerEntry

public class TCPConnectionHandler
extends java.lang.Object
implements gr.uoa.di.madgik.commons.server.ITCPConnectionManagerEntry

A connection handler that can be registered with the TCPConnectionManager in order to receive incoming TCP connection from clients. This entry is set to serve connections for the gRS2 component

Author:
gpapanikos

Nested Class Summary
 
Nested classes/interfaces inherited from interface gr.uoa.di.madgik.commons.server.ITCPConnectionManagerEntry
gr.uoa.di.madgik.commons.server.ITCPConnectionManagerEntry.NamedEntry
 
Constructor Summary
TCPConnectionHandler()
           
 
Method Summary
 gr.uoa.di.madgik.commons.server.ITCPConnectionManagerEntry.NamedEntry GetName()
          
 void HandleConnection(java.net.Socket socket)
          
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TCPConnectionHandler

public TCPConnectionHandler()
Method Detail

GetName

public gr.uoa.di.madgik.commons.server.ITCPConnectionManagerEntry.NamedEntry GetName()

The connection manager entry this handler can serve. The entry returned is marked with ITCPConnectionManagerEntry.NamedEntry.gRS2

Specified by:
GetName in interface gr.uoa.di.madgik.commons.server.ITCPConnectionManagerEntry
See Also:
ITCPConnectionManagerEntry.GetName()

HandleConnection

public void HandleConnection(java.net.Socket socket)

After a request of the correct type has reached TCPConnectionManager, it is forwarded here where the specific IBuffer and its serving IMirror is located. The request is forwarded to the IMirror and the operation is completed in this thread of execution. In the IMirror thread of execution, the mirroring protocol is initiated and served.
The IMirror that is expected by this handler is one that manages TCP connections, the TCPWriterMirror over which the TCPWriterMirror.setSocket(Socket) and TCPWriterMirror.setKey(String) is set before a call to TCPWriterMirror.handle() is invoked.
If the state of the TCPWriterMirror thread is not Thread.State.NEWm then the connection is discarded as there is already a mirroring process in progress

Specified by:
HandleConnection in interface gr.uoa.di.madgik.commons.server.ITCPConnectionManagerEntry
See Also:
ITCPConnectionManagerEntry.HandleConnection(java.net.Socket)