Jvmstat

sun.jvmstat.perfdata.monitor
Class AbstractPerfDataBuffer

java.lang.Object
  extended by sun.jvmstat.perfdata.monitor.AbstractPerfDataBuffer
Direct Known Subclasses:
PerfDataBuffer, PerfDataBuffer, PerfDataBuffer

public abstract class AbstractPerfDataBuffer
extends Object

Abstraction for the HotSpot PerfData instrumentation buffer. This class is responsible for acquiring access to the instrumentation buffer for a target HotSpot Java Virtual Machine and providing method level access to its contents.

Since:
1.5

Field Summary
protected  PerfDataBufferImpl impl
          Reference to the concrete instance created by the createPerfDataBuffer(java.nio.ByteBuffer, int) method.
 
Constructor Summary
AbstractPerfDataBuffer()
           
 
Method Summary
protected  void createPerfDataBuffer(ByteBuffer bb, int lvmid)
          Create the perfdata instrumentation buffer for the given lvmid using the given ByteBuffer object as the source of the instrumentation data.
 Monitor findByName(String name)
          Find a named Instrumentation object.
 List findByPattern(String patternString)
          Find all Instrumentation objects with names matching the given pattern.
 ByteBuffer getByteBuffer()
          Get the ByteBuffer containing the instrumentation data.
 byte[] getBytes()
          Get a copy of the raw instrumentation data.
 int getCapacity()
          Get the capacity of the instrumentation buffer.
 int getLocalVmId()
          Get the Local Java Virtual Machine Identifier, or lvmid for the target JVM associated with this instrumentation buffer.
 MonitorStatus getMonitorStatus()
          Get a list of the inserted and removed monitors since last called.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

impl

protected PerfDataBufferImpl impl
Reference to the concrete instance created by the createPerfDataBuffer(java.nio.ByteBuffer, int) method.

Constructor Detail

AbstractPerfDataBuffer

public AbstractPerfDataBuffer()
Method Detail

getLocalVmId

public int getLocalVmId()
Get the Local Java Virtual Machine Identifier, or lvmid for the target JVM associated with this instrumentation buffer.

Returns:
int - the lvmid

getBytes

public byte[] getBytes()
Get a copy of the raw instrumentation data. This method is used to get a copy of the current bytes in the instrumentation buffer. It is generally used for transporting those bytes over the network.

Returns:
byte[] - a copy of the bytes in the instrumentation buffer.

getCapacity

public int getCapacity()
Get the capacity of the instrumentation buffer.

Returns:
int - the capacity, or size, of the instrumentation buffer.

findByName

public Monitor findByName(String name)
                   throws MonitorException
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.

findByPattern

public List findByPattern(String patternString)
                   throws MonitorException
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:
Pattern

getMonitorStatus

public MonitorStatus getMonitorStatus()
                               throws MonitorException
Get a list of the inserted and removed monitors since last called.

Returns:
MonitorStatus - the status of available Monitors for the target Java Virtual Machine.
Throws:
MonitorException - Thrown if communications errors occur while communicating with the target.

getByteBuffer

public ByteBuffer getByteBuffer()
Get the ByteBuffer containing the instrumentation data.

Returns:
ByteBuffer - a ByteBuffer object that refers to the instrumentation data.

createPerfDataBuffer

protected void createPerfDataBuffer(ByteBuffer bb,
                                    int lvmid)
                             throws MonitorException
Create the perfdata instrumentation buffer for the given lvmid using the given ByteBuffer object as the source of the instrumentation data. This method parses the instrumentation buffer header to determine key characteristics of the instrumentation buffer and then dynamically loads the appropriate class to handle the particular instrumentation version.

Parameters:
bb - the ByteBuffer that references the instrumentation data.
lvmid - the Local Java Virtual Machine identifier for this instrumentation buffer.
Throws:
MonitorException

Jvmstat