|
HOME | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | 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 int |
_state
The state of session |
protected Target |
_target
Target object representing agent |
protected int |
_timeout
Time out value |
protected com.ireasoning.core.network.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 |
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(Target target,
int transportLayer)
Constructs a new Session and connect to host |
protected |
Session(com.ireasoning.core.network.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. |
protected com.ireasoning.core.network.TransportLayer |
getTransportLayer(int i)
Returns the transport layer |
protected void |
open(String host,
int port)
Opens a new connection. |
protected void |
open(Target target)
Opens a new connection to the Target |
protected abstract Object |
receiveObject()
Returns received message |
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 |
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 com.ireasoning.core.network.TransportLayer _transportLayer
protected int _timeout
protected int _tries
protected int _state
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(com.ireasoning.core.network.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 agentIOException
- raised if can't connect to remote hostprotected Session(Target target, int transportLayer) throws IOException
transportLayer
- transport layer, ether Session.TCP (TCP tranport
layer) or Session.UDP (UDP tranport layer)target
- represents the agentIOException
- raised if can't connect to remote hostMethod Detail |
protected void open(String host, int port) throws IOException
host
- host name of agentport
- port number of agentprotected void open(Target target) throws IOException
target
- represents the agentpublic void setTransportLayer(int transportLayer)
transportLayer
- transport layer, ether Session.TCP (TCP tranport
layer) or Session.UDP (UDP tranport layer)public int getTimeout()
public void setTimeout(int timeout) throws SocketException
timeout
- the specified timeout in millisecondspublic 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
finalize
in class Object
public int getState()
getState
in interface State
public String getStateString()
State
getStateString
in interface State
protected com.ireasoning.core.network.TransportLayer getTransportLayer(int i)
public void startThread()
protected abstract Object receiveObject() throws IOException
|
HOME | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |