public abstract class

MonitoredHost

extends Object
java.lang.Object
   ↳ sun.jvmstat.monitor.MonitoredHost
Known Direct Subclasses

Class Overview

An abstraction for a host that contains instrumented Java Virtual Machines. The class provides abstract factory methods for creating concrete instances of this class and factory methods for creating MonitoredVm instances. Concrete implementations of this class provide methods for managing the communications protocols and provide for event notification.

Summary

Fields
protected HostIdentifier hostId The HostIdentifier for this MonitoredHost instance.
protected int interval The polling interval, in milliseconds, for this MonitoredHost instance.
protected Exception lastException The last Exception encountered while polling this MonitoredHost.
Public Constructors
MonitoredHost()
Public Methods
abstract Set<Integer> activeVms()
Return the current set of active Java Virtual Machines for this MonitoredHost.
abstract void addHostListener(HostListener listener)
Add a HostListener.
void clearLastException()
Clear the last exception.
abstract void detach(MonitoredVm vm)
Detach from the indicated MonitoredVm.
HostIdentifier getHostIdentifier()
Return the resolved HostIdentifier for this MonitoredHost.
int getInterval()
Get the polling interval.
Exception getLastException()
Get the last exception encountered while polling this MonitoredHost.
static MonitoredHost getMonitoredHost(HostIdentifier hostId)
Factory method to construct a MonitoredHost instance to manage the connection to the host indicated by hostId.
static MonitoredHost getMonitoredHost(String hostIdString)
Factory method to construct MonitoredHost instances to manage connections to the host indicated by hostIdString
static MonitoredHost getMonitoredHost(VmIdentifier vmid)
Factory method to construct a MonitoredHost instance to manage the connection to the Java Virtual Machine indicated by vmid.
abstract MonitoredVm getMonitoredVm(VmIdentifier id, int interval)
Get the MonitoredVm for the given Java Virtual Machine.
abstract MonitoredVm getMonitoredVm(VmIdentifier id)
Get the MonitoredVm for the given Java Virtual Machine.
boolean isErrored()
Test if this MonitoredHost is in the errored state.
abstract void removeHostListener(HostListener listener)
Remove a HostListener.
void setInterval(int interval)
Set the polling interval for this MonitoredHost.
void setLastException(Exception lastException)
Set the last exception encountered while polling this MonitoredHost.
Protected Methods
static HostIdentifier resolveHostId(HostIdentifier hostId)
Method to resolve unspecified components of the given HostIdentifier by constructing a new HostIdentifier that replaces the unspecified components with the default values.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

protected HostIdentifier hostId

The HostIdentifier for this MonitoredHost instance.

protected int interval

The polling interval, in milliseconds, for this MonitoredHost instance.

protected Exception lastException

The last Exception encountered while polling this MonitoredHost.

Public Constructors

public MonitoredHost ()

Public Methods

public abstract Set<Integer> activeVms ()

Return the current set of active Java Virtual Machines for this MonitoredHost. The returned Set contains Integer instances holding the local virtual machine identifier, or lvmid for each instrumented Java Virtual Machine currently available.

Returns
  • Set - the current set of active Java Virtual Machines associated with this MonitoredHost, or the empty set of none.
Throws
MonitorException Thrown if monitoring errors occur.

public abstract void addHostListener (HostListener listener)

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

Parameters
listener the HostListener to add.
Throws
MonitorException Thrown if monitoring errors occur.

public void clearLastException ()

Clear the last exception.

public abstract void detach (MonitoredVm vm)

Detach from the indicated MonitoredVm.

Parameters
vm the monitored Java Virtual Machine.
Throws
MonitorException Thrown if monitoring errors occur.

public HostIdentifier getHostIdentifier ()

Return the resolved HostIdentifier for this MonitoredHost.

Returns
  • HostIdentifier - the resolved HostIdentifier.

public int getInterval ()

Get the polling interval.

Returns
  • int - the polling interval in milliseconds for this MonitoredHost

public Exception getLastException ()

Get the last exception encountered while polling this MonitoredHost.

Returns
  • Exception - the last exception occurred while polling this MonitoredHost, or null if no exception has occurred or the exception has been cleared,

public static MonitoredHost getMonitoredHost (HostIdentifier hostId)

Factory method to construct a MonitoredHost instance to manage the connection to the host indicated by hostId.

Parameters
hostId the identifier for the target host.
Returns
  • MonitoredHost - The MonitoredHost object needed to attach to the target host.
Throws
MonitorException Thrown if monitoring errors occur.

public static MonitoredHost getMonitoredHost (String hostIdString)

Factory method to construct MonitoredHost instances to manage connections to the host indicated by hostIdString

Parameters
hostIdString a String representation of a HostIdentifier
Returns
  • MonitoredHost - the MonitoredHost instance for communicating with the indicated host using the protocol specified in hostIdString.
Throws
MonitorException Thrown if monitoring errors occur.
URISyntaxException Thrown when the hostIdString is poorly formed. This exception may get encapsulated into MonitorException in a future revision.

public static MonitoredHost getMonitoredHost (VmIdentifier vmid)

Factory method to construct a MonitoredHost instance to manage the connection to the Java Virtual Machine indicated by vmid. This method provide a convenient short cut for attaching to a specific instrumented Java Virtual Machine. The information in the VmIdentifier is used to construct a corresponding HostIdentifier, which in turn is used to create the MonitoredHost instance.

Parameters
vmid The identifier for the target Java Virtual Machine.
Returns
  • MonitoredHost - The MonitoredHost object needed to attach to the target Java Virtual Machine.
Throws
MonitorException Thrown if monitoring errors occur.

public abstract MonitoredVm getMonitoredVm (VmIdentifier id, int interval)

Get the MonitoredVm for the given Java Virtual Machine. The sampling interval is set to the given interval.

Parameters
id the VmIdentifier specifying the target Java Virtual Machine.
interval the sampling interval for the target Java Virtual Machine.
Returns
  • MonitoredVm - the MonitoredVm instance for the target Java Virtual Machine.
Throws
MonitorException Thrown if monitoring errors occur.

public abstract MonitoredVm getMonitoredVm (VmIdentifier id)

Get the MonitoredVm for the given Java Virtual Machine. The default sampling interval is used for the MonitoredVm instance.

Parameters
id the VmIdentifier specifying the target Java Virtual Machine.
Returns
  • MonitoredVm - the MonitoredVm instance for the target Java Virtual Machine.
Throws
MonitorException Thrown if monitoring errors occur.

public boolean isErrored ()

Test if this MonitoredHost is in the errored state. If this method returns true, then the Exception returned by getLastException() indicates the Exception that caused the error condition.

Returns
  • boolean - true if the MonitoredHost instance has experienced an error, or false if it hasn't or if any past error has been cleared.

public abstract void removeHostListener (HostListener listener)

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

Parameters
listener the HostListener to add.
Throws
MonitorException Thrown if monitoring errors occur.

public void setInterval (int interval)

Set the polling interval for this MonitoredHost.

Parameters
interval the polling interval, in milliseconds

public void setLastException (Exception lastException)

Set the last exception encountered while polling this MonitoredHost.

Parameters
lastException the last exception encountered;

Protected Methods

protected static HostIdentifier resolveHostId (HostIdentifier hostId)

Method to resolve unspecified components of the given HostIdentifier by constructing a new HostIdentifier that replaces the unspecified components with the default values.

Parameters
hostId the unresolved HostIdentifier.
Returns
  • HostIdentifier - a resolved HostIdentifier.
Throws
MonitorException Thrown if monitoring errors occur.