de.root1.simon
Class ClientToServerConnection

java.lang.Object
  extended by de.root1.simon.ClientToServerConnection

public class ClientToServerConnection
extends java.lang.Object

This class is used to store the relation between:

This information is used by Simon to establish only one connection to a server for several Simon.lookup(java.lang.String, int, java.lang.String) calls. Each lookup on the same connection increases a reference count. The connection will be dropped by SIMON if the reference count reaches 0.

Author:
ACHR

Constructor Summary
protected ClientToServerConnection(java.lang.String serverString, Dispatcher dispatcher, org.apache.mina.core.session.IoSession session, org.apache.mina.core.service.IoConnector connector, java.util.concurrent.ExecutorService filterchainWorkerPool)
          Creates a new Instance of ClientToServerConnection
 
Method Summary
protected  int addRef()
          Increases the reference count by one
protected  int delRef()
          Decreases the reference count by one
protected  org.apache.mina.core.service.IoConnector getConnector()
          Returns the IoConnector related to the connection
protected  Dispatcher getDispatcher()
          Gets the Dispatcher the client uses to communicate with the network
protected  java.util.concurrent.ExecutorService getFilterchainWorkerPool()
           
protected  int getRefCount()
          Returns the current valid reference count
protected  java.lang.String getServerString()
          Gets the server string
protected  org.apache.mina.core.session.IoSession getSession()
          Gets the session which is used by the client to communicate with the server via Dispatcher
protected  void setConnector(org.apache.mina.transport.socket.nio.NioSocketConnector connector)
          Sets the socket connector used by SIMON to connect to server
protected  void setDispatcher(Dispatcher dispatcher)
          Sets the Dispatcher the client uses to communicate with the network
protected  void setFilterchainWorkerPool(java.util.concurrent.ExecutorService filterchainWorkerPool)
           
protected  void setServerString(java.lang.String serverString)
          Sets the server string
protected  void setSession(org.apache.mina.core.session.IoSession session)
          Sets the session which is used by the client to communicate with the server via Dispatcher
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientToServerConnection

protected ClientToServerConnection(java.lang.String serverString,
                                   Dispatcher dispatcher,
                                   org.apache.mina.core.session.IoSession session,
                                   org.apache.mina.core.service.IoConnector connector,
                                   java.util.concurrent.ExecutorService filterchainWorkerPool)
Creates a new Instance of ClientToServerConnection

Parameters:
serverString - the used server string
dispatcher - the used dispatcher
session -
connector -
filterchainWorkerPool -
Method Detail

getConnector

protected org.apache.mina.core.service.IoConnector getConnector()
Returns the IoConnector related to the connection

Returns:
the related IoConnector

setConnector

protected void setConnector(org.apache.mina.transport.socket.nio.NioSocketConnector connector)
Sets the socket connector used by SIMON to connect to server

Parameters:
connector -

getFilterchainWorkerPool

protected java.util.concurrent.ExecutorService getFilterchainWorkerPool()

setFilterchainWorkerPool

protected void setFilterchainWorkerPool(java.util.concurrent.ExecutorService filterchainWorkerPool)

addRef

protected int addRef()
Increases the reference count by one

Returns:
the new reference count

delRef

protected int delRef()
Decreases the reference count by one

Returns:
the new reference count

getRefCount

protected int getRefCount()
Returns the current valid reference count

Returns:
the current reference count

getDispatcher

protected Dispatcher getDispatcher()
Gets the Dispatcher the client uses to communicate with the network

Returns:
the stored dispatcher

setDispatcher

protected void setDispatcher(Dispatcher dispatcher)
Sets the Dispatcher the client uses to communicate with the network

Parameters:
dispatcher - the dispatcher to store

getSession

protected org.apache.mina.core.session.IoSession getSession()
Gets the session which is used by the client to communicate with the server via Dispatcher

Returns:
the stored session

setSession

protected void setSession(org.apache.mina.core.session.IoSession session)
Sets the session which is used by the client to communicate with the server via Dispatcher

Parameters:
session - the session to store

getServerString

protected java.lang.String getServerString()
Gets the server string

Returns:
the stored server string

setServerString

protected void setServerString(java.lang.String serverString)
Sets the server string

Parameters:
serverString - the server string to store


Copyright © 2011. All Rights Reserved.