com.sun.jmx.remote.opt.util
Class EnvHelp

java.lang.Object
  extended by com.sun.jmx.remote.opt.util.EnvHelp

public class EnvHelp
extends Object


Field Summary
static String BUFFER_SIZE_PROPERTY
          Name of the attribute that specifies the size of a notification buffer for a connector server.
static String CLIENT_CONNECTION_CHECK_PERIOD
          Name of the attribute that specifies the period in millisecond for a client to check its connection.
static String DEFAULT_HIDDEN_ATTRIBUTES
          Default list of attributes not to show.
static String DEFAULT_ORB
           
static String FETCH_TIMEOUT
          Name of the attribute that specifies the timeout for a client to fetch notifications from its server.
static String HIDDEN_ATTRIBUTES
          The value of this attribute, if present, is a string specifying what other attributes should not appear in JMXConnectorServer.getAttributes().
static String MAX_FETCH_NOTIFS
          Name of the attribute that specifies the maximum number of notifications that a client will fetch from its server..
static String SERVER_CONNECTION_TIMEOUT
          Name of the attribute that specifies the timeout to keep a server side connection after answering last client request.
 
Constructor Summary
EnvHelp()
           
 
Method Summary
static void checkAttributes(Map attributes)
           
static Map filterAttributes(Map attributes)
           
static Throwable getCause(Throwable t)
          Returns the cause field of a Throwable object.
static long getConnectionCheckPeriod(Map env)
          Returns the client connection check oeriod.
static long getFetchTimeout(Map env)
          Returns the timeout for a client to fetch notifications.
static long getIntegerAttribute(Map env, String name, long defaultValue, long minValue, long maxValue)
          Get an integer-valued attribute with name name from env.
static int getMaxFetchNotifNumber(Map env)
          Returns the maximum notification number which a client will fetch every time.
static int getNotifBufferSize(Map env)
          Returns the size of a notification buffer for a connector server.
static long getServerConnectionTimeout(Map env)
          Returns the server side connection timeout.
static Throwable initCause(Throwable t, Throwable cause)
          Init the cause field of a Throwable object.
static Hashtable mapToHashtable(Map map)
          Converts a map into a valid hash table, i.e.
static ClassLoader resolveClientClassLoader(Map env)
          Get the Connector Client default class loader.
static ClassLoader resolveServerClassLoader(Map env, MBeanServer mbs)
          Get the Connector Server default class loader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUFFER_SIZE_PROPERTY

public static final String BUFFER_SIZE_PROPERTY

Name of the attribute that specifies the size of a notification buffer for a connector server. The default value is 1000.

See Also:
Constant Field Values

MAX_FETCH_NOTIFS

public static final String MAX_FETCH_NOTIFS

Name of the attribute that specifies the maximum number of notifications that a client will fetch from its server.. The value associated with this attribute should be an Integer object. The default value is 1000.

See Also:
Constant Field Values

FETCH_TIMEOUT

public static final String FETCH_TIMEOUT

Name of the attribute that specifies the timeout for a client to fetch notifications from its server. The value associated with this attribute should be a Long object. The default value is 60000 milleseconds.

See Also:
Constant Field Values

DEFAULT_ORB

public static final String DEFAULT_ORB
See Also:
Constant Field Values

HIDDEN_ATTRIBUTES

public static final String HIDDEN_ATTRIBUTES
The value of this attribute, if present, is a string specifying what other attributes should not appear in JMXConnectorServer.getAttributes(). It is a space-separated list of attribute patterns, where each pattern is either an attribute name, or an attribute prefix followed by a "*" character. The "*" has no special significance anywhere except at the end of a pattern. By default, this list is added to the list defined by DEFAULT_HIDDEN_ATTRIBUTES (which uses the same format). If the value of this attribute begins with an "=", then the remainder of the string defines the complete list of attribute patterns.

See Also:
Constant Field Values

DEFAULT_HIDDEN_ATTRIBUTES

public static final String DEFAULT_HIDDEN_ATTRIBUTES
Default list of attributes not to show.

