com.jrockit.memleak.comm
Class RemoteMLSController

java.lang.Object
  extended by com.jrockit.memleak.comm.RemoteMLSController

public class RemoteMLSController
extends java.lang.Object

Helper class for obtaining a controller that can start and stop the MemLeakServer remotely.

Author:
Marcus Hirt, Markus Persson

Nested Class Summary
static class RemoteMLSController.ProtocolDescriptor
          Description of a protocol that can be used to control the Memory Leak Server.
 
Constructor Summary
RemoteMLSController()
           
 
Method Summary
static IMemLeak connectTo(java.lang.String serverName, int port, java.lang.String username, java.lang.String password, int preferredMLSPort)
          Attempt to connect to a JRockit using the first available protocol.
static java.util.Iterator<RemoteMLSController.ProtocolDescriptor> getAllDescriptors()
           
static RemoteMLSController.ProtocolDescriptor getAvailableDescriptor(java.lang.String preferredProtocol)
          Returns the descriptor for the given descriptor, or if it is unavailable, for the default protocol.
static Controller getController(java.lang.String protocol, java.lang.String serverName, int port, java.lang.String username, java.lang.String password)
          If port is 0, each protocol tried will use its own default port.
static java.lang.String getDefaultProtocol()
          Returns the default protocol.
static RemoteMLSController.ProtocolDescriptor getDescriptor(java.lang.String protocol)
          Returns the descriptor for the given descriptor, without checking if it is available.
static void main(java.lang.String[] args)
          Main method for controlling MLS remotely from commandline.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteMLSController

public RemoteMLSController()
Method Detail

main

public static void main(java.lang.String[] args)
Main method for controlling MLS remotely from commandline.

Parameters:
args -

getDescriptor

public static RemoteMLSController.ProtocolDescriptor getDescriptor(java.lang.String protocol)
Returns the descriptor for the given descriptor, without checking if it is available. Returns null if there is no such protocol.

Parameters:
protocol - the protocol identifier
Returns:
a protocol descriptor or null

getDefaultProtocol

public static java.lang.String getDefaultProtocol()
Returns the default protocol. If no protocols at all are available, null is returned.

Returns:
The default protocol or null if none are available.

getAvailableDescriptor

public static RemoteMLSController.ProtocolDescriptor getAvailableDescriptor(java.lang.String preferredProtocol)
Returns the descriptor for the given descriptor, or if it is unavailable, for the default protocol. If no protocols at all are available, null is returned.

Parameters:
preferredProtocol - the protocol identifier of the preferred protocol
Returns:
an available protocol descriptor or null.

getAllDescriptors

public static java.util.Iterator<RemoteMLSController.ProtocolDescriptor> getAllDescriptors()
Returns:
an iterator over all protocol descriptors

getController

public static Controller getController(java.lang.String protocol,
                                       java.lang.String serverName,
                                       int port,
                                       java.lang.String username,
                                       java.lang.String password)
                                throws MemLeakControllerException
If port is 0, each protocol tried will use its own default port.

Parameters:
protocol - the protocol identifier of the preferred protocol
serverName -
port -
username -
password -
Returns:
a controller for protocol or the first fallback protocol available
Throws:
MemLeakControllerException - if no protocol at all was available

connectTo

public static IMemLeak connectTo(java.lang.String serverName,
                                 int port,
                                 java.lang.String username,
                                 java.lang.String password,
                                 int preferredMLSPort)
                          throws java.io.IOException
Attempt to connect to a JRockit using the first available protocol.

Parameters:
serverName -
port -
username -
password -
preferredMLSPort -
Returns:
a connected MemLeak instance
Throws:
java.io.IOException


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