jrockit.management
Interface JRockitConsoleMXBean


public interface JRockitConsoleMXBean

Interface for functionality very specific to the JRockit Management Console. Here things like starting a JRA recording should live. This one contains our own defined composite MXBean types, and can only be used if both the server and the client is a JRockit. This interface is bound to change in the future and should be viewed as experimental.

Author:
Marcus Hirt

Field Summary
static java.lang.String NOTIFICATION_GARBAGE_COLLECTION
           
static java.lang.String NOTIFICATION_GARBAGE_COLLECTION_STRATEGY_CHANGED
           
 
Method Summary
 void closeJRARecording()
          Close the current JRA recording.
 javax.management.openmbean.CompositeData getCPUDescriptions()
           
 javax.management.openmbean.CompositeData getCPULoads()
          Returns the CPU load for all CPU:s on a machine.
 long getCurrentTime()
          Returns the current system time
 MarkAndSweepStrategy getGarbageCollectionStrategy()
          The strategy shows the currently used garbage collection strategy employed to meet the goals defined by the heuristic.
 int getMLSPort()
          Check if the server is started, will return 0 if not started, otherwise returns the port it is listening to
 int[] getMLSVersions()
          Returns an array containing the protocol versions supported in the available implementation of the memory leak server.
 boolean isThrowable(java.lang.String className)
          Returns true if the first class retrieved from the class library with this name is a throwable.
 byte[] readJRARecording()
          Reads a block of bytes from a finished JRA recording.
 void runCtrlBreakHandler(java.lang.String breakHandler)
          Runs the ctrlbreak handler.
 java.lang.String runCtrlBreakHandlerWithResult(java.lang.String breakHandler)
          Runs the CtrlBreak handler and returns the result as a String.
 void setGarbageCollectionStrategy(MarkAndSweepStrategy strategy)
          Sets the garbage collection strategy to use.
 void shutDownMLS()
          Shutdown the memleak server.
 boolean startJRARecording(int recordingTime, boolean useNativeSamples, boolean useMethodSampling, boolean useGCSampling)
          Starts a JRA recording.
 boolean startJRARecording(int recordingTime, java.lang.String filename, boolean useNativeSamples, boolean useMethodSampling, boolean useGCSampling)
          Starts a JRA recording.
 int startMLS(int version, int port)
          Starts the memory leak server.
 boolean stopJRARecording()
          Stops the JRA recording.
 

Field Detail

NOTIFICATION_GARBAGE_COLLECTION_STRATEGY_CHANGED

static final java.lang.String NOTIFICATION_GARBAGE_COLLECTION_STRATEGY_CHANGED
See Also:
Constant Field Values

NOTIFICATION_GARBAGE_COLLECTION

static final java.lang.String NOTIFICATION_GARBAGE_COLLECTION
See Also:
Constant Field Values
Method Detail

getCurrentTime

long getCurrentTime()
Returns the current system time

Returns:
the time.

isThrowable

boolean isThrowable(java.lang.String className)
Returns true if the first class retrieved from the class library with this name is a throwable.

Parameters:
className - name
Returns:
true if the first class found with the specified name is a subclass of throwable. false if it is not a subclass of Throwable, or if a class with the specified className could not be found.

startJRARecording

boolean startJRARecording(int recordingTime,
                          boolean useNativeSamples,
                          boolean useMethodSampling,
                          boolean useGCSampling)
                          throws java.io.IOException,
                                 java.lang.Exception
Starts a JRA recording. The result is stored in a temporary file created using java.io.File.createTempFile(java.lang.String, java.lang.String, java.io.File) using "jrockit" as the prefix and ".jra" as the suffix. The file can later be accessed using the method readJRARecording(). Returns true if it was successfully started.

Parameters:
recordingTime - sample time in seconds
useNativeSamples - true if native sampling should be used
useMethodSampling - true if method sampling should be used
useGCSampling - true if GC sampling should be used
Returns:
true if it was successfully started.
Throws:
java.io.IOException - if no temporary file could be opened
java.lang.SecurityException - if you haven't got the ManagementPermission monitor.
java.lang.Exception - if some other problem happend when starting, such as license issues, out of memory, and so on

readJRARecording

byte[] readJRARecording()
                        throws java.io.IOException
Reads a block of bytes from a finished JRA recording. If this method is called during an ongoing recording, that recording will be stopped.

Returns:
The bytes that where read or null if end of file was reached.
Throws:
java.io.IOException - if something went wrong when attempting to read the file.

closeJRARecording

void closeJRARecording()
                       throws java.io.IOException
Close the current JRA recording. If a recording is active, it will be stopped and its output discarded. Normally, this method is called when all bytes have been read using readJRARecording()