See Also:
HIDDEN_ATTRIBUTES, Constant Field Values

SERVER_CONNECTION_TIMEOUT

public static final String SERVER_CONNECTION_TIMEOUT

Name of the attribute that specifies the timeout to keep a server side connection after answering last client request. The default value is 120000 milliseconds.

See Also:
Constant Field Values

CLIENT_CONNECTION_CHECK_PERIOD

public static final String CLIENT_CONNECTION_CHECK_PERIOD

Name of the attribute that specifies the period in millisecond for a client to check its connection. The default value is 60000 milliseconds.

See Also:
Constant Field Values
Constructor Detail

EnvHelp

public EnvHelp()
Method Detail

resolveServerClassLoader

public static ClassLoader resolveServerClassLoader(Map env,
                                                   MBeanServer mbs)
                                            throws InstanceNotFoundException
Get the Connector Server default class loader.

Returns:

Parameters:
env - Environment attributes.
mbs - The MBeanServer for which the connector server provides remote access.
Returns:
the connector server's default class loader.
Throws:
IllegalArgumentException - if one of the following is true:
  • both jmx.remote.default.class.loader and jmx.remote.default.class.loader.name are specified,
  • or jmx.remote.default.class.loader is not an instance of ClassLoader,
  • or jmx.remote.default.class.loader.name is not an instance of ObjectName,
  • or jmx.remote.default.class.loader.name is specified but mbs is null.
  • InstanceNotFoundException - if jmx.remote.default.class.loader.name is specified and the ClassLoader MBean is not found in mbs.

resolveClientClassLoader

public static ClassLoader resolveClientClassLoader(Map env)
Get the Connector Client default class loader.

Returns:

Usually a Connector Client will call

 ClassLoader dcl = EnvHelp.resolveClientClassLoader(env);
 
in its connect(Map env) method.

Returns:
The connector client default class loader.
Throws:
IllegalArgumentException - if jmx.remote.default.class.loader is specified and is not an instance of ClassLoader.

initCause

public static Throwable initCause(Throwable t,
                                  Throwable cause)
Init the cause field of a Throwable object. The cause field is set only if t has an Throwable.initCause(Throwable) method (JDK Version >= 1.4)

Parameters:
t - Throwable on which the cause must be set.
cause - The cause to set on t.
Returns:
t with or without the cause field set.

getCause

public static Throwable getCause(Throwable t)
Returns the cause field of a Throwable object. The cause field can be got only if t has an Throwable.getCause() method (JDK Version >= 1.4)

Parameters:
t - Throwable on which the cause must be set.
Returns:
the cause if getCause() succeeded and the got value is not null, otherwise return the t.

getNotifBufferSize

public static int getNotifBufferSize(Map env)
Returns the size of a notification buffer for a connector server. The default value is 1000.


getMaxFetchNotifNumber

public static int getMaxFetchNotifNumber(Map env)
Returns the maximum notification number which a client will fetch every time.


getFetchTimeout

public static long getFetchTimeout(Map env)
Returns the timeout for a client to fetch notifications.


getIntegerAttribute

public static long getIntegerAttribute(Map env,
                                       String name,
                                       long defaultValue,
                                       long minValue,
                                       long maxValue)
Get an integer-valued attribute with name name from env. If env is null, or does not contain an entry for name, return defaultValue. The value may be a Number, or it may be a String that is parsable as a long. It must be at least minValue and at mostmaxValue.

Throws:
IllegalArgumentException - if env contains an entry for name but it does not meet the constraints above.

checkAttributes

public static void checkAttributes(Map attributes)

filterAttributes

public static Map filterAttributes(Map attributes)

getServerConnectionTimeout

public static long getServerConnectionTimeout(Map env)
Returns the server side connection timeout.


getConnectionCheckPeriod

public static long getConnectionCheckPeriod(Map env)
Returns the client connection check oeriod.


mapToHashtable

public static Hashtable mapToHashtable(Map map)
Converts a map into a valid hash table, i.e. it removes all the 'null' values from the map.



Copyright © 2014 Terracotta, Inc.. All rights reserved.