FileDocCategorySizeDatePackage
JMXConnectionNotification.javaAPI DocJava SE 5 API5856Fri Aug 26 14:57:38 BST 2005javax.management.remote

JMXConnectionNotification

public class JMXConnectionNotification extends Notification

Notification emitted when a client connection is opened or closed or when notifications are lost. These notifications are sent by connector servers (instances of {@link JMXConnectorServer}) and by connector clients (instances of {@link JMXConnector}). For certain connectors, a session can consist of a sequence of connections. Connection-opened and connection-closed notifications will be sent for each one.

The notification type is one of the following:

Type Meaning
jmx.remote.connection.opened A new client connection has been opened.
jmx.remote.connection.closed A client connection has been closed.
jmx.remote.connection.failed A client connection has failed unexpectedly.
jmx.remote.connection.notifs.lost A client connection has potentially lost notifications. This notification only appears on the client side.

The timeStamp of the notification is a time value (consistent with {@link System#currentTimeMillis()}) indicating when the notification was constructed.

since
1.5
since.unbundled
1.0

Fields Summary
private static final long
serialVersionUID
public static final String
OPENED

Notification type string for a connection-opened notification.

public static final String
CLOSED

Notification type string for a connection-closed notification.

public static final String
FAILED

Notification type string for a connection-failed notification.

public static final String
NOTIFS_LOST

Notification type string for a connection that has possibly lost notifications.

private final String
connectionId
Constructors Summary
public JMXConnectionNotification(String type, Object source, String connectionId, long sequenceNumber, String message, Object userData)
Constructs a new connection notification. The {@link #getSource() source} of the notification depends on whether it is being sent by a connector server or a connector client:
  • For a connector server, if it is registered in an MBean server, the source is the {@link ObjectName} under which it is registered. Otherwise, it is a reference to the connector server object itself, an instance of a subclass of {@link JMXConnectorServer}.
  • For a connector client, the source is a reference to the connector client object, an instance of a class implementing {@link JMXConnector}.

param
type the type of the notification. This is usually one of the constants {@link #OPENED}, {@link #CLOSED}, {@link #FAILED}, {@link #NOTIFS_LOST}. It is not an error for it to be a different string.
param
source the connector server or client emitting the notification.
param
connectionId the ID of the connection within its connector server.
param
sequenceNumber a non-negative integer. It is expected but not required that this number will be greater than any previous sequenceNumber in a notification from this source.
param
message an unspecified text message, typically containing a human-readable description of the event. Can be null.
param
userData an object whose type and meaning is defined by the connector server. Can be null.
exception
NullPointerException if type, source, or connectionId is null.
exception
IllegalArgumentException if sequenceNumber is negative.


                                                                                                                                                                                                                                                  
      
				      
				      
				      
				      
				       
	/* We don't know whether the parent class (Notification) will
	   throw an exception if the type or source is null, because
	   JMX 1.2 doesn't specify that.  So we make sure it is not
	   null, in case it would throw the wrong exception
	   (e.g. IllegalArgumentException instead of
	   NullPointerException).  Likewise for the sequence number.  */
	super((String) nonNull(type),
	      nonNull(source),
	      Math.max(0, sequenceNumber),
	      System.currentTimeMillis(),
	      message);
	if (type == null || source == null || connectionId == null)
	    throw new NullPointerException("Illegal null argument");
	if (sequenceNumber < 0)
	    throw new IllegalArgumentException("Negative sequence number");
	this.connectionId = connectionId;
	setUserData(userData);
    
Methods Summary
public java.lang.StringgetConnectionId()

The connection ID to which this notification pertains.

return
the connection ID.

	return connectionId;
    
private static java.lang.ObjectnonNull(java.lang.Object arg)

	if (arg == null)
	    return "";
	else
	    return arg;