See: Description
Interface | Description |
---|---|
RelationSetUpdateListener |
The listener interface that must be implemented by any class that needs to be informed when an element is added to, or removed from, a
RelationSet . |
Class | Description |
---|---|
RelationSet |
Represents a "to many" relationship, where a particular MBean attribute defines a link between that MBean and many other MBeans.
|
RelationSetNotification |
Represents a change to the state of a
RelationSet . |
RelationSetNotification.NotificationType |
A type safe enumeration representation of the different possible types of RelationSet notifications.
|
RelationSetNotificationFilter |
Implementation of the
NotificationFilter interface that filters out all Notifications that do not apply to a specific RelationSet. |
Defines the classes used to represent "to many" relationships within the Caplin JMX implementation.
A RelationSet
contains all the elements that belong
to the "to many" side of a relationship. Examples of "to many" relationships are users to user
sessions, user sessions to cached objects and cached objects to user sessions.
RelationSet example:
public void getAttribute(ObjectName objectName, String attributeName) { // get the value of a specific attribute for a particular MBean Object attributeValue = mbeanServer.getAttribute(objectName, attributeName); if (attributeValue instanceof RelationSet) { // if the attribute is a RelationSet, add an update listener and register a notification listener and filter with the server RelationSet relationSet = (RelationSet) attributeValue; relationSet.addUpdateListener(new RelationSetUpdateListenerImpl() { public void elementAdded(Object addedElement, String type) { System.out.println("Element added: " + addedElement); } public void elementRemoved(Object removedElement, String type) { System.out.println("Element removed: " + removedElement); } }); mbeanServer.addNotificationListener(objectName, relationSet.getNotificationListener(), relationSet.getNotificationFilter(), null); } // call a method that displays the value of the attribute according to its type displayAttributeValue(attributeValue); }
Please send bug reports and comments to Caplin support