com.sun.jdmk.comm
Interface CommunicatorServerMBean

All Known Subinterfaces:
GenericHttpConnectorServerMBean, HttpConnectorServerMBean, HttpsConnectorServerMBean, RmiConnectorServerMBean, SnmpAdaptorServerMBean, SnmpV3AdaptorServerMBean
All Known Implementing Classes:
CommunicatorServer, CommunicatorServer, GenericHttpConnectorServer, HtmlAdaptorServer, HttpConnectorServer, HttpsConnectorServer, RmiConnectorServer, SnmpAdaptorServer, SnmpV3AdaptorServer

public interface CommunicatorServerMBean

Defines generic behavior for the server part of a connector or an adaptor. Most connectors or adaptors extend CommunicatorServer and inherit this behavior. 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
 String getHost()
          Gets the host name used by this CommunicatorServer.
 int getPort()
          Gets the port number used by this CommunicatorServer.
 String getProtocol()
          Gets the protocol being used by this CommunicatorServer.
 int getState()
          Gets the state of this CommunicatorServer as an integer.
 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 until either the State attribute of this MBean equals the specified state parameter, or the specified timeout has elapsed.
 

Method Detail

start

void start()
Starts this CommunicatorServer.

Has no effect if this CommunicatorServer is ONLINE or STOPPING.


stop

void stop()
Stops this CommunicatorServer.

Has no effect if this CommunicatorServer is OFFLINE or STOPPING.


isActive

boolean isActive()
Tests if the CommunicatorServer is active.

Returns:
True if connector is ONLINE; false otherwise.

waitState

boolean waitState(int state,
                  long timeout)
Waits until either the State attribute of this MBean equals the specified state parameter, or the specified timeout has elapsed. The method waitState returns with a boolean value indicating whether the specified state parameter equals the value of this MBean's State attribute at the time the method terminates. Two special cases for the timeout parameter value are:

Parameters:
state - The value of this MBean's State attribute to wait for. state can be one of: CommunicatorServer.OFFLINE, CommunicatorServer.ONLINE, CommunicatorServer.STARTING, CommunicatorServer.STOPPING.
timeout - The maximum time to wait for, in milliseconds, if positive. Infinite time out if 0, or no waiting at all if negative.
Returns:
true if the value of this MBean's State attribute is the same as the state parameter; false otherwise.

getState

int getState()
Gets the state of this CommunicatorServer as an integer.

Returns:
ONLINE, OFFLINE, STARTING or STOPPING.

getStateString

String getStateString()
Gets the state of this CommunicatorServer as a string.

Returns:
One of the strings "ONLINE", "OFFLINE", "STARTING" or "STOPPING".

getHost

String getHost()
Gets the host name used by this CommunicatorServer.

Returns:
The host name used by this CommunicatorServer.

getPort

int getPort()
Gets the port number used by this CommunicatorServer.

Returns:
The port number used by this CommunicatorServer.

setPort

void setPort(int port)
             throws IllegalStateException
Sets the port number used by this CommunicatorServer.

Parameters:
port - The port number used by this CommunicatorServer.
Throws:
IllegalStateException - This method has been invoked while the communicator was ONLINE or STARTING.

getProtocol

String getProtocol()
Gets the protocol being used by this CommunicatorServer.

Returns:
The protocol as a string.

Open Source build 02
opendmk-1.0-b02 2007.10.01_19:17:46_MEST

Copyright 1998-2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.