public interface

MonitoredVm

sun.jvmstat.monitor.MonitoredVm
Known Indirect Subclasses

Class Overview

Interface for interacting with a monitorable Java Virtual Machine. The MonitoredVm interface provides methods for discovery of exported instrumentation, for attaching event listeners, and for overall maintenance of the connection to the target.

Summary

Public Methods
abstract void addVmListener(VmListener listener)
Add a VmListener.
abstract void clearLastException()
Clear the last exception.
abstract void detach()
Detach from target Java Virtual Machine.
abstract Monitor findByName(String name)
Find a named Instrumentation object.
abstract List<Monitor> findByPattern(String patternString)
Find all Instrumentation objects with names matching the given pattern.
abstract int getInterval()
Get the polling interval.
abstract Exception getLastException()
Get the last exception encountered while polling this MonitoredVm.
abstract VmIdentifier getVmIdentifier()
Get the VmIdentifier associated with this MonitoredVm
abstract boolean isErrored()
Test if this MonitoredVm is in the errored state.
abstract void removeVmListener(VmListener listener)
Remove a VmListener.
abstract void setInterval(int interval)
Set the polling interval to interval milliseconds.
abstract void setLastException(Exception cause)
Set the last exception encountered while polling this MonitoredVm.

Public Methods

public abstract void addVmListener (VmListener listener)

Add a VmListener. The given listener is added to the list of VmListener objects to be notified of MonitoredVm related events.

Parameters
listener the VmListener to add.
Throws
MonitorException Thrown if any problems occur while attempting to add this listener.

public abstract void clearLastException ()

Clear the last exception. Calling this method will clear the errored state of this MonitoredVm. However, there is no guarantee that clearing the the errored state return the asynchronous polling task to an operational state.

public abstract void detach ()

Detach from target Java Virtual Machine. After calling this method, updates of the instrumentation data values may be halted. All event notifications are halted. Further interactions with this object should be avoided.

public abstract Monitor findByName (String name)

Find a named Instrumentation object. This method will look for the named instrumentation object in the instrumentation exported by this Java Virtual Machine. If an instrumentation object with the given name exists, a Monitor interface to that object will be return. Otherwise, the method returns null.

Parameters
name the name of the Instrumentation object to find.
Returns
  • Monitor - the Monitor object that can be used to monitor the the named instrumentation object, or null if the named object doesn't exist.
Throws
MonitorException Thrown if an error occurs while communicating with the target Java Virtual Machine.

public abstract List<Monitor> findByPattern (String patternString)

Find all Instrumentation objects with names matching the given pattern. This method returns a List of Monitor objects such that the name of each object matches the given pattern.

Parameters
patternString a string containing a pattern as described in Pattern.
Returns
  • List - a List of Monitor objects that can be used to monitor the instrumentation objects whose names match the given pattern. If no instrumentation objects have` names matching the given pattern, then an empty List is returned.
Throws
MonitorException Thrown if an error occurs while communicating with the target Java Virtual Machine.
See Also

public abstract int getInterval ()

Get the polling interval.

Returns
  • int - the current polling interval in milliseconds.
See Also

public abstract Exception getLastException ()

Get the last exception encountered while polling this MonitoredVm. Returns the last exception observed by the implementation dependent polling task or null if no such error has occurred.

Returns
  • Exception - the last exception that occurred during polling or null if no error condition exists.

public abstract VmIdentifier getVmIdentifier ()

Get the VmIdentifier associated with this MonitoredVm

Returns
  • VmIdentifier - the fully resolved Vm identifier associated with this MonitoredVm.

public abstract boolean isErrored ()

Test if this MonitoredVm is in the errored state. The errored state exists only if an error was reported with call to setLastException(Exception) and only if the parameter to that call was non-null and no subsequent calls are made to clearLastException().

Returns
  • boolean - true if the instance has a non-null error condition set, false otherwise.

public abstract void removeVmListener (VmListener listener)

Remove a VmListener. The given listener is removed from the list of VmListener objects to be notified of MonitoredVm related events.

Parameters
listener the VmListener to be removed.
Throws
MonitorException Thrown if any problems occur while attempting to remove this listener.

public abstract void setInterval (int interval)

Set the polling interval to interval milliseconds. Polling based monitoring implementations need to refresh the instrumentation data on a periodic basis. This interface allows the interval to override the implementation specific default interval.

Parameters
interval the polling interval in milliseconds

public abstract void setLastException (Exception cause)

Set the last exception encountered while polling this MonitoredVm. Polling implementations may choose to poll asynchronously. This method allows an asynchronous task to communicate any polling related exceptions with the application. When an a non-null exception is reported through this interface, the MonitoredVm instance is considered to be in the errored state.

Parameters
cause the exception to record.
See Also