|
HOME | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ireasoning.protocol.ListenerManager com.ireasoning.protocol.Session
This class represents an open communication channel between client and server.
Field Summary | |
protected InetAddress |
_localAddr
|
protected int |
_localPort
|
protected int |
_state
The state of session |
protected Target |
_target
Target object representing agent |
protected ListenThread |
_thread
|
protected int |
_timeout
Time out value |
protected TransportLayer |
_transportLayer
Transport layer, ether TCP or UDP |
protected int |
_tries
Number of tries, default value is 3. |
static int |
DEFAULT_TIME_OUT
default time out is 60 seconds |
static int |
TCP
Tcp transport layer, the default one used by TL1Session |
static int |
UDP
Udp tranpsport layer, the default one used by SnmpSession |
Fields inherited from class com.ireasoning.protocol.ListenerManager |
_listeners |
Fields inherited from interface com.ireasoning.core.jmx.State |
STARTED, STARTING, STATES, STOPPED, STOPPING, UNINITIALIZED |
Constructor Summary | |
protected |
Session()
|
protected |
Session(int transportLayer)
Constructs a new daemon Session |
protected |
Session(String host,
int port,
int transportLayer)
Constructs a new Session and connects to host |
protected |
Session(String host,
int port,
int transportLayer,
InetAddress localAddr,
int localPort)
Constructs a new Session and connects to host |
protected |
Session(String host,
int port,
int transportLayer,
InetAddress localAddr,
int localPort,
int connectionTimeout)
Constructs a new Session and connects to host |
protected |
Session(String host,
int port,
TransportLayer transportLayer,
InetAddress localAddr,
int localPort,
int connectionTimeout)
|
protected |
Session(Target target,
int transportLayer,
InetAddress localAddr,
int localPort)
Constructs a new Session and connect to host |
protected |
Session(TransportLayer transportLayer)
Constructs a new daemon Session |
Method Summary | |
void |
close()
close the session |
protected void |
finalize()
Cleanup. |
int |
getRetries()
Returns the number of retries after timeout, default value is 3. |
int |
getState()
Returns the state of session, one of {Session.STARTING, Session.STARTED, Session.STOPPING, Session.STARTED} |
String |
getStateString()
Returns the string representation of current state. |
Target |
getTarget()
Returns the target which represents agent |
int |
getTimeout()
Returns the time out value, in milliseconds. |
TransportLayer |
getTransportLayer()
Returns the transport layer |
protected TransportLayer |
getTransportLayer(int i)
Returns the transport layer |
protected void |
open(String host,
int port,
InetAddress localAddr,
int localPort)
Opens a new connection. |
protected void |
open(String host,
int port,
InetAddress localAddr,
int localPort,
int connectionTimeout)
Opens a new connection. |
protected void |
open(Target target,
InetAddress localAddr,
int localPort)
Opens a new connection to the Target |
protected abstract Object |
receiveObject()
Returns received message |
protected void |
reopen(Target target)
Reopens connection to the destination |
void |
setRetries(int retries)
Sets the number of retries after timeout |
void |
setTarget(Target target)
Sets a new target |
void |
setTimeout(int timeout)
Sets time out value of underlying Socket |
void |
setTransportLayer(int transportLayer)
Sets a new transport layer |
void |
setTransportLayer(TransportLayer transportLayer)
Sets a custom transport layer |
void |
startThread()
Starts thread for asynchronous communication |
Methods inherited from class com.ireasoning.protocol.ListenerManager |
addListener, listenerExists, notifyListeners, notifyListeners, removeListener |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int UDP
public static final int TCP
public static final int DEFAULT_TIME_OUT
protected Target _target
protected TransportLayer _transportLayer
protected int _timeout
protected int _tries
protected int _state
protected ListenThread _thread
protected transient InetAddress _localAddr
protected transient int _localPort
Constructor Detail |
protected Session()
protected Session(int transportLayer)
transportLayer
- transport layer, ether Session.TCP (TCP tranport
layer) or Session.UDP (UDP tranport layer)protected Session(TransportLayer transportLayer)
transportLayer
- transport layer, ether Session.TCP (TCP tranport
layer) or Session.UDP (UDP tranport layer)protected Session(String host, int port, int transportLayer) throws IOException
transportLayer
- transport layer, ether Session.TCP (TCP tranport
layer) or Session.UDP (UDP tranport layer)host
- host name of agentport
- port number of agent
IOException
- raised if can't connect to remote hostprotected Session(String host, int port, int transportLayer, InetAddress localAddr, int localPort) throws IOException
transportLayer
- transport layer, ether Session.TCP (TCP tranport
layer) or Session.UDP (UDP tranport layer)host
- host name of agentport
- port number of agent
IOException
- raised if can't connect to remote hostprotected Session(String host, int port, int transportLayer, InetAddress localAddr, int localPort, int connectionTimeout) throws IOException
transportLayer
- transport layer, ether Session.TCP (TCP tranport
layer) or Session.UDP (UDP tranport layer)host
- host name of agentport
- port number of agent
IOException
- raised if can't connect to remote hostprotected Session(String host, int port, TransportLayer transportLayer, InetAddress localAddr, int localPort, int connectionTimeout) throws IOException
protected Session(Target target, int transportLayer, InetAddress localAddr, int localPort) throws IOException
transportLayer
- transport layer, ether Session.TCP (TCP tranport
layer) or Session.UDP (UDP tranport layer)target
- represents the agent
IOException
- raised if can't connect to remote hostMethod Detail |
protected void reopen(Target target) throws IOException
IOException
protected void open(String host, int port, InetAddress localAddr, int localPort) throws IOException
host
- host name of agentport
- port number of agent
IOException
protected void open(String host, int port, InetAddress localAddr, int localPort, int connectionTimeout) throws IOException
host
- host name of agentport
- port number of agent
IOException
protected void open(Target target, InetAddress localAddr, int localPort) throws IOException
target
- represents the agent
IOException
public void setTransportLayer(int transportLayer)
transportLayer
- transport layer, ether Session.TCP (TCP tranport
layer) or Session.UDP (UDP tranport layer)public void setTransportLayer(TransportLayer transportLayer)
transportLayer
- transport layer implementationpublic TransportLayer getTransportLayer()
public int getTimeout()
public void setTimeout(int timeout) throws SocketException
timeout
- the specified timeout in milliseconds
SocketException
public int getRetries()
public void setRetries(int retries)
retries
- number of retries after timeoutpublic void close()
public Target getTarget()
public void setTarget(Target target)
target
- new target objectprotected void finalize() throws Throwable
Throwable
public int getState()
getState
in interface State
public String getStateString()
State
getStateString
in interface State
protected TransportLayer getTransportLayer(int i)
public void startThread()
protected abstract Object receiveObject() throws IOException
IOException
|
HOME | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |