com.jrockit.mc.rjmx.subscription
Interface IMBeanHelperService


public interface IMBeanHelperService

Little helper service to provide simple access to commonly used functionality when handling MBeans. Allows the underlying implementation to cache commonly used values, and allows the user to control when the cache is cleared. Also provides AttributeValue. This service is really for JRMC internal use. Do not expect this one to be around for ever, nor that it will remain unchanged.

Author:
Marcus Hirt

Field Summary
static long NO_TIMESTAMP_AVAILABLE
          Time-stamp value for when no time-stamp is available.
 
Method Summary
 void addMBeanServerChangeListener(IMBeanServerChangeListener listener)
          Adds a listener which will be executed when the MBean configuration in the MBean server changes.
 void clearCache()
          Clears any caches used by the underlying implementation.
 long getApproximateServerTime(long currentTimeMillis)
          Takes a local time and tries to transform it to what it would have been in server time given the last measurements.
 AttributeValue getAttribute(AttributeDescriptor attrDescriptor)
          Retrieves the value of an attribute.
 java.util.List getAttributes(java.util.List attributesToFetch)
          Will return the specified attributes.
 long getLocalStartTime()
          Returns the start time in milliseconds when the connectorModel was connected.
 javax.management.MBeanInfo getMBeanInfo(javax.management.ObjectName mbean)
          Returns the MBeanInfo for the specified MBean.
 java.util.Map getMBeanInfos()
          Returns the bean infos for all available MBeans.
 java.util.Set getMBeanNames()
          Return a set of ObjectName containing all the names of all available MBeans.
 long getRemoteStartTime()
          Returns the time that the monitored JRockit was started, in server time.
 void removeMBeanServerChangeListener(IMBeanServerChangeListener listener)
          Removes any listener that was added by addMBeanServerChangeListener(IMBeanServerChangeListener).
 void setAttribute(AttributeDescriptor attributeDescriptor, java.lang.Object data)
          Sets the specified attribute.
 

Field Detail

NO_TIMESTAMP_AVAILABLE

static final long NO_TIMESTAMP_AVAILABLE
Time-stamp value for when no time-stamp is available.

See Also:
Constant Field Values
Method Detail

getMBeanNames

java.util.Set getMBeanNames()
                            throws java.io.IOException
Return a set of ObjectName containing all the names of all available MBeans.

Returns:
a set of ObjectName containing all the names of all available MBeans.
Throws:
java.io.IOException - if a problem occurred with underlying connection.

clearCache

void clearCache()
Clears any caches used by the underlying implementation.


getAttribute

AttributeValue getAttribute(AttributeDescriptor attrDescriptor)
                            throws java.io.IOException,
                                   javax.management.JMException
Retrieves the value of an attribute.

Parameters:
attrDescriptor - the self containing description of the attribute to retrieved (ObjectName + attribute).
Returns:
the time stamped value.
Throws:
java.io.IOException - if a problem occurred with underlying connection.
javax.management.JMException - if a JMX problem occurred.

getMBeanInfos

java.util.Map getMBeanInfos()
                            throws java.io.IOException
Returns the bean infos for all available MBeans.

Returns:
a map with the ObjectNames and their associated MBeanInfos.
Throws:
java.io.IOException - if the connection failed or some other IO related problem occurred.

getMBeanInfo

javax.management.MBeanInfo getMBeanInfo(javax.management.ObjectName mbean)
                                        throws java.io.IOException
Returns the MBeanInfo for the specified MBean.

Parameters:
mbean - the MBean for which to return the information.
Returns:
the MBeanInfo for the specified MBean (possible null).
Throws:
java.io.IOException - if the connection failed or some other IO related problem occurred.

getApproximateServerTime

long getApproximateServerTime(long currentTimeMillis)
Takes a local time and tries to transform it to what it would have been in server time given the last measurements. Will return undefined values if invoked on an unconnected IConnectionHandle.

Parameters:
currentTimeMillis - the time for which to derive the approximate server time.
Returns:
the approximate server time.

getLocalStartTime

long getLocalStartTime()
Returns the start time in milliseconds when the connectorModel was connected.

Returns:
the start time in milliseconds when the connectorModel was connected. If this ConnectorModel never has been connected, NO_TIMESTAMP_AVAILABLE is returned.

getAttributes

java.util.List getAttributes(java.util.List attributesToFetch)
                             throws java.io.IOException,
                                    javax.management.InstanceNotFoundException,
                                    javax.management.ReflectionException
Will return the specified attributes. The implementation may coalesce the attribute retrieval for attributes belonging to the same MBean to minimize round-trips. This method is used by the subscription facilities, and does not support the automatic fall-back/compatibility mechanism, since we want to detect failures in the SubscriptionThread and exchange the subscription instead of continuing failing/swapping attributes each time we fetch them.

Parameters:
attributesToFetch - the attributes to fetch as a list of IAttributeInfo.
Returns:
an array of time stamped data.
Throws:
java.io.IOException - if communication failed.
javax.management.ReflectionException - if one of the attributes could not be found.
javax.management.InstanceNotFoundException - if one of the mbeans could not be found.

setAttribute

void setAttribute(AttributeDescriptor attributeDescriptor,
                  java.lang.Object data)
                  throws javax.management.OperationsException,
                         javax.management.InvalidAttributeValueException,
                         javax.management.MBeanException,
                         java.io.IOException,
                         javax.management.ReflectionException
Sets the specified attribute.

Parameters:
attributeDescriptor - the attribute to set.
data - the data to set.
Throws:
javax.management.OperationsException
javax.management.AttributeNotFoundException
javax.management.InvalidAttributeValueException
javax.management.MBeanException
java.io.IOException
javax.management.ReflectionException

getRemoteStartTime

long getRemoteStartTime()
Returns the time that the monitored JRockit was started, in server time.

Returns:
the time that the monitored JRockit was started, in server time.

addMBeanServerChangeListener

void addMBeanServerChangeListener(IMBeanServerChangeListener listener)
Adds a listener which will be executed when the MBean configuration in the MBean server changes.

Parameters:
listener - the listener add. Should complete quickly.

removeMBeanServerChangeListener

void removeMBeanServerChangeListener(IMBeanServerChangeListener listener)
Removes any listener that was added by addMBeanServerChangeListener(IMBeanServerChangeListener). If no listener has been added nothing happens.

Parameters:
listener - the listener to remove


Copyright © 1999, 2011, Oracle and/or its affiliates. All rights reserved.