/*
* @(#)file CommunicatorServerMBean.java
* @(#)author Sun Microsystems, Inc.
* @(#)version 1.25
* @(#)lastedit 03/12/19
*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*/
package com.sun.jmx.snmp.daemon;
/**
* 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.
*
*
This API is a Sun Microsystems internal API and is subject * to change without notice.
* @version 1.25 12/19/03 * @author Sun Microsystems, Inc */ public interface CommunicatorServerMBean { /** * Starts thisCommunicatorServer
.
*
* Has no effect if this CommunicatorServer
is ONLINE
or
* STOPPING
.
*/
public void start() ;
/**
* Stops this CommunicatorServer
.
*
* Has no effect if this CommunicatorServer
is OFFLINE
or
* STOPPING
.
*/
public void stop() ;
/**
* Tests if the CommunicatorServer
is active.
*
* @return True if connector is ONLINE
; false otherwise.
*/
public boolean isActive() ;
/**
* Waits untill 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:
*
waitState
returns immediately (i.e. does not wait at all),waitState
waits untill the value of this MBean's State attribute
* is the same as the state parameter (i.e. will wait indefinitely if this condition is never met).CommunicatorServer.OFFLINE
,CommunicatorServer.ONLINE
,CommunicatorServer.STARTING
,CommunicatorServer.STOPPING
.CommunicatorServer
as an integer.
*
* @return ONLINE
, OFFLINE
, STARTING
or STOPPING
.
*/
public int getState() ;
/**
* Gets the state of this CommunicatorServer
as a string.
*
* @return One of the strings "ONLINE", "OFFLINE", "STARTING" or "STOPPING".
*/
public String getStateString() ;
/**
* Gets the host name used by this CommunicatorServer
.
*
* @return The host name used by this CommunicatorServer
.
*/
public String getHost() ;
/**
* Gets the port number used by this CommunicatorServer
.
*
* @return The port number used by this CommunicatorServer
.
*/
public int getPort() ;
/**
* Sets the port number used by this CommunicatorServer
.
*
* @param port The port number used by this CommunicatorServer
.
*
* @exception java.lang.IllegalStateException This method has been invoked
* while the communicator was ONLINE or STARTING.
*/
public void setPort(int port) throws java.lang.IllegalStateException ;
/**
* Gets the protocol being used by this CommunicatorServer
.
* @return The protocol as a string.
*/
public abstract String getProtocol() ;
}