|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.sun.jaw.impl.adaptor.generic.AdaptorServer
The AdaptorServer class defines generic behaviour for the server
part of an adaptor. Most adaptors extend AdaptorServer and
inherit this behaviour. Adaptors that do not fit this model do not extend
AdaptorServer.
An AdaptorServer is an active object, it listens for client requests
and processes them in its own thread. When necessary, an AdaptorServer
creates other threads to process multiple requests concurrently.
An AdaptorServer object can be stopped by calling the performStop
method. When it is stopped, the AdaptorServer no longer listens to client
requests and no longer holds any thread or communication resources.
It can be started again by calling the performStart method.
An AdaptorServer has a state property which reflects its
activity.
| AdaptorServer | 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 AdaptorServer is
finishing or interrupting active requests.
An AdaptorServer 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 an AdaptorServer is registered in the framework, it is
started automatically. When it is unregistered from the framework it is
stopped automatically.
| Field Summary | |
protected Framework |
cmf
The core management framework to register the adaptor server with. |
protected int |
maxActiveClientCount
The maximum number of clients that the adaptor server can process concurrently. |
protected ObjectName |
objectName
The object name of the adaptor server. |
static int |
OFFLINE
Represents an OFFLINE state. |
static int |
ONLINE
Represents an ONLINE state. |
protected int |
port
The Port number used by the adaptor server. |
static int |
STARTING
Represents a STARTING state. |
protected int |
state
The state of the adaptor server. |
static int |
STOPPING
Represents a STOPPING state. |
| Constructor Summary | |
AdaptorServer()
Instantiates an AdaptorServer. |
|
| Method Summary | |
void |
addAdaptorListener(AdaptorListener listener)
Registers a state change listener. |
void |
deleteCmf()
Stops the adaptor server after deregistration if this adaptor is ONLINE. |
java.lang.Integer |
getActiveClientCount()
Gets the number of clients currently being processed by this AdaptorServer. |
java.lang.Integer |
getMaxActiveClientCount()
Gets the maximum number of clients that this AdaptorServer can
process concurrently. |
java.lang.Integer |
getPort()
Gets the port number used by this AdaptorServer. |
abstract java.lang.String |
getProtocol()
Gets the protocol being used by this AdaptorServer. |
java.lang.Integer |
getServedClientCount()
Gets the number of clients that have been processed by this AdaptorServer
since its creation. |
java.lang.Integer |
getState()
Gets the state of this AdaptorServer as an integer. |
java.lang.String |
getStateString()
Gets the state of this AdaptorServer as a string. |
void |
initCmf(Framework f,
ObjectName name,
boolean db,
ModificationList list)
Starts the adaptor server after registration if this adaptor is OFFLINE. |
boolean |
isActive()
Tests if the AdaptorServer is active. |
void |
performStart()
Starts this AdaptorServer. |
void |
performStop()
Stops this AdaptorServer. |
boolean |
performWaitState(int s,
long timeOut)
Waits to be notified of a change in this object. |
void |
removeAdaptorListener(AdaptorListener listener)
Unregisters a state change listener. |
void |
setMaxActiveClientCount(java.lang.Integer c)
Sets the maximum number of clients this AdaptorServer can
process concurrently. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public static final int ONLINE
ONLINE state.public static final int OFFLINE
OFFLINE state.public static final int STOPPING
STOPPING state.public static final int STARTING
STARTING state.protected transient int state
protected ObjectName objectName
protected Framework cmf
protected int maxActiveClientCount
protected int port
| Constructor Detail |
public AdaptorServer()
AdaptorServer.| Method Detail |
public void performStart()
AdaptorServer.
Has no effect if this AdaptorServer is ONLINE or
STOPPING.
public void performStop()
AdaptorServer.
Has no effect if this AdaptorServer is OFFLINE or
STOPPING.
public boolean isActive()
AdaptorServer is active.
public boolean performWaitState(int s,
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 s argument.
s - The state to wait.timeOut - The maximum time to wait in milliseconds.public java.lang.Integer getState()
AdaptorServer as an integer.ONLINE, OFFLINE or STOPPING.public java.lang.String getStateString()
AdaptorServer as a string.public java.lang.Integer getPort()
AdaptorServer.AdaptorServer.public java.lang.Integer getServedClientCount()
AdaptorServer
since its creation.AdaptorServer
since its creation. This counter is not reset by the performStop method.public java.lang.Integer getActiveClientCount()
AdaptorServer.AdaptorServer.public java.lang.Integer getMaxActiveClientCount()
AdaptorServer can
process concurrently.AdaptorServer can
process concurrently.public void setMaxActiveClientCount(java.lang.Integer c)
AdaptorServer can
process concurrently.c - The number of clients.
public void initCmf(Framework f,
ObjectName name,
boolean db,
ModificationList list)
throws InstanceAlreadyExistException
OFFLINE.
This method is not intent to be called directly by the user.
f - The core management framework to register the service with.name - The object name.db - Indicates if persistent storage is required.list - The modification list to use for setting up parameters.
public void deleteCmf()
throws InstanceNotFoundException,
java.lang.reflect.InvocationTargetException
ONLINE.
This method is not intent to be called directly by the user.
public abstract java.lang.String getProtocol()
AdaptorServer.public void addAdaptorListener(AdaptorListener listener)
listener - The adaptor listener to add.public void removeAdaptorListener(AdaptorListener listener)
listener - The adaptor listener to remove.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||