javax.management.remote.generic
Class GenericConnectorServer

java.lang.Object
  extended byjavax.management.NotificationBroadcasterSupport
      extended byjavax.management.remote.JMXConnectorServer
          extended byjavax.management.remote.generic.GenericConnectorServer
All Implemented Interfaces:
JMXConnectorServerMBean, MBeanRegistration, NotificationBroadcaster, NotificationEmitter
Direct Known Subclasses:
JMXMPConnectorServer

public class GenericConnectorServer
extends JMXConnectorServer

A JMX API Connector server that creates connections to remote clients. This class can use a MessageConnectionServer object to specify how connections are made.

User code does not usually instantiate this class. Instead, a JMXConnectorServerProvider should be added to the JMXConnectorServerFactory so that users can implicitly instantiate the GenericConnector (or a subclass of it) through the JMXServiceURL provided when creating it.

The specific connector protocol to be used by an instance of this class is specified by attributes in the Map passed to the constructor. The attribute MESSAGE_CONNECTION_SERVER is the standard way to define the transport. An implementation can recognize other attributes to define the transport differently.


Field Summary
static String MESSAGE_CONNECTION_SERVER
          Name of the attribute that specifies how connections are made to this connector server.
static String OBJECT_WRAPPING
          Name of the attribute that specifies the object wrapping for parameters whose deserialization requires special treatment.
 
Fields inherited from class javax.management.remote.JMXConnectorServer
AUTHENTICATOR
 
Constructor Summary
GenericConnectorServer(Map env, MBeanServer mbs)
          Constructs a GenericConnectorServer attached to the given MBean server.
 
Method Summary
 JMXServiceURL getAddress()
          The address of this connector server.
 Map getAttributes()
          The attributes for this connector server.
 boolean isActive()
          Determines whether the connector server is active.
 void start()
          Activates the connector server, that is, starts listening for client connections.
 void stop()
          Deactivates the connector server, that is, stops listening for client connections.
 
Methods inherited from class javax.management.remote.JMXConnectorServer
connectionClosed, connectionFailed, connectionOpened, getConnectionIds, getMBeanServer, getNotificationInfo, postDeregister, postRegister, preDeregister, preRegister, setMBeanServerForwarder, toJMXConnector
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OBJECT_WRAPPING

public static final String OBJECT_WRAPPING

Name of the attribute that specifies the object wrapping for parameters whose deserialization requires special treatment. The value associated with this attribute, if any, must be an object that implements the interface ObjectWrapping.

See Also:
Constant Field Values

MESSAGE_CONNECTION_SERVER

public static final String MESSAGE_CONNECTION_SERVER

Name of the attribute that specifies how connections are made to this connector server. The value associated with this attribute, if any, must be an object that implements the interface MessageConnectionServer.

See Also:
Constant Field Values
Constructor Detail

GenericConnectorServer

public GenericConnectorServer(Map env,
                              MBeanServer mbs)

Constructs a GenericConnectorServer attached to the given MBean server.

Parameters:
env - a set of attributes for the connector server. Can be null, which is equivalent to an empty map.
mbs - the local MBeanServer used to execute a remote request. Null if the MBean server will be specified by registering this connector server as an MBean in it.
Throws:
IllegalArgumentException - if env contains some invalid values.
Method Detail

getAddress

public JMXServiceURL getAddress()
Description copied from interface: JMXConnectorServerMBean

The address of this connector server.

Returns:
the address of this connector server, or null if it does not have one.

getAttributes

public Map getAttributes()
Description copied from interface: JMXConnectorServerMBean

The attributes for this connector server.

Returns:
a read-only map containing the attributes for this connector server. Attributes whose values are not serializable are omitted from this map. If there are no serializable attributes, the returned map is empty.

start

public void start()
           throws IOException

Activates the connector server, that is, starts listening for client connections. Calling this method when the connector server is already active has no effect. Calling this method when the connector server has been stopped will generate an IOException.

Throws:
IllegalStateException - if the connector server has not been attached to an MBean server.
IOException - if the connector server cannot be started.

stop

public void stop()
          throws IOException
Description copied from interface: JMXConnectorServerMBean

Deactivates the connector server, that is, stops listening for client connections. Calling this method will also close all client connections that were made by this server. After this method returns, whether normally or with an exception, the connector server will not create any new client connections.

Once a connector server has been stopped, it cannot be started again.

Calling this method when the connector server has already been stopped has no effect. Calling this method when the connector server has not yet been started will disable the connector server object permanently.

If closing a client connection produces an exception, that exception is not thrown from this method. A JMXConnectionNotification with type JMXConnectionNotification.FAILED is emitted from this MBean with the connection ID of the connection that could not be closed.

Closing a connector server is a potentially slow operation. For example, if a client machine with an open connection has crashed, the close operation might have to wait for a network protocol timeout. Callers that do not want to block in a close operation should do it in a separate thread.

Throws:
IOException - if the server cannot be closed cleanly. When this exception is thrown, the server has already attempted to close all client connections. All client connections are closed except possibly those that generated exceptions when the server attempted to close them.

isActive

public boolean isActive()
Description copied from interface: JMXConnectorServerMBean

Determines whether the connector server is active. A connector server starts being active when its start method returns successfully and remains active until either its stop method is called or the connector server fails.

Returns:
true if the connector server is active.

JMX Remote API Specification 1.0 Final Release
Generated from RI build jmxremote-1_0_1_03-b57.2 2005.11.28_17:40:34_MET

Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.