Throws:
java.io.IOException

startJRARecording

boolean startJRARecording(int recordingTime,
                          java.lang.String filename,
                          boolean useNativeSamples,
                          boolean useMethodSampling,
                          boolean useGCSampling)
                          throws java.lang.Exception
Starts a JRA recording. Returns true if it was successfully started, false otherwise. The supplied filename denotes a file on the server. The recording completes after the alloted time or when prematurely terminated by a call to stopJRARecording(). The only way to access this recording is by using the created file. You cannot read the result with readJRARecording().

Parameters:
recordingTime - sample time in seconds
filename - A file name, on the server, of recording dump
useNativeSamples - true if native sampling should be used
useMethodSampling - true if method sampling should be used
useGCSampling - true if GC sampling should be used
Throws:
java.lang.SecurityException - if you haven't got the ManagementPermission monitor.
java.lang.Exception - if some other problem happend when starting, such as license issues, out of memory, and so on

stopJRARecording

boolean stopJRARecording()
Stops the JRA recording. The recording file should still be valid. Returns true if successful, false otherwise.

Throws:
java.lang.SecurityException - if you haven't got the ManagementPermission monitor.

runCtrlBreakHandler

void runCtrlBreakHandler(java.lang.String breakHandler)
Runs the ctrlbreak handler.

Parameters:
breakHandler - the commands to run in ctrlhandler.act syntax. If null or empty, the local ctrlhandler.act file will be used.
Throws:
java.lang.SecurityException - if you haven't got the ManagementPermission control.

runCtrlBreakHandlerWithResult

java.lang.String runCtrlBreakHandlerWithResult(java.lang.String breakHandler)
Runs the CtrlBreak handler and returns the result as a String.

Parameters:
breakHandler - the commands to run in ctrlhandler.act syntax. If null or empty, the local ctrlhandler.act file will be used.
Returns:
the text resulting from running the CtrlBreakHandler (what would normally be written to file).
Throws:
java.lang.SecurityException - if you haven't got the ManagementPermission control.

startMLS

int startMLS(int version,
             int port)
             throws java.lang.IllegalAccessException,
                    java.lang.Exception
Starts the memory leak server.

Parameters:
version - the version of the protocol to use.
port - the port the server should listen to, or 0 to let the OS choose
Returns:
the port that we are actually listening to.
Throws:
java.lang.SecurityException - if you haven't got the ManagementPermission control.
java.lang.IllegalAccessException - if a license related error happened.
java.lang.Exception

getMLSVersions

int[] getMLSVersions()
Returns an array containing the protocol versions supported in the available implementation of the memory leak server.

Returns:
an array of the supported protocol versions

shutDownMLS

void shutDownMLS()
Shutdown the memleak server.

Throws:
java.lang.SecurityException - if you haven't got the ManagementPermission control.

getMLSPort

int getMLSPort()
Check if the server is started, will return 0 if not started, otherwise returns the port it is listening to

Throws:
java.lang.SecurityException - if you haven't got the ManagementPermission control.

getGarbageCollectionStrategy

MarkAndSweepStrategy getGarbageCollectionStrategy()
                                                  throws java.lang.UnsupportedOperationException
The strategy shows the currently used garbage collection strategy employed to meet the goals defined by the heuristic. This method exist to support the experimental writable GarbageCollectionStrategy attribute.

Returns:
the strategy being employed, or null if the currently used memory manager for the JavaHeap is not a MarkAndSweep collector.
Throws:
java.lang.UnsupportedOperationException - if JRockit isn't running a MarkAndSweep collector.

setGarbageCollectionStrategy

void setGarbageCollectionStrategy(MarkAndSweepStrategy strategy)
                                  throws java.lang.UnsupportedOperationException
Sets the garbage collection strategy to use. No guarantees are made as of when the switch will take place, if ever.

Parameters:
strategy - the GarbageCollectionStrategy to use. Will be ignored if the currently used memory manager for the JavaHeap is not a MarkAndSweep collector.
Throws:
java.lang.SecurityException - if you haven't got the ManagementPermission control.
java.lang.UnsupportedOperationException - if JRockit isn't running with a MarkAndSweep collector.

getCPULoads

javax.management.openmbean.CompositeData getCPULoads()
Returns the CPU load for all CPU:s on a machine. The CPU load is a value between 0.0, which means no load, and 100% which denotes a fully saturated CPU. The data is returned as a CompositeData with key "CPU1" is asscoiated with load of the first CPU, key "CPU2" the second CPU and so on.

Throws:
NotAvailableException - if this functionality isn't available in this JVM.

getCPUDescriptions

javax.management.openmbean.CompositeData getCPUDescriptions()


Copyright © 2004-2005 BEA Systems Inc.