|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Defines generic behaviour for the server
part of a connector or an adaptor. Most connectors or adaptors extend CommunicatorServer
and inherit this behaviour. Connectors or adaptors that do not fit into this model do not extend
CommunicatorServer
.
An CommunicatorServer
is an active object, it listens for client requests
and processes them in its own thread. When necessary, a CommunicatorServer
creates other threads to process multiple requests concurrently.
A CommunicatorServer
object can be stopped by calling the stop
method. When it is stopped, the CommunicatorServer
no longer listens to client
requests and no longer holds any thread or communication resources.
It can be started again by calling the start
method.
A CommunicatorServer
has a state
property which reflects its
activity.
CommunicatorServer | State |
---|---|
stopped | OFFLINE |
starting | STARTING |
running | ONLINE |
stopping | STOPPING |
The STARTING
state marks the transition from OFFLINE
to
ONLINE
.
The STOPPING
state marks the transition from ONLINE
to
OFFLINE
. This occurs when the CommunicatorServer
is
finishing or interrupting active requests.
A CommunicatorServer
may serve several clients concurrently. The
number of concurrent clients can be limited using the property
maxActiveClientCount
. The default value of this property is
defined by the subclasses.
When a CommunicatorServer
is unregistered from the MBeanServer,
it is stopped automatically.
Method Summary | |
java.lang.String |
getHost()
Gets the host name used by this CommunicatorServer . |
int |
getPort()
Gets the port number used by this CommunicatorServer . |
java.lang.String |
getProtocol()
Gets the protocol being used by this CommunicatorServer . |
int |
getState()
Gets the state of this CommunicatorServer as an integer. |
java.lang.String |
getStateString()
Gets the state of this CommunicatorServer as a string. |
boolean |
isActive()
Tests if the CommunicatorServer is active. |
void |
setPort(int port)
Sets the port number used by this CommunicatorServer . |
void |
start()
Starts this CommunicatorServer . |
void |
stop()
Stops this CommunicatorServer . |
boolean |
waitState(int state,
long timeOut)
Waits to be notified of a change in this object. |
Method Detail |
public void start()
CommunicatorServer
.
Has no effect if this CommunicatorServer
is ONLINE
or
STOPPING
.
public void stop()
CommunicatorServer
.
Has no effect if this CommunicatorServer
is OFFLINE
or
STOPPING
.
public boolean isActive()
CommunicatorServer
is active.public boolean waitState(int state, long timeOut)
The method returns immediately is the timeOut argument is negative. And if timeOut argument equals 0 (zero), it waits only until another thread notifies a new state that is the same as state argument.
state
- The state to wait.timeOut
- The maximum time to wait in milliseconds.public int getState()
CommunicatorServer
as an integer.ONLINE
, OFFLINE
, STARTING
or STOPPING
.public java.lang.String getStateString()
CommunicatorServer
as a string.public java.lang.String getHost()
CommunicatorServer
.CommunicatorServer
.public int getPort()
CommunicatorServer
.CommunicatorServer
.public void setPort(int port) throws java.lang.IllegalStateException
CommunicatorServer
.port
- The port number used by this CommunicatorServer
.public java.lang.String getProtocol()
CommunicatorServer
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |