|
Java™ Platform Standard Ed. 7 DRAFT ea-b76 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.management.event.EventClientDelegate
public class EventClientDelegate extends Object implements EventClientDelegateMBean
This is the default implementation of the MBean
EventClientDelegateMBean.
| Modifier and Type | Field and Description |
|---|
| Fields inherited from interface javax.management.event.EventClientDelegateMBean |
|---|
EVENT_CLIENT_LISTENER_ID, OBJECT_NAME, OBJECT_NAME_STRING |
| Modifier and Type | Method and Description |
|---|---|
String |
addClient(String className,
Object[] params,
String[] sig)
Adds a new client to the EventClientDelegateMBean with
a user-specified
EventForwarder to forward notifications to the client. |
String |
addClient(String className,
ObjectName classLoader,
Object[] params,
String[] sig)
Adds a new client to the EventClientDelegateMBean with
a user-specified
EventForwarder to forward notifications to the client. |
Integer |
addListener(String clientId,
ObjectName name,
NotificationFilter filter)
Adds a listener to receive notifications from an MBean and returns a non-negative integer as the identifier of the listener. |
Integer |
addSubscriber(String clientId,
ObjectName name,
NotificationFilter filter)
Subscribes a listener to receive notifications from an MBean or a set of MBeans represented by an ObjectName pattern. |
NotificationResult |
fetchNotifications(String clientId,
long startSequenceNumber,
int maxNotifs,
long timeout)
Called by a client to fetch notifications that are to be sent to its listeners. |
static EventClientDelegate |
getEventClientDelegate(MBeanServer server)
Returns an EventClientDelegate instance for the given
MBeanServer. |
Integer[] |
getListenerIds(String clientId)
Returns the identifiers of listeners added or subscribed to with the specified client identifier. |
static EventClientDelegateMBean |
getProxy(MBeanServerConnection conn)
Returns a proxy of the default EventClientDelegateMBean. |
long |
lease(String clientId,
long timeout)
An EventClient calls this method to keep its clientId
alive in this MBean. |
static MBeanServerForwarder |
newForwarder(MBeanServer nextMBS,
MBeanServer loopMBS)
Create a new MBeanServerForwarder that simulates the existence
of an EventClientDelegateMBean with the default name. |
void |
removeClient(String clientId)
Removes an added client. |
void |
removeListenerOrSubscriber(String clientId,
Integer listenerId)
Removes a listener, to stop receiving notifications. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static EventClientDelegate getEventClientDelegate(MBeanServer server)
EventClientDelegate instance for the given
MBeanServer. Calling this method more than once with the same
server argument may return the same object or a different object
each time. See EventClientDelegateMBean for an example use of
this method.
server - An MBean server instance to work with.EventClientDelegate instance.NullPointerException - If server is null.
public static MBeanServerForwarder newForwarder(MBeanServer nextMBS,
MBeanServer loopMBS)
Create a new MBeanServerForwarder that simulates the existence
of an EventClientDelegateMBean with the default name. This forwarder intercepts MBean requests
that are targeted for that MBean and handles them itself. All other
requests are forwarded to the next element in the forwarder chain.
nextMBS - the next MBeanServer in the chain of forwarders,
which might be another MBeanServerForwarder or a plain MBeanServer. This is the object to which MBeanServer requests
that do not concern the EventClientDelegateMBean are sent.
It will be the value of getMBeanServer() on the returned object, and can be changed with setMBeanServer. It can be null but
must be set to a non-null value before any MBeanServer requests
arrive.loopMBS - the MBeanServer to which requests from the
EventClientDelegateMBean should be sent. For example,
when you invoke the addListener operation on the EventClientDelegateMBean, it will
result in a call to addNotificationListener on this object.
If this parameter is null, then these requests will be sent to the
newly-created MBeanServerForwarder. Usually the parameter will
either be null or will be the result of getSystemMBeanServerForwarder() for the connector server in which
this forwarder will be installed.MBeanServerForwarder that simulates the existence
of an EventClientDelegateMBean.JMXConnectorServer.installStandardForwarders(java.util.Map) public static EventClientDelegateMBean getProxy(MBeanServerConnection conn)
EventClientDelegateMBean.
conn - An MBeanServerConnection to work with.
public String addClient(String className,
Object[] params,
String[] sig)
throws MBeanException
EventClientDelegateMBeanEventClientDelegateMBean with
a user-specified
EventForwarder to forward notifications to the client. The
EventForwarder is created by calling
MBeanServer.instantiate(String, Object[],
String[]).
addClient in interface EventClientDelegateMBeanclassName - The class name used to create an
EventForwarder.params - An array containing the parameters of the constructor to
be invoked.sig - An array containing the signature of the constructor to be
invokedMBeanException - An exception thrown when creating the user
specified EventForwarder.
public String addClient(String className,
ObjectName classLoader,
Object[] params,
String[] sig)
throws MBeanException
EventClientDelegateMBeanEventClientDelegateMBean with
a user-specified
EventForwarder to forward notifications to the client. The
EventForwarder is created by calling
MBeanServer.instantiate(String, ObjectName,
Object[], String[]). A user-specified class loader is used to create
this EventForwarder.
addClient in interface EventClientDelegateMBeanclassName - The class name used to create an
EventForwarder.classLoader - An ObjectName registered as a
ClassLoader MBean.params - An array containing the parameters of the constructor to
be invoked.sig - An array containing the signature of the constructor to be
invokedMBeanException - An exception thrown when creating the user
specified EventForwarder.
public Integer[] getListenerIds(String clientId)
throws IOException,
EventClientNotFoundException
EventClientDelegateMBeanIf no listener is currently registered with the client, an empty array is returned.
getListenerIds in interface EventClientDelegateMBeanclientId - The client identifier with which the listeners are
added or subscribed to.IOException - Reserved for a remote call to throw on the client
side.EventClientNotFoundException - If the clientId is
not found.
public Integer addListener(String clientId,
ObjectName name,
NotificationFilter filter)
throws EventClientNotFoundException,
InstanceNotFoundException
This method is called by an EventClient to implement the
method EventClient.addNotificationListener(ObjectName,
NotificationListener, NotificationFilter, Object).
The execution of this method includes a call to
MBeanServer.addNotificationListener(ObjectName,
NotificationListener, NotificationFilter, Object).
addListener in interface EventClientDelegateMBeanclientId - The client identifier with which the listener is added.name - The name of the MBean onto which the listener should be added.filter - The filter object. If filter is null,
no filtering will be performed before handling notifications.EventClientNotFoundException - Thrown if the clientId is
not found.InstanceNotFoundException - Thrown if the MBean is not found.
public void removeListenerOrSubscriber(String clientId,
Integer listenerId)
throws InstanceNotFoundException,
ListenerNotFoundException,
EventClientNotFoundException,
IOException
This method is called by an EventClient to execute its
methods EventClient.removeNotificationListener(ObjectName,
NotificationListener, NotificationFilter, Object),
EventClient.removeNotificationListener(ObjectName,
NotificationListener), and EventClient.unsubscribe(javax.management.ObjectName, javax.management.NotificationListener).
The execution of this method can include call to
MBeanServer.removeNotificationListener(ObjectName,
NotificationListener, NotificationFilter, Object).
removeListenerOrSubscriber in interface EventClientDelegateMBeanclientId - The client identifier with which the listener was added.listenerId - The listener identifier to be removed. This must be
an identifier returned by a previous addListener
or addSubscriber call.InstanceNotFoundException - if the MBean on which the listener
was added no longer exists.ListenerNotFoundException - if there is no listener with the
given listenerId.EventClientNotFoundException - if the clientId is
not found.IOException - Reserved for a remote call to throw on the client
side.
public Integer addSubscriber(String clientId,
ObjectName name,
NotificationFilter filter)
throws EventClientNotFoundException,
IOException
Subscribes a listener to receive notifications from an MBean or a
set of MBeans represented by an ObjectName pattern. (It is
not an error if no MBeans match the pattern at the time this method is
called.)
Returns a non-negative integer as the identifier of the listener.
This method is called by an EventClient to execute its
method EventClient.subscribe(ObjectName, NotificationListener,
NotificationFilter, Object).
The execution of this method includes a call to
MBeanServer.addNotificationListener(ObjectName,
NotificationListener, NotificationFilter, Object) for
every MBean matching name. If name is
an ObjectName pattern, then the execution of this
method will include a call to MBeanServer.queryNames(javax.management.ObjectName, javax.management.QueryExp).
addSubscriber in interface EventClientDelegateMBeanclientId - The remote client's identifier.name - The name of an MBean or an ObjectName pattern
representing a set of MBeans to which the listener should listen.filter - The filter object. If filter is null, no
filtering will be performed before notifications are handled.EventClientNotFoundException - If the client ID is not found.IOException - Reserved for a remote client to throw if
an I/O error occurs.EventConsumer.subscribe(ObjectName, NotificationListener,
NotificationFilter,Object),
EventClientDelegateMBean.removeListenerOrSubscriber(String, Integer)
public NotificationResult fetchNotifications(String clientId,
long startSequenceNumber,
int maxNotifs,
long timeout)
throws EventClientNotFoundException
EventClientDelegateMBean
fetchNotifications in interface EventClientDelegateMBeanclientId - The client's identifier.startSequenceNumber - The first sequence number to
consider.maxNotifs - The maximum number of notifications to return.timeout - The maximum waiting time.EventClientNotFoundException - Thrown if the clientId is
not found.
public void removeClient(String clientId)
throws EventClientNotFoundException
EventClientDelegateMBean
removeClient in interface EventClientDelegateMBeanEventClientNotFoundException - If the clientId is
not found.
public long lease(String clientId,
long timeout)
throws IOException,
EventClientNotFoundException
EventClientDelegateMBeanEventClient calls this method to keep its clientId
alive in this MBean. The client will be removed if the lease times out.
lease in interface EventClientDelegateMBeanclientId - The client's identifier.timeout - The time in milliseconds by which the lease is to be
extended. The value zero has no special meaning, so it will cause the
lease to time out immediately.IOException - reserved for a remote call to throw on the client
side.EventClientNotFoundException - if the clientId is
not found.
|
Java™ Platform Standard Ed. 7 DRAFT ea-b76 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.