All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.jaw.impl.adaptor.generic.AdaptorServer

java.lang.Object
   |
   +----com.sun.jaw.impl.adaptor.generic.AdaptorServer

public abstract class AdaptorServer
extends Object
implements Runnable, Serializable, ActivatableIf
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
running ONLINE
stopped OFFLINE
stopping STOPPING

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.


Variable Index

 o OFFLINE
 o ONLINE
 o STOPPING

Constructor Index

 o AdaptorServer()
Instantiates an AdaptorServer

Method Index

 o addAdaptorListener(AdaptorListener)
Register a state change listener.
 o deleteCmf()
For Java DMK internal use only.
 o getActiveClientCount()
Returns the number of clients currently being processed by this AdaptorServer.
 o getMaxActiveClientCount()
Returns the maximum number of clients that this AdaptorServer can process concurrently.
 o getPort()
Returns the port number used by this AdaptorServer.
 o getProtocol()
Returns the protocol being used by this AdaptorServer.
 o getServedClientCount()
Returns the number of clients that have been processed by this AdaptorServer since its creation.
 o getState()
Returns the state of this AdaptorServer.
 o getStateString()
Returns the state of this AdaptorServer in string form.
 o initCmf(Framework, ObjectName, boolean, ModificationList)
For Java DMK internal use only.
 o isActive()
Tests if the AdaptorServer is active.
 o notifyClientHandlerCreated(ClientHandler)
For Java DMK internal use only.
 o notifyClientHandlerDeleted(ClientHandler)
For Java DMK internal use only.
 o performStart()
Starts this AdaptorServer.
 o performStop()
Stops this AdaptorServer.
 o performWaitState(int, long)
Waits to be notified of a change in this object.
 o removeAdaptorListener(AdaptorListener)
Unregister a state change listener.
 o run()
For Java DMK internal use only.
 o setMaxActiveClientCount(Integer)
Sets the maximum number of clients this AdaptorServer can process concurrently.

Variables

 o ONLINE
 public static final int ONLINE
 o OFFLINE
 public static final int OFFLINE
 o STOPPING
 public static final int STOPPING

Constructors

 o AdaptorServer
 public AdaptorServer()
Instantiates an AdaptorServer

Methods

 o performStart
 public synchronized void performStart()
Starts this AdaptorServer.

Has no effect if this AdaptorServer is ONLINE or STOPPING.

 o performStop
 public void performStop()
Stops this AdaptorServer.

Has no effect if this AdaptorServer is OFFLINE or STOPPING.

 o isActive
 public boolean isActive()
Tests if the AdaptorServer is active.

 o performWaitState
 public boolean performWaitState(int s,
                                 long timeOut)
Waits to be notified of a change in this object. It waits until either of the following two conditions has occurred:

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.

Parameters:
s - the state to wait.
timeOut - the maximum time to wait in milliseconds.
Returns:
true if the state is the same as the s argument; false otherwise.
 o getState
 public Integer getState()
Returns the state of this AdaptorServer.

Returns:
ONLINE, OFFLINE or STOPPING.
 o getStateString
 public String getStateString()
Returns the state of this AdaptorServer in string form.

Returns:
One of the strings "ONLINE", "OFFLINE" or "STOPPING".
 o getPort
 public Integer getPort()
Returns the port number used by this AdaptorServer.

Returns:
The port number used by this AdaptorServer.
 o getServedClientCount
 public Integer getServedClientCount()
Returns the number of clients that have been processed by this AdaptorServer since its creation.

Returns:
The number of clients handled by this AdaptorServer since its creation. This counter is not reset by the performStop method.
 o getActiveClientCount
 public Integer getActiveClientCount()
Returns the number of clients currently being processed by this AdaptorServer.

Returns:
The number of clients currently being processed by this AdaptorServer.
 o getMaxActiveClientCount
 public Integer getMaxActiveClientCount()
Returns the maximum number of clients that this AdaptorServer can process concurrently.

Returns:
The maximum number of clients that this AdaptorServer can process concurrently.
 o setMaxActiveClientCount
 public void setMaxActiveClientCount(Integer c)
Sets the maximum number of clients this AdaptorServer can process concurrently.

Parameters:
c - The number of clients.
 o notifyClientHandlerCreated
 public void notifyClientHandlerCreated(ClientHandler h)
For Java DMK internal use only.

 o notifyClientHandlerDeleted
 public synchronized void notifyClientHandlerDeleted(ClientHandler h)
For Java DMK internal use only.

 o initCmf
 public void initCmf(Framework f,
                     ObjectName name,
                     boolean db,
                     ModificationList list) throws InstanceAlreadyExistException
For Java DMK internal use only.

Calls the performStart method if this adaptor is OFFLINE.

Throws: InstanceAlreadyExistException
The m-bean is already registered in the repository.
 o deleteCmf
 public void deleteCmf() throws InstanceNotFoundException, InvocationTargetException
For Java DMK internal use only.

Calls the performStop method if this adaptor is ONLINE.

Throws: InstanceNotFoundException
The m-bean does not exist in the repository.
Throws: InvocationTargetException
It is a checked exception that wraps an exception thrown by an invoked method or constructor.
 o getProtocol
 public abstract String getProtocol()
Returns the protocol being used by this AdaptorServer.

Returns:
The protocol as a string.
 o run
 public void run()
For Java DMK internal use only.

The run method executed by this adaptor's main thread.

 o addAdaptorListener
 public synchronized void addAdaptorListener(AdaptorListener listener)
Register a state change listener.

 o removeAdaptorListener
 public synchronized void removeAdaptorListener(AdaptorListener listener)
Unregister a state change listener.


All Packages  Class Hierarchy  This Package  Previous  Next  Index