org.objectweb.joram.mom.proxies.tcp
Class TcpConnection

java.lang.Object
  extended by org.objectweb.joram.mom.proxies.tcp.TcpConnection
All Implemented Interfaces:
TcpConnectionMBean

public class TcpConnection
extends java.lang.Object
implements TcpConnectionMBean

Handles the TCP connection. Starts the reader and writer threads responsible for reading the requests and writing the replies. Calls the UserConnection in order to invoke the user's proxy and get its replies.

See Also:
TcpProxyService, TcpConnectionListener

Field Summary
private  boolean closeConnection
           
private  java.util.Date creationDate
           
private  ReliableConnectionContext ctx
           
private  Identity identity
           
private  IOControl ioctrl
           
static org.objectweb.util.monolog.api.Logger logger
          logger
private  AgentId proxyId
           
private  TcpProxyService proxyService
          The TCP proxy service used to register and unregister this connection.
private  TcpReader tcpReader
          The reader thread responsible for reading the requests (input).
private  TcpWriter tcpWriter
          The writer thread responsible for writing the replies (output).
 
Constructor Summary
TcpConnection(IOControl ioctrl, ReliableConnectionContext ctx, AgentId proxyId, TcpProxyService proxyService, Identity identity)
          Creates a new TCP connection.
 
Method Summary
 void close()
          Stops the connection reader and writer threads.
 java.lang.String getAddress()
          Gets the socket address used by the connection.
 java.util.Date getCreationDate()
          Gets connection creation date.
 int getKey()
           
private  java.lang.String getMBeanName()
           
 AgentId getProxyId()
           
 long getReceivedCount()
          Gets the number of replies received on the connection.
 long getSentCount()
          Gets the number of requests sent on the connection.
 java.lang.String getUserName()
          Gets connected user's name.
(package private)  void start()
          Starts the connection reader and writer threads.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static org.objectweb.util.monolog.api.Logger logger
logger


ioctrl

private IOControl ioctrl

proxyId

private AgentId proxyId

ctx

private ReliableConnectionContext ctx

tcpReader

private TcpReader tcpReader
The reader thread responsible for reading the requests (input).


tcpWriter

private TcpWriter tcpWriter
The writer thread responsible for writing the replies (output).


proxyService

private TcpProxyService proxyService
The TCP proxy service used to register and unregister this connection.


closeConnection

private boolean closeConnection

identity

private Identity identity

creationDate

private java.util.Date creationDate
Constructor Detail

TcpConnection

public TcpConnection(IOControl ioctrl,
                     ReliableConnectionContext ctx,
                     AgentId proxyId,
                     TcpProxyService proxyService,
                     Identity identity)
Creates a new TCP connection.

Parameters:
ioctrl -
ctx -
proxyId -
proxyService - the TCP proxy service
identity -
Method Detail

getMBeanName

private java.lang.String getMBeanName()

getProxyId

public final AgentId getProxyId()

getKey

public final int getKey()

start

void start()
     throws java.lang.Exception
Starts the connection reader and writer threads.

Throws:
java.lang.Exception

close

public void close()
Stops the connection reader and writer threads. Closes the socket.

Specified by:
close in interface TcpConnectionMBean

getUserName

public java.lang.String getUserName()
Description copied from interface: TcpConnectionMBean
Gets connected user's name.

Specified by:
getUserName in interface TcpConnectionMBean
Returns:
the name of the connected user.

getAddress

public java.lang.String getAddress()
Description copied from interface: TcpConnectionMBean
Gets the socket address used by the connection.

Specified by:
getAddress in interface TcpConnectionMBean
Returns:
the connection's socket address.

getCreationDate

public java.util.Date getCreationDate()
Description copied from interface: TcpConnectionMBean
Gets connection creation date.

Specified by:
getCreationDate in interface TcpConnectionMBean
Returns:
the date of creation of the connection.

getReceivedCount

public long getReceivedCount()
Description copied from interface: TcpConnectionMBean
Gets the number of replies received on the connection.

Specified by:
getReceivedCount in interface TcpConnectionMBean
Returns:
the number of replies received on the connection.

getSentCount

public long getSentCount()
Description copied from interface: TcpConnectionMBean
Gets the number of requests sent on the connection.

Specified by:
getSentCount in interface TcpConnectionMBean
Returns:
the number of requests sent on the connection.


Copyright © 2010 ScalAgent D.T.. All Rights Reserved.