feat(jdk8): move files to new folder to avoid resources compiled.
This commit is contained in:
144
jdkSrc/jdk8/com/sun/org/glassfish/external/amx/AMX.java
vendored
Normal file
144
jdkSrc/jdk8/com/sun/org/glassfish/external/amx/AMX.java
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.amx;
|
||||
|
||||
/**
|
||||
Constants reflecting the AMX specification.
|
||||
See https://glassfish.dev.java.net/nonav/v3/admin/planning/V3Changes/V3_AMX_SPI.html
|
||||
*/
|
||||
public final class AMX
|
||||
{
|
||||
private AMX()
|
||||
{
|
||||
// do not instantiate
|
||||
}
|
||||
|
||||
/** Attribute yielding the ObjectName of the parent MBean */
|
||||
public static final String ATTR_PARENT = "Parent";
|
||||
|
||||
/** Attribute yielding the children as an ObjectName[] */
|
||||
public static final String ATTR_CHILDREN = "Children";
|
||||
|
||||
/** Attribute yielding the name of the MBean,
|
||||
possibly differing from the name as found in the ObjectName via the
|
||||
property {@link #NAME_KEY} */
|
||||
public static final String ATTR_NAME = "Name";
|
||||
|
||||
/** ObjectName property for the type */
|
||||
public static final String TYPE_KEY = "type";
|
||||
|
||||
/** ObjectName property for the name */
|
||||
public static final String NAME_KEY = "name";
|
||||
|
||||
/** Implied name for singletons when the name property is not present */
|
||||
public static final String NO_NAME = "";
|
||||
|
||||
/**
|
||||
The ObjectName property key denoting the path of the parent MBean.
|
||||
Serves to disambiguitate the ObjectName from others
|
||||
that might have the same type and/or name elsewhere in the hierarchy.
|
||||
*/
|
||||
public static final String PARENT_PATH_KEY = "pp";
|
||||
|
||||
/** Prefix for AMX descriptor fields */
|
||||
public static final String DESC_PREFIX = "amx.";
|
||||
|
||||
/** Prefix for AMX notification types */
|
||||
public static final String NOTIFICATION_PREFIX = DESC_PREFIX;
|
||||
|
||||
/**
|
||||
Descriptor value defined by JMX standard: whether the MBeanInfo is *invariant* (immutable is a misnomer).
|
||||
*/
|
||||
public static final String DESC_STD_IMMUTABLE_INFO = "immutableInfo";
|
||||
|
||||
/**
|
||||
Descriptor value defined by JMX standard, the classname of the interface for the MBean.
|
||||
Mainly advisory, since client code might not have access to the class.
|
||||
*/
|
||||
public static final String DESC_STD_INTERFACE_NAME = "interfaceName";
|
||||
|
||||
/**
|
||||
Descriptor value: The generic AMX interface to be used if the class found in {@link #DESC_STD_INTERFACE_NAME}
|
||||
cannot be loaded. The class specified here must reside in the amx-core
|
||||
module eg com.sun.org.glassfish.admin.amx.core eg AMXProxy or AMXConfigProxy.
|
||||
*/
|
||||
public static final String DESC_GENERIC_INTERFACE_NAME = DESC_PREFIX + "genericInterfaceName";
|
||||
|
||||
/**
|
||||
Descriptor value: whether the MBean is a singleton, in spite of having a name property in its ObjectName.
|
||||
This is mainly for compatibility; named singletons are strongly discouraged.
|
||||
*/
|
||||
public static final String DESC_IS_SINGLETON = DESC_PREFIX + "isSingleton";
|
||||
|
||||
/**
|
||||
Descriptor value: whether the MBean is a global singleton eg whether in the AMX domain
|
||||
it can be looked up by its type and is the only MBean of that type.
|
||||
*/
|
||||
public static final String DESC_IS_GLOBAL_SINGLETON = DESC_PREFIX + "isGlobalSingleton";
|
||||
|
||||
/**
|
||||
Descriptor value: Arbitrary string denoting the general classification of MBean.
|
||||
Predefined values include "configuration", "monitoring", "jsr77", "utility", "other".
|
||||
*/
|
||||
public static final String DESC_GROUP = DESC_PREFIX + "group";
|
||||
|
||||
/**
|
||||
Descriptor value: whether new children may be added by code other than the implementation responsible for the MBean;
|
||||
this allows extension points within the hierarchy.
|
||||
Adding a new child means registering an MBean with an ObjectName that implies parentage via the ancestry type=name pairs.
|
||||
*/
|
||||
public static final String DESC_SUPPORTS_ADOPTION = DESC_PREFIX + "supportsAdoption";
|
||||
|
||||
/**
|
||||
Descriptor value: denotes the possible types of MBeans that children might be. If present, SHOULD include all possible and pre-known types.
|
||||
An empty array indicates that child MBeans might exist, but their types cannot be predicted.
|
||||
*/
|
||||
public static final String DESC_SUB_TYPES = DESC_PREFIX + "subTypes";
|
||||
|
||||
/**
|
||||
Group value indicating that the AMX is a configuration MBean.
|
||||
*/
|
||||
public static final String GROUP_CONFIGURATION = "configuration";
|
||||
/**
|
||||
Group value indicating that the AMX represents a monitoring MBean.
|
||||
*/
|
||||
public static final String GROUP_MONITORING = "monitoring";
|
||||
/**
|
||||
Group value indicating that the AMX is a utility MBean.
|
||||
*/
|
||||
public static final String GROUP_UTILITY = "utility";
|
||||
/**
|
||||
Group value indicating that the AMX is a JSR 77 MBean
|
||||
(J2EE Management) .
|
||||
*/
|
||||
public static final String GROUP_JSR77 = "jsr77";
|
||||
/**
|
||||
Group value indicating that the AMX is not one
|
||||
of the other types.
|
||||
*/
|
||||
public static final String GROUP_OTHER = "other";
|
||||
}
|
||||
318
jdkSrc/jdk8/com/sun/org/glassfish/external/amx/AMXGlassfish.java
vendored
Normal file
318
jdkSrc/jdk8/com/sun/org/glassfish/external/amx/AMXGlassfish.java
vendored
Normal file
@@ -0,0 +1,318 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.amx;
|
||||
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.MBeanServer;
|
||||
import javax.management.MBeanServerConnection;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
/**
|
||||
* AMX behavior specific to Glassfish V3.
|
||||
*/
|
||||
public final class AMXGlassfish
|
||||
{
|
||||
public static final String DEFAULT_JMX_DOMAIN = "amx";
|
||||
|
||||
/** Default domain support */
|
||||
public static final AMXGlassfish DEFAULT = new AMXGlassfish(DEFAULT_JMX_DOMAIN);
|
||||
|
||||
private final String mJMXDomain;
|
||||
private final ObjectName mDomainRoot;
|
||||
|
||||
/** Anything other than {@link #DEFAULT} is not supported in Glassfish V3 */
|
||||
public AMXGlassfish(final String jmxDomain)
|
||||
{
|
||||
mJMXDomain = jmxDomain;
|
||||
mDomainRoot = newObjectName("", "domain-root", null);
|
||||
}
|
||||
|
||||
/** Return a version string, or null if not running in Glassfish */
|
||||
public static String getGlassfishVersion()
|
||||
{
|
||||
// must all exist as a check to verify that it's Glassfish V3
|
||||
final String version = System.getProperty( "glassfish.version" );
|
||||
return version;
|
||||
}
|
||||
|
||||
|
||||
/** JMX domain used by AMX MBeans.
|
||||
* <p>
|
||||
* All MBeans in this domain must be AMX-compliant, see http://tinyurl.com/nryoqp =
|
||||
https://glassfish.dev.java.net/nonav/v3/admin/planning/V3Changes/V3_AMX_SPI.html
|
||||
*/
|
||||
public String amxJMXDomain()
|
||||
{
|
||||
return mJMXDomain;
|
||||
}
|
||||
|
||||
/** JMX domain used by AMX support MBeans. Private use only */
|
||||
public String amxSupportDomain()
|
||||
{
|
||||
return amxJMXDomain() + "-support";
|
||||
}
|
||||
|
||||
/** name of the Domain Admin Server (DAS) as found in an ObjectName */
|
||||
public String dasName()
|
||||
{
|
||||
return "server";
|
||||
}
|
||||
|
||||
/** name of the Domain Admin Server (DAS) <config> */
|
||||
public String dasConfig()
|
||||
{
|
||||
return dasName() + "-config";
|
||||
}
|
||||
|
||||
/** return the ObjectName of the AMX DomainRoot MBean */
|
||||
public ObjectName domainRoot()
|
||||
{
|
||||
return mDomainRoot;
|
||||
}
|
||||
|
||||
/** ObjectName for top-level monitoring MBean (parent of those for each server) */
|
||||
public ObjectName monitoringRoot()
|
||||
{
|
||||
return newObjectName("/", "mon", null);
|
||||
}
|
||||
|
||||
/** ObjectName for top-level monitoring MBean for specified server */
|
||||
public ObjectName serverMon(final String serverName)
|
||||
{
|
||||
return newObjectName("/mon", "server-mon", serverName);
|
||||
}
|
||||
|
||||
/** ObjectName for top-level monitoring MBean for the DAS. */
|
||||
public ObjectName serverMonForDAS() {
|
||||
return serverMon( "server" ) ;
|
||||
}
|
||||
|
||||
/** Make a new AMX ObjectName with unchecked exception.
|
||||
* name must be null to create a singleton ObjectName.
|
||||
* Note that the arguments must not contain the characters
|
||||
* @param pp The parent part
|
||||
* @param type The ObjectName type
|
||||
* @param name The ObjectName name
|
||||
* @return The objectname with pp, type, and (optionally) name.
|
||||
*/
|
||||
public ObjectName newObjectName(
|
||||
final String pp,
|
||||
final String type,
|
||||
final String name)
|
||||
{
|
||||
String props = prop(AMX.PARENT_PATH_KEY, pp) + "," + prop(AMX.TYPE_KEY, type);
|
||||
if (name != null) {
|
||||
props = props + "," + prop(AMX.NAME_KEY, name);
|
||||
}
|
||||
|
||||
return newObjectName( props);
|
||||
}
|
||||
|
||||
/** Make a new ObjectName for AMX domain with unchecked exception */
|
||||
public ObjectName newObjectName(final String s)
|
||||
{
|
||||
String name = s;
|
||||
if ( ! name.startsWith( amxJMXDomain() ) ) {
|
||||
name = amxJMXDomain() + ":" + name;
|
||||
}
|
||||
|
||||
return AMXUtil.newObjectName( name );
|
||||
}
|
||||
|
||||
private static String prop(final String key, final String value)
|
||||
{
|
||||
return key + "=" + value;
|
||||
}
|
||||
|
||||
/**
|
||||
ObjectName for {@link BootAMXMBean}
|
||||
*/
|
||||
public ObjectName getBootAMXMBeanObjectName()
|
||||
{
|
||||
return AMXUtil.newObjectName( amxSupportDomain() + ":type=boot-amx" );
|
||||
}
|
||||
|
||||
/**
|
||||
Invoke the bootAMX() method on {@link BootAMXMBean}. Upon return,
|
||||
AMX continues to load.
|
||||
A cilent should call {@link invokeWaitAMXReady} prior to use.
|
||||
*/
|
||||
public void invokeBootAMX(final MBeanServerConnection conn)
|
||||
{
|
||||
// start AMX and wait for it to be ready
|
||||
try
|
||||
{
|
||||
conn.invoke( getBootAMXMBeanObjectName(), BootAMXMBean.BOOT_AMX_OPERATION_NAME, null, null);
|
||||
}
|
||||
catch (final Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Invoke the waitAMXReady() method on the DomainRoot MBean, which must already be loaded.
|
||||
*/
|
||||
private static void invokeWaitAMXReady(final MBeanServerConnection conn, final ObjectName objectName)
|
||||
{
|
||||
try
|
||||
{
|
||||
conn.invoke( objectName, "waitAMXReady", null, null );
|
||||
}
|
||||
catch( final Exception e )
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Listen for the registration of AMX DomainRoot
|
||||
Listening starts automatically.
|
||||
*/
|
||||
public <T extends MBeanListener.Callback> MBeanListener<T> listenForDomainRoot(
|
||||
final MBeanServerConnection server,
|
||||
final T callback)
|
||||
{
|
||||
final MBeanListener<T> listener = new MBeanListener<T>( server, domainRoot(), callback);
|
||||
listener.startListening();
|
||||
return listener;
|
||||
}
|
||||
|
||||
private static final class WaitForDomainRootListenerCallback extends MBeanListener.CallbackImpl {
|
||||
private final MBeanServerConnection mConn;
|
||||
|
||||
public WaitForDomainRootListenerCallback( final MBeanServerConnection conn ) {
|
||||
mConn = conn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mbeanRegistered(final ObjectName objectName, final MBeanListener listener) {
|
||||
super.mbeanRegistered(objectName,listener);
|
||||
invokeWaitAMXReady(mConn, objectName);
|
||||
mLatch.countDown();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Wait until AMX has loaded and is ready for use.
|
||||
<p>
|
||||
This will <em>not</em> cause AMX to load; it will block forever until AMX is ready. In other words,
|
||||
don't call this method unless it's a convenient thread that can wait forever.
|
||||
*/
|
||||
public ObjectName waitAMXReady( final MBeanServerConnection server)
|
||||
{
|
||||
final WaitForDomainRootListenerCallback callback = new WaitForDomainRootListenerCallback(server);
|
||||
listenForDomainRoot( server, callback );
|
||||
callback.await();
|
||||
return callback.getRegistered();
|
||||
}
|
||||
|
||||
/**
|
||||
Listen for the registration of the {@link BootAMXMBean}.
|
||||
Listening starts automatically. See {@link AMXBooter#BootAMXCallback}.
|
||||
*/
|
||||
public <T extends MBeanListener.Callback> MBeanListener<T> listenForBootAMX(
|
||||
final MBeanServerConnection server,
|
||||
final T callback)
|
||||
{
|
||||
final MBeanListener<T> listener = new MBeanListener<T>( server, getBootAMXMBeanObjectName(), callback);
|
||||
listener.startListening();
|
||||
return listener;
|
||||
}
|
||||
|
||||
/**
|
||||
Callback for {@link MBeanListener} that waits for the BootAMXMBean to appear;
|
||||
it always will load early in server startup. Once it has loaded, AMX can be booted
|
||||
via {@link #bootAMX}. A client should normally just call {@link #bootAMX}, but
|
||||
this callback may be suclassed if desired, and used as a trigger to
|
||||
boot AMX and then take other dependent actions.
|
||||
*/
|
||||
public static class BootAMXCallback extends MBeanListener.CallbackImpl
|
||||
{
|
||||
private final MBeanServerConnection mConn;
|
||||
public BootAMXCallback(final MBeanServerConnection conn)
|
||||
{
|
||||
mConn = conn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mbeanRegistered(final ObjectName objectName, final MBeanListener listener)
|
||||
{
|
||||
super.mbeanRegistered(objectName, listener);
|
||||
mLatch.countDown();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Ensure that AMX is loaded and ready to use. This method returns only when all
|
||||
AMX subsystems have been loaded.
|
||||
It can be called more than once without ill effect, subsequent calls are ignored.
|
||||
@param conn connection to the MBeanServer
|
||||
@return the ObjectName of the domain-root MBean
|
||||
*/
|
||||
public ObjectName bootAMX(final MBeanServerConnection conn)
|
||||
throws IOException
|
||||
{
|
||||
final ObjectName domainRoot = domainRoot();
|
||||
|
||||
if ( !conn.isRegistered( domainRoot ) )
|
||||
{
|
||||
// wait for the BootAMXMBean to be available (loads at startup)
|
||||
final BootAMXCallback callback = new BootAMXCallback(conn);
|
||||
listenForBootAMX(conn, callback);
|
||||
callback.await(); // block until the MBean appears
|
||||
|
||||
invokeBootAMX(conn);
|
||||
|
||||
final WaitForDomainRootListenerCallback drCallback = new WaitForDomainRootListenerCallback(conn);
|
||||
listenForDomainRoot(conn, drCallback);
|
||||
drCallback.await();
|
||||
|
||||
invokeWaitAMXReady(conn, domainRoot);
|
||||
}
|
||||
else
|
||||
{
|
||||
invokeWaitAMXReady(conn, domainRoot );
|
||||
}
|
||||
return domainRoot;
|
||||
}
|
||||
|
||||
public ObjectName bootAMX(final MBeanServer server)
|
||||
{
|
||||
try
|
||||
{
|
||||
return bootAMX( (MBeanServerConnection)server);
|
||||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
79
jdkSrc/jdk8/com/sun/org/glassfish/external/amx/AMXUtil.java
vendored
Normal file
79
jdkSrc/jdk8/com/sun/org/glassfish/external/amx/AMXUtil.java
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.amx;
|
||||
|
||||
import javax.management.MBeanServerConnection;
|
||||
import javax.management.ObjectName;
|
||||
|
||||
/**
|
||||
Small utilities for AMXBooter and related.
|
||||
*/
|
||||
@com.sun.org.glassfish.external.arc.Taxonomy(stability = com.sun.org.glassfish.external.arc.Stability.UNCOMMITTED)
|
||||
public final class AMXUtil
|
||||
{
|
||||
private AMXUtil() {}
|
||||
|
||||
/**
|
||||
Make a new ObjectName (unchecked exception).
|
||||
*/
|
||||
public static ObjectName newObjectName(final String s)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new ObjectName( s );
|
||||
}
|
||||
catch( final Exception e )
|
||||
{
|
||||
throw new RuntimeException("bad ObjectName", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Make a new ObjectName (unchecked exception).
|
||||
@param domain
|
||||
@param props
|
||||
*/
|
||||
public static ObjectName newObjectName(
|
||||
final String domain,
|
||||
final String props)
|
||||
{
|
||||
return newObjectName(domain + ":" + props);
|
||||
}
|
||||
|
||||
/**
|
||||
Get the ObjectName of the MBeanServerDelegateObjectName.
|
||||
*/
|
||||
public static ObjectName getMBeanServerDelegateObjectName()
|
||||
{
|
||||
return newObjectName( "JMImplementation:type=MBeanServerDelegate" );
|
||||
}
|
||||
|
||||
public static String prop(final String key, final String value)
|
||||
{
|
||||
return key + "=" + value;
|
||||
}
|
||||
}
|
||||
48
jdkSrc/jdk8/com/sun/org/glassfish/external/amx/BootAMXMBean.java
vendored
Normal file
48
jdkSrc/jdk8/com/sun/org/glassfish/external/amx/BootAMXMBean.java
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.amx;
|
||||
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.remote.JMXServiceURL;
|
||||
|
||||
/**
|
||||
MBean responsible for booting the AMX system.
|
||||
To get its ObjectName, use {@link AMXGlassfish#getBootAMXMBeanObjectName}.
|
||||
*/
|
||||
@com.sun.org.glassfish.external.arc.Taxonomy(stability = com.sun.org.glassfish.external.arc.Stability.UNCOMMITTED)
|
||||
public interface BootAMXMBean
|
||||
{
|
||||
/**
|
||||
Start AMX and return the ObjectName of DomainRoot.
|
||||
*/
|
||||
public ObjectName bootAMX();
|
||||
|
||||
/** same as method above */
|
||||
public static final String BOOT_AMX_OPERATION_NAME = "bootAMX";
|
||||
|
||||
public JMXServiceURL[] getJMXServiceURLs();
|
||||
}
|
||||
330
jdkSrc/jdk8/com/sun/org/glassfish/external/amx/MBeanListener.java
vendored
Normal file
330
jdkSrc/jdk8/com/sun/org/glassfish/external/amx/MBeanListener.java
vendored
Normal file
@@ -0,0 +1,330 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.amx;
|
||||
|
||||
import java.util.Set;
|
||||
import javax.management.MBeanServer;
|
||||
import javax.management.MBeanServerConnection;
|
||||
import javax.management.MBeanServerNotification;
|
||||
import javax.management.Notification;
|
||||
import javax.management.NotificationListener;
|
||||
import javax.management.ObjectName;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
import static com.sun.org.glassfish.external.amx.AMX.*;
|
||||
|
||||
/**
|
||||
* Listens for registration of MBeans of various types.
|
||||
* Intended usage is for subsystems to lazy-load only when the Parent
|
||||
* MBean is registered.
|
||||
*/
|
||||
@com.sun.org.glassfish.external.arc.Taxonomy(stability = com.sun.org.glassfish.external.arc.Stability.UNCOMMITTED)
|
||||
public class MBeanListener<T extends MBeanListener.Callback> implements NotificationListener
|
||||
{
|
||||
private static void debug(final Object o) { System.out.println( "" + o ); }
|
||||
|
||||
/** listen for MBeans in a given domain of a given type[name]
|
||||
OR an ObjectName (below) */
|
||||
private final String mJMXDomain;
|
||||
private final String mType;
|
||||
private final String mName;
|
||||
|
||||
/** mType and mName should be null if mObjectName is non-null, and vice versa */
|
||||
private final ObjectName mObjectName;
|
||||
|
||||
private final MBeanServerConnection mMBeanServer;
|
||||
|
||||
private final T mCallback;
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "MBeanListener: ObjectName=" + mObjectName + ", type=" + mType + ", name=" + mName;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return mType;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
public MBeanServerConnection getMBeanServer()
|
||||
{
|
||||
return mMBeanServer;
|
||||
}
|
||||
|
||||
/** Callback interface. */
|
||||
public interface Callback
|
||||
{
|
||||
public void mbeanRegistered(final ObjectName objectName, final MBeanListener listener);
|
||||
public void mbeanUnregistered(final ObjectName objectName, final MBeanListener listener);
|
||||
}
|
||||
|
||||
/**
|
||||
Default callback implementation, can be subclassed if needed
|
||||
Remembers only the last MBean that was seen.
|
||||
*/
|
||||
public static class CallbackImpl implements MBeanListener.Callback
|
||||
{
|
||||
private volatile ObjectName mRegistered = null;
|
||||
private volatile ObjectName mUnregistered = null;
|
||||
private final boolean mStopAtFirst;
|
||||
|
||||
public CallbackImpl() {
|
||||
this(true);
|
||||
}
|
||||
|
||||
public CallbackImpl(final boolean stopAtFirst)
|
||||
{
|
||||
mStopAtFirst = stopAtFirst;
|
||||
}
|
||||
|
||||
public ObjectName getRegistered() { return mRegistered; }
|
||||
public ObjectName getUnregistered() { return mUnregistered; }
|
||||
|
||||
protected final CountDownLatch mLatch = new CountDownLatch(1);
|
||||
|
||||
/** Optional: wait for the CountDownLatch to fire
|
||||
If used, the subclass should countDown() the latch when the
|
||||
appropriate event happens
|
||||
*/
|
||||
public void await()
|
||||
{
|
||||
try
|
||||
{
|
||||
mLatch.await(); // wait until BootAMXMBean is ready
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void mbeanRegistered(final ObjectName objectName, final MBeanListener listener)
|
||||
{
|
||||
mRegistered = objectName;
|
||||
if ( mStopAtFirst )
|
||||
{
|
||||
listener.stopListening();
|
||||
}
|
||||
}
|
||||
public void mbeanUnregistered(final ObjectName objectName, final MBeanListener listener)
|
||||
{
|
||||
mUnregistered = objectName;
|
||||
if ( mStopAtFirst )
|
||||
{
|
||||
listener.stopListening();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public T getCallback()
|
||||
{
|
||||
return mCallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Listener for a specific MBean.
|
||||
* Caller must call {@link #start} to start listening.
|
||||
* @param server
|
||||
* @param objectName
|
||||
* @param callback
|
||||
*/
|
||||
public MBeanListener(
|
||||
final MBeanServerConnection server,
|
||||
final ObjectName objectName,
|
||||
final T callback)
|
||||
{
|
||||
mMBeanServer = server;
|
||||
mObjectName = objectName;
|
||||
mJMXDomain = null;
|
||||
mType = null;
|
||||
mName = null;
|
||||
mCallback = callback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Listener for all MBeans of specified type, with or without a name.
|
||||
* Caller must call {@link #start} to start listening.
|
||||
* @param server
|
||||
* @param type type of the MBean (as found in the ObjectName)
|
||||
* @param callback
|
||||
*/
|
||||
public MBeanListener(
|
||||
final MBeanServerConnection server,
|
||||
final String domain,
|
||||
final String type,
|
||||
final T callback)
|
||||
{
|
||||
this(server, domain, type, null, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Listener for MBeans of specified type, with specified name (or any name
|
||||
* if null is passed for the name).
|
||||
* Caller must call {@link #start} to start listening.
|
||||
* @param server
|
||||
* @param type type of the MBean (as found in the ObjectName)
|
||||
* @param name name of the MBean, or null if none
|
||||
* @param callback
|
||||
*/
|
||||
public MBeanListener(
|
||||
final MBeanServerConnection server,
|
||||
final String domain,
|
||||
final String type,
|
||||
final String name,
|
||||
final T callback)
|
||||
{
|
||||
mMBeanServer = server;
|
||||
mJMXDomain = domain;
|
||||
mType = type;
|
||||
mName = name;
|
||||
mObjectName = null;
|
||||
mCallback = callback;
|
||||
}
|
||||
|
||||
|
||||
private boolean isRegistered( final MBeanServerConnection conn, final ObjectName objectName )
|
||||
{
|
||||
try
|
||||
{
|
||||
return conn.isRegistered(objectName);
|
||||
}
|
||||
catch (final Exception e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Start listening. If the required MBean(s) are already present, the callback
|
||||
will be synchronously made before returning. It is also possible that the
|
||||
callback could happen twice for the same MBean.
|
||||
*/
|
||||
public void startListening()
|
||||
{
|
||||
// race condition: must listen *before* looking for existing MBeans
|
||||
try
|
||||
{
|
||||
mMBeanServer.addNotificationListener( AMXUtil.getMBeanServerDelegateObjectName(), this, null, this);
|
||||
}
|
||||
catch (final Exception e)
|
||||
{
|
||||
throw new RuntimeException("Can't add NotificationListener", e);
|
||||
}
|
||||
|
||||
if ( mObjectName != null )
|
||||
{
|
||||
if ( isRegistered(mMBeanServer, mObjectName) )
|
||||
{
|
||||
mCallback.mbeanRegistered(mObjectName, this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// query for AMX MBeans of the requisite type
|
||||
String props = TYPE_KEY + "=" + mType;
|
||||
if (mName != null)
|
||||
{
|
||||
props = props + "," + NAME_KEY + mName;
|
||||
}
|
||||
|
||||
final ObjectName pattern = AMXUtil.newObjectName(mJMXDomain + ":" +props);
|
||||
try
|
||||
{
|
||||
final Set<ObjectName> matched = mMBeanServer.queryNames(pattern, null);
|
||||
for (final ObjectName objectName : matched)
|
||||
{
|
||||
mCallback.mbeanRegistered(objectName, this);
|
||||
}
|
||||
}
|
||||
catch( final Exception e )
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** unregister the listener */
|
||||
public void stopListening()
|
||||
{
|
||||
try
|
||||
{
|
||||
mMBeanServer.removeNotificationListener( AMXUtil.getMBeanServerDelegateObjectName(), this);
|
||||
}
|
||||
catch (final Exception e)
|
||||
{
|
||||
throw new RuntimeException("Can't remove NotificationListener " + this, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void handleNotification(
|
||||
final Notification notifIn,
|
||||
final Object handback)
|
||||
{
|
||||
if (notifIn instanceof MBeanServerNotification)
|
||||
{
|
||||
final MBeanServerNotification notif = (MBeanServerNotification) notifIn;
|
||||
final ObjectName objectName = notif.getMBeanName();
|
||||
|
||||
boolean match = false;
|
||||
if ( mObjectName != null && mObjectName.equals(objectName) )
|
||||
{
|
||||
match = true;
|
||||
}
|
||||
else if ( objectName.getDomain().equals( mJMXDomain ) )
|
||||
{
|
||||
if ( mType != null && mType.equals(objectName.getKeyProperty(TYPE_KEY)) )
|
||||
{
|
||||
final String mbeanName = objectName.getKeyProperty(NAME_KEY);
|
||||
if (mName != null && mName.equals(mbeanName))
|
||||
{
|
||||
match = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( match )
|
||||
{
|
||||
final String notifType = notif.getType();
|
||||
if (MBeanServerNotification.REGISTRATION_NOTIFICATION.equals(notifType))
|
||||
{
|
||||
mCallback.mbeanRegistered(objectName, this);
|
||||
}
|
||||
else if (MBeanServerNotification.UNREGISTRATION_NOTIFICATION.equals(notifType))
|
||||
{
|
||||
mCallback.mbeanUnregistered(objectName, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
329
jdkSrc/jdk8/com/sun/org/glassfish/external/arc/Stability.java
vendored
Normal file
329
jdkSrc/jdk8/com/sun/org/glassfish/external/arc/Stability.java
vendored
Normal file
@@ -0,0 +1,329 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.arc;
|
||||
|
||||
/**
|
||||
Taxonomy values.
|
||||
See http://opensolaris.org/os/community/arc/policies/interface-taxonomy/
|
||||
<p>
|
||||
<h3>Policy</h3>
|
||||
<ul>
|
||||
<li>Applies to All software produced by SMI</li>
|
||||
<li>Authority SAC</li>
|
||||
<li>Approval SAC</li>
|
||||
<li>Effective April, 1992</li>
|
||||
<li>Policy </li>
|
||||
<ul><li>All software interfaces must be classified according to this taxonomy.
|
||||
Interfaces are defined as APIs, files and directory structures, file formats, protocols,
|
||||
(sometimes) even performance and reliability behaviors, and any other attribute upon
|
||||
which another component might reasonably depend.</li>
|
||||
|
||||
<li>An ARC must review, approve and archive the specification for all interfaces
|
||||
other than Project Private and Internal. Unreviewed, unapproved interfaces are assumed
|
||||
to be Internal. An adequate specification, suitable for archiving must exist for all
|
||||
interfaces submitted for review. Often Project Private interfaces are also reviewed if
|
||||
the presentation of them aids the understanding of the entire project or it is expected
|
||||
they will be promoted to a broader classification in the future.</li>
|
||||
|
||||
<li>Adequate customer documentation must exist for all Public interfaces.
|
||||
It is strongly preferred that manual pages exist for all Public interfaces
|
||||
(supported on Solaris), even if only significant content of those pages are SYNOPSIS
|
||||
and ATTRIBUTES sections and a textual pointer to other documentation.
|
||||
Independent of the form of documentation delivery, the interface taxonomy commitment
|
||||
level must be presented to the consumer.</li>
|
||||
|
||||
<li>In cases where the organization delivering the interface implementation does not
|
||||
control the interface specification, the controlling body must be be clearly cited
|
||||
in the documentation. In the case where a well-defined, versioned document is the
|
||||
specification, both the name and precise version must be be cited.</li>
|
||||
</ul>
|
||||
</ul>
|
||||
@author llc
|
||||
*/
|
||||
public enum Stability {
|
||||
/**
|
||||
<pre>
|
||||
+----------------------------------------------------------------------------+
|
||||
| Committed (formerly Stable, Public; encompasses Standard, Evolving) |
|
||||
|----------------------------------------------------------------------------|
|
||||
| | Specification | Open |
|
||||
| |---------------------+--------------------------------------------------|
|
||||
| | Incompatible Change | major release (X.0) |
|
||||
| |---------------------+--------------------------------------------------|
|
||||
| | ARC review of Specs | Yes |
|
||||
| |---------------------+--------------------------------------------------|
|
||||
| | Examples | Compiler command line options, |
|
||||
| | | hardware (SBus, PCI, USB), RPC, POSIX utilities |
|
||||
+----------------------------------------------------------------------------+
|
||||
</pre>
|
||||
We publish the specification of these interfaces, typically as manual pages or other product documentation.
|
||||
We also tell customers we will remain compatible with them. (Scott McNealy's principle that "Compatibility is a
|
||||
constraint, not a goal") The intention of a Committed interface is to enable arbitrary third parties to develop
|
||||
applications to these interfaces, release them, and have confidence that they will run on all releases of the product
|
||||
after the one in which the interface was introduced, and within the same Major release. Even at a Major release,
|
||||
incompatible changes are expected to be rare, and to have strong justifications.
|
||||
<p>
|
||||
Committed interfaces are often proposed to be industry standards, as was the case with RPC.
|
||||
Also, interfaces defined and controlled as industry standards are most often treated as Committed interfaces.
|
||||
<p>
|
||||
These are interfaces whose specification is often under the provider's control or which are specified by a
|
||||
clearly versioned document controlled by a well-defined organization. If the interface specification is not
|
||||
under the implementation provider's control, the provider must be willing to fork from the interface specification
|
||||
if required to maintain compatibility. In the case of interface specifications controlled by a standards body,
|
||||
the commitment must be to a clearly identified version of the specification, minimizing the likelihood of an
|
||||
incompatible change (but it can happen through formal spec interpretations).
|
||||
<p>
|
||||
Also, if the interface specification is not under the control of the interface implementation provider,
|
||||
then the controlling body and/or public, versioned document must be be noted in the documentation.
|
||||
This is particularly important for specifications controlled by recognized standards organizations.
|
||||
<p>
|
||||
Although a truely exceptional event, incompatible changes are possible in any release if
|
||||
the associated defect is serious enough as outlined in the EXEMPTIONS section of this document or
|
||||
in a Minor release by following the End of Feature process.
|
||||
*/
|
||||
COMMITTED( "Committed" ),
|
||||
|
||||
/**
|
||||
<pre>
|
||||
+--------------------------------------------------------------------------+
|
||||
| Uncommitted (formerly Unstable) |
|
||||
|--------------------------------------------------------------------------|
|
||||
| | Specification | Open |
|
||||
| |---------------------+------------------------------------------------|
|
||||
| | Incompatible Change | minor release (x.Y) with impact assessment |
|
||||
| |---------------------+------------------------------------------------|
|
||||
| | ARC review of Specs | Yes |
|
||||
| |---------------------+------------------------------------------------|
|
||||
| | Examples | SUNW* package abbreviations, some config utils |
|
||||
+--------------------------------------------------------------------------+
|
||||
</pre>
|
||||
No guarantees are made about either source or binary compatibility of these interfaces
|
||||
from one Minor release to the next. The most drastic incompatible change of removal of
|
||||
the interface in a Minor release is allowed. Uncommitted interfaces are generally not
|
||||
appropriate for use by release-independent products.
|
||||
<p>
|
||||
Uncommitted is not a license for gratuitous change. Any incompatible changes to the
|
||||
interface should be motivated by true improvement to the interface which may include
|
||||
justifiable ease of use considerations. The general expectation is that Uncommitted
|
||||
interfaces are not likely to change incompatibly and if such changes occur they will be
|
||||
small in impact and should often have a mitigation plan.
|
||||
<p>
|
||||
Uncommitted interfaces generally fall into one of the following subcategories:
|
||||
<p>
|
||||
<ul>
|
||||
<li>
|
||||
Interfaces that are experimental or transitional.
|
||||
They are typically used to give outside developers early access to new or
|
||||
rapidly-changing technology, or to provide an interim solution to a problem where a
|
||||
more general solution is anticipated.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
Interfaces whose specification is controlled by an outside body and the
|
||||
implementation provider is only willing to commit to forking until the next minor
|
||||
release point should that outside body introduce incompatible change.
|
||||
Note that this "middle of the road" approach is often the best business decision
|
||||
when the controlling body hasn't established a history of respecting compatibility.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
Interfaces whose target audience values innovation (and possibly ease of use) over
|
||||
stability. This attribute is often asserted for administrative interfaces for higher
|
||||
web tier components. Note that ARC review may request data to support such an assertion.
|
||||
</li>
|
||||
<p>
|
||||
A project's intention to import an Uncommitted interface from another consolidation should
|
||||
be discussed with the ARC early. The stability classification of the interface -- or
|
||||
a replacement interface -- might be raised. The opinion allowing any project to import an
|
||||
Uncommitted interface must explain why it is acceptable, and a contract must be put into
|
||||
place allowing this use. For Sun products, the similarity in the usage of Uncommitted and
|
||||
Consolidation Private interfaces should be noted.
|
||||
<p>
|
||||
Any documentation for an Uncommitted interface must contain warnings that "these interfaces
|
||||
are subject to change without warning and should not be used in unbundled products".
|
||||
In some situations, it may be appropriate to document Uncommitted interfaces in white papers
|
||||
rather than in standard product documentation. When changes are introduced, the changes
|
||||
should be mentioned in the release notes for the affected release.
|
||||
<p>
|
||||
NOTE: If we choose to offer a draft standard implementation but state our intention to track
|
||||
the standard (or the portions we find technically sound or likely to be standardized),
|
||||
we set customer expectations for incompatible changes by classifying the interface Uncommitted.
|
||||
The interface must be reclassified Committed when standard is final.
|
||||
Such an intention could be encoded "Uncommitted->Committed".)
|
||||
</pre>
|
||||
*/
|
||||
UNCOMMITTED( "Uncommitted" ),
|
||||
|
||||
|
||||
/**
|
||||
<pre>
|
||||
+--------------------------------------------------------------------+
|
||||
| Volatile (encompasses External) |
|
||||
|--------------------------------------------------------------------|
|
||||
| | Specification | Open |
|
||||
| |---------------------+------------------------------------------|
|
||||
| | Incompatible Change | micro release (x.y.z) or patch release |
|
||||
| |---------------------+------------------------------------------|
|
||||
| | Arc review of Specs | A precise reference is normally recorded |
|
||||
| |---------------------+------------------------------------------|
|
||||
| | Examples | Gimp user interface, IETF internet-draft |
|
||||
+--------------------------------------------------------------------+
|
||||
</pre>
|
||||
Volatile interfaces may change at any time and for any reason.
|
||||
<p>
|
||||
Use of the Volatile interface stability level allows interface providers to
|
||||
quickly track a fluid, rapidly evolving specification. In many cases, this is
|
||||
preferred to providing additional stability to the interface, as it may better
|
||||
meet the expectations of the consumer.
|
||||
<p>
|
||||
The most common application of this taxonomy level is to interfaces that are
|
||||
controlled by a body other than the final implementation provider, but unlike
|
||||
specifications controlled by standards bodies or communities we place trust in,
|
||||
it can not be asserted that an incompatible change to the interface
|
||||
specification would be exceedingly rare. In some cases it may not even be
|
||||
possible to clearly identify the controlling body. Although not prohibited by
|
||||
this taxonomy, the Volatile classification is not typically applied to
|
||||
interfaces where the specification is controlled by the implementation provider.
|
||||
<p>
|
||||
It should be noted that in some cases it will be preferable to apply a less
|
||||
fluid interface classification to an interface even if the controlling body is
|
||||
separate from the implementor. Use of the Uncommitted classification extends the
|
||||
stability commitment over micro/patch releases, allowing use of additional
|
||||
support models for software that depends upon these interfaces, at the potential
|
||||
cost of less frequent updates. Committed should be considered for required, core
|
||||
interfaces. If instability in the interface definition can't be reconciled with
|
||||
the requirement for stability, then alternate solutions should be considered.
|
||||
<p>
|
||||
This classification is typically used for free or open source software (FOSS),
|
||||
also referred to as community software, and similar models where it is deemed
|
||||
more important to track the community with minimal latency than to provide
|
||||
stability to our customers. When applying this classification level to community
|
||||
software, particular attention should be paid to the considerations presented in
|
||||
the preceding paragraph.
|
||||
<p>
|
||||
It also may be appropriate to apply the Volatile classification level to
|
||||
interfaces in the process of being defined by trusted or widely accepted
|
||||
organization. These are generically referred to as draft standards. An "IETF
|
||||
internet draft" is a well understood example of a specification under
|
||||
development.
|
||||
<p>
|
||||
There may also cases where Volatile is appropriate for experimental interfaces,
|
||||
but in most cases Uncommitted should be considered first.
|
||||
<p>
|
||||
Irrespective of the control of the specification, the Volatile classification
|
||||
must not be applied to "core" interfaces (those that must be used) for which no
|
||||
alternate (and more stable) interface exists. Volatile interfaces must also
|
||||
adhere to Sun internal standards in the following areas:
|
||||
<ul>
|
||||
<li>Security, Authentication</li>
|
||||
<li>The existence of (perhaps vestigial) Manual Pages and conformance to Sun section numbering</li>
|
||||
<li>File System Semantics (Solaris examples: /usr may be read-only, /var is where
|
||||
all significant run-time growth occurs, ...)</li>
|
||||
</ul>
|
||||
All Volatile interfaces should be labeled as such in all associated
|
||||
documentation and the consequence of using such interfaces must be explained
|
||||
either as part of that documentation or by reference.
|
||||
<p>
|
||||
Shipping incompatible change in a patch should be strongly avoided. It is not
|
||||
strictly prohibited for the following two reasons:
|
||||
<ul>
|
||||
<li>Since the patch provider may not be in explicit control of the changes to the
|
||||
upstream implementation, it cannot guarantee with reasonable assurance that an
|
||||
unidentified incompatibility is not present.
|
||||
</li>
|
||||
<li>A strong business case may exist for shipping a newer version as a patch if that
|
||||
newer version closes significant escalations.
|
||||
</li>
|
||||
</ul>
|
||||
In general, the intent of allowing change in a patch is to allow for change in
|
||||
Update Releases.
|
||||
<p>
|
||||
Sun products should consider Volatile interfaces as equivalent to Consolidation
|
||||
Private. A contract is required for use of these interfaces outside of the
|
||||
supplying consolidation.
|
||||
<p>
|
||||
Extreme care in the use of Volatile interfaces is required by layered or
|
||||
unbundled products. Layered products that depend upon Volatile interfaces must
|
||||
include as part of their review material how they intend to manage the
|
||||
dependency. It is not explicitly prohibited, but it is probable that unbundled
|
||||
or layered products that ship asynchronously from the Volatile interfaces upon
|
||||
which they depend will face nearly insurmountable difficulty in constructing a
|
||||
plan to manage such a dependency.
|
||||
*/
|
||||
VOLATILE( "Volatile" ),
|
||||
|
||||
/**
|
||||
<pre>
|
||||
+--------------------------------------------------------------------+
|
||||
| Not-an-interface |
|
||||
|--------------------------------------------------------------------|
|
||||
| | Specification | None |
|
||||
| |---------------------+------------------------------------------|
|
||||
| | Incompatible Change | micro release (x.y.z) or patch release |
|
||||
| |---------------------+------------------------------------------|
|
||||
| | Arc review of Specs | None |
|
||||
| |---------------------+------------------------------------------|
|
||||
| | Examples | CLI output, error text |
|
||||
+--------------------------------------------------------------------+
|
||||
</pre>
|
||||
In the course of reviewing or documenting interfaces, the situation often occurs
|
||||
that an attribute will be present which may be inferred to be an interface, but
|
||||
actually is not. A couple of common examples of this are output from CLIs
|
||||
intended only for human consumption and the exact layout of a GUI.
|
||||
<p>
|
||||
This classification is simply a convenience term to be used to clarify such
|
||||
situations where such confusion is identified as likely. Failure to apply this
|
||||
term to an attribute is no indication that said attribute is some form of
|
||||
interface. It only indicates that the potential for confusion was not
|
||||
identified.
|
||||
*/
|
||||
NOT_AN_INTERFACE( "Not-An-Interface" ),
|
||||
|
||||
/**
|
||||
See: http://opensolaris.org/os/community/arc/policies/interface-taxonomy/
|
||||
<p>
|
||||
Javadoc or other means should establish the nature of the private interface.
|
||||
*/
|
||||
PRIVATE( "Private" ),
|
||||
|
||||
|
||||
/**
|
||||
Not a formal term. Indicates that the interface, while visible, is experimental,
|
||||
and can be removed at any time.
|
||||
*/
|
||||
EXPERIMENTAL( "Experimental" ),
|
||||
|
||||
/**
|
||||
Interrim classification; a real one should be chosen asap.
|
||||
*/
|
||||
UNSPECIFIED( "Unspecified" );
|
||||
|
||||
private final String mName;
|
||||
private Stability( final String name ) { mName = name; }
|
||||
|
||||
public String toString() { return mName; }
|
||||
}
|
||||
48
jdkSrc/jdk8/com/sun/org/glassfish/external/arc/Taxonomy.java
vendored
Normal file
48
jdkSrc/jdk8/com/sun/org/glassfish/external/arc/Taxonomy.java
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.arc;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
/**
|
||||
Annotates classes, methods or fields as to the ARC taxonomy (stability level).
|
||||
Note that a class can be annotated as a whole, but that annotations on its methods
|
||||
and fields override the whole-class annotation.
|
||||
@author llc
|
||||
*/
|
||||
@Retention(RUNTIME)
|
||||
@Documented
|
||||
@Target( {METHOD, TYPE, ANNOTATION_TYPE, FIELD, PACKAGE})
|
||||
public @interface Taxonomy {
|
||||
public Stability stability() default Stability.UNSPECIFIED;
|
||||
public String description() default "";
|
||||
}
|
||||
54
jdkSrc/jdk8/com/sun/org/glassfish/external/probe/provider/PluginPoint.java
vendored
Normal file
54
jdkSrc/jdk8/com/sun/org/glassfish/external/probe/provider/PluginPoint.java
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.probe.provider;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author abbagani
|
||||
*/
|
||||
public enum PluginPoint {
|
||||
|
||||
SERVER ("server", "server"),
|
||||
APPLICATIONS ("applications", "server/applications");
|
||||
|
||||
String name;
|
||||
String path;
|
||||
|
||||
PluginPoint(String lname, String lpath) {
|
||||
name = lname;
|
||||
path = lpath;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
}
|
||||
39
jdkSrc/jdk8/com/sun/org/glassfish/external/probe/provider/StatsProvider.java
vendored
Normal file
39
jdkSrc/jdk8/com/sun/org/glassfish/external/probe/provider/StatsProvider.java
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.probe.provider;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author abbagani
|
||||
*/
|
||||
public interface StatsProvider {
|
||||
|
||||
public void enable();
|
||||
|
||||
public void disable();
|
||||
}
|
||||
86
jdkSrc/jdk8/com/sun/org/glassfish/external/probe/provider/StatsProviderInfo.java
vendored
Normal file
86
jdkSrc/jdk8/com/sun/org/glassfish/external/probe/provider/StatsProviderInfo.java
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.probe.provider;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author abbagani
|
||||
*/
|
||||
public class StatsProviderInfo {
|
||||
|
||||
public StatsProviderInfo(String configElement, PluginPoint pp,
|
||||
String subTreeRoot, Object statsProvider){
|
||||
this(configElement, pp, subTreeRoot, statsProvider, null);
|
||||
}
|
||||
|
||||
public StatsProviderInfo(String configElement, PluginPoint pp,
|
||||
String subTreeRoot, Object statsProvider,
|
||||
String invokerId){
|
||||
this.configElement = configElement;
|
||||
this.pp = pp;
|
||||
this.subTreeRoot = subTreeRoot;
|
||||
this.statsProvider = statsProvider;
|
||||
this.invokerId = invokerId;
|
||||
}
|
||||
|
||||
private String configElement;
|
||||
private PluginPoint pp;
|
||||
private String subTreeRoot;
|
||||
private Object statsProvider;
|
||||
private String configLevelStr = null;
|
||||
private final String invokerId;
|
||||
|
||||
public String getConfigElement() {
|
||||
return configElement;
|
||||
}
|
||||
|
||||
public PluginPoint getPluginPoint() {
|
||||
return pp;
|
||||
}
|
||||
|
||||
public String getSubTreeRoot() {
|
||||
return subTreeRoot;
|
||||
}
|
||||
|
||||
public Object getStatsProvider() {
|
||||
return statsProvider;
|
||||
}
|
||||
|
||||
public String getConfigLevel() {
|
||||
return configLevelStr;
|
||||
}
|
||||
|
||||
public void setConfigLevel(String configLevelStr) {
|
||||
this.configLevelStr = configLevelStr;
|
||||
}
|
||||
|
||||
public String getInvokerId() {
|
||||
return invokerId;
|
||||
}
|
||||
|
||||
}
|
||||
137
jdkSrc/jdk8/com/sun/org/glassfish/external/probe/provider/StatsProviderManager.java
vendored
Normal file
137
jdkSrc/jdk8/com/sun/org/glassfish/external/probe/provider/StatsProviderManager.java
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.probe.provider;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author abbagani
|
||||
*/
|
||||
public class StatsProviderManager {
|
||||
|
||||
private StatsProviderManager(){
|
||||
}
|
||||
|
||||
|
||||
public static boolean register(String configElement, PluginPoint pp,
|
||||
String subTreeRoot, Object statsProvider) {
|
||||
return (register(pp, configElement, subTreeRoot, statsProvider, null));
|
||||
}
|
||||
|
||||
public static boolean register(PluginPoint pp, String configElement,
|
||||
String subTreeRoot, Object statsProvider,
|
||||
String invokerId) {
|
||||
StatsProviderInfo spInfo =
|
||||
new StatsProviderInfo(configElement, pp, subTreeRoot, statsProvider, invokerId);
|
||||
|
||||
return registerStatsProvider(spInfo);
|
||||
}
|
||||
|
||||
public static boolean register(String configElement, PluginPoint pp,
|
||||
String subTreeRoot, Object statsProvider,
|
||||
String configLevelStr) {
|
||||
return(register(configElement, pp, subTreeRoot, statsProvider, configLevelStr, null));
|
||||
}
|
||||
|
||||
public static boolean register(String configElement, PluginPoint pp,
|
||||
String subTreeRoot, Object statsProvider,
|
||||
String configLevelStr, String invokerId) {
|
||||
StatsProviderInfo spInfo =
|
||||
new StatsProviderInfo(configElement, pp, subTreeRoot, statsProvider, invokerId);
|
||||
spInfo.setConfigLevel(configLevelStr);
|
||||
|
||||
return registerStatsProvider(spInfo);
|
||||
}
|
||||
|
||||
private static boolean registerStatsProvider(StatsProviderInfo spInfo) {
|
||||
//Ideally want to start this in a thread, so we can reduce the startup time
|
||||
if (spmd == null) {
|
||||
//Make an entry into the toBeRegistered map
|
||||
toBeRegistered.add(spInfo);
|
||||
} else {
|
||||
spmd.register(spInfo);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean unregister(Object statsProvider) {
|
||||
//Unregister the statsProvider if the delegate is not null
|
||||
if (spmd == null) {
|
||||
for (StatsProviderInfo spInfo : toBeRegistered) {
|
||||
if (spInfo.getStatsProvider() == statsProvider) {
|
||||
toBeRegistered.remove(spInfo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
spmd.unregister(statsProvider);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static boolean hasListeners(String probeStr) {
|
||||
//See if the probe has any listeners registered
|
||||
if (spmd == null) {
|
||||
return false;
|
||||
} else {
|
||||
return spmd.hasListeners(probeStr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void setStatsProviderManagerDelegate(
|
||||
StatsProviderManagerDelegate lspmd) {
|
||||
//System.out.println("in StatsProviderManager.setStatsProviderManagerDelegate ***********");
|
||||
if (lspmd == null) {
|
||||
//Should log and throw an exception
|
||||
return;
|
||||
}
|
||||
|
||||
//Assign the Delegate
|
||||
spmd = lspmd;
|
||||
|
||||
//System.out.println("Running through the toBeRegistered array to call register ***********");
|
||||
|
||||
//First register the pending StatsProviderRegistryElements
|
||||
for (StatsProviderInfo spInfo : toBeRegistered) {
|
||||
spmd.register(spInfo);
|
||||
}
|
||||
|
||||
//Now that you registered the pending calls, Clear the toBeRegistered store
|
||||
toBeRegistered.clear();
|
||||
}
|
||||
|
||||
//variables
|
||||
static StatsProviderManagerDelegate spmd; // populate this during our initilaization process
|
||||
static Vector<StatsProviderInfo> toBeRegistered = new Vector();
|
||||
}
|
||||
40
jdkSrc/jdk8/com/sun/org/glassfish/external/probe/provider/StatsProviderManagerDelegate.java
vendored
Normal file
40
jdkSrc/jdk8/com/sun/org/glassfish/external/probe/provider/StatsProviderManagerDelegate.java
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.probe.provider;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author abbagani
|
||||
*/
|
||||
public interface StatsProviderManagerDelegate {
|
||||
|
||||
public void register(StatsProviderInfo spInfo);
|
||||
public void unregister(Object statsProvider);
|
||||
public boolean hasListeners(String probeStr);
|
||||
|
||||
}
|
||||
54
jdkSrc/jdk8/com/sun/org/glassfish/external/probe/provider/annotations/Probe.java
vendored
Normal file
54
jdkSrc/jdk8/com/sun/org/glassfish/external/probe/provider/annotations/Probe.java
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.probe.provider.annotations;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Prashanth Abbagani
|
||||
* Date: April 16, 2009
|
||||
*/
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.METHOD})
|
||||
public @interface Probe {
|
||||
|
||||
public String name() default "";
|
||||
public boolean hidden() default false;
|
||||
public boolean self() default false;
|
||||
public String providerName() default "";
|
||||
public String moduleName() default "";
|
||||
public boolean stateful() default false;
|
||||
public String profileNames() default "";
|
||||
public boolean statefulReturn() default false;
|
||||
public boolean statefulException() default false;
|
||||
}
|
||||
47
jdkSrc/jdk8/com/sun/org/glassfish/external/probe/provider/annotations/ProbeListener.java
vendored
Normal file
47
jdkSrc/jdk8/com/sun/org/glassfish/external/probe/provider/annotations/ProbeListener.java
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.probe.provider.annotations;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Prashanth Abbagani
|
||||
* Date: May 26, 2009
|
||||
*/
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.METHOD})
|
||||
public @interface ProbeListener {
|
||||
|
||||
public abstract String value();
|
||||
|
||||
}
|
||||
47
jdkSrc/jdk8/com/sun/org/glassfish/external/probe/provider/annotations/ProbeParam.java
vendored
Normal file
47
jdkSrc/jdk8/com/sun/org/glassfish/external/probe/provider/annotations/ProbeParam.java
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.probe.provider.annotations;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Prashanth Abbagani
|
||||
* Date: April 16, 2009
|
||||
*/
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.PARAMETER})
|
||||
public @interface ProbeParam {
|
||||
|
||||
public String value();
|
||||
|
||||
}
|
||||
50
jdkSrc/jdk8/com/sun/org/glassfish/external/probe/provider/annotations/ProbeProvider.java
vendored
Normal file
50
jdkSrc/jdk8/com/sun/org/glassfish/external/probe/provider/annotations/ProbeProvider.java
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.probe.provider.annotations;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Prashanth Abbagani
|
||||
* Date: April 16, 2009
|
||||
*/
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE})
|
||||
public @interface ProbeProvider {
|
||||
|
||||
public String providerName() default "";
|
||||
public String moduleProviderName() default "";
|
||||
public String moduleName() default "";
|
||||
public String probeProviderName() default "";
|
||||
|
||||
}
|
||||
46
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/AverageRangeStatistic.java
vendored
Normal file
46
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/AverageRangeStatistic.java
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* AverageRangeStatistic.java
|
||||
*
|
||||
* Created on May 11, 2004, 2:15 PM
|
||||
*/
|
||||
|
||||
package com.sun.org.glassfish.external.statistics;
|
||||
|
||||
/**
|
||||
* An interface that Specifies standard measurements of the lowest and highest
|
||||
* values an attribute has held as well as its current value.
|
||||
* Extending RangeStatistic, it also provides the average value.
|
||||
*/
|
||||
|
||||
public interface AverageRangeStatistic extends RangeStatistic {
|
||||
|
||||
public long getAverage();
|
||||
|
||||
}
|
||||
43
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/BoundaryStatistic.java
vendored
Normal file
43
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/BoundaryStatistic.java
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.statistics;
|
||||
|
||||
/**
|
||||
* Specifies standard measurements of the upper and lower limits of the value of an attribute.
|
||||
*/
|
||||
public interface BoundaryStatistic extends Statistic {
|
||||
/**
|
||||
* The upper limit of the value of this attribute.
|
||||
*/
|
||||
long getUpperBound();
|
||||
|
||||
/**
|
||||
* The lower limit of the value of this attribute.The upper limit of the value of this attribute.
|
||||
*/
|
||||
long getLowerBound();
|
||||
}
|
||||
33
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/BoundedRangeStatistic.java
vendored
Normal file
33
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/BoundedRangeStatistic.java
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.statistics;
|
||||
|
||||
/**
|
||||
* The BoundedRangeStatistic model aggregates the attributes of RangeStatistic and BoundaryStatistic and provides standard measurements of a range that has fixed limits.
|
||||
*/
|
||||
public interface BoundedRangeStatistic extends BoundaryStatistic, RangeStatistic {
|
||||
}
|
||||
38
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/CountStatistic.java
vendored
Normal file
38
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/CountStatistic.java
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.statistics;
|
||||
|
||||
/**
|
||||
* Specifies standard count measurements.
|
||||
*/
|
||||
public interface CountStatistic extends Statistic {
|
||||
/**
|
||||
* The count since the last reset.
|
||||
*/
|
||||
long getCount();
|
||||
}
|
||||
48
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/RangeStatistic.java
vendored
Normal file
48
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/RangeStatistic.java
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.statistics;
|
||||
|
||||
/**
|
||||
* Specifies standard measurements of the lowest and highest values an attribute has held as well as its current value.
|
||||
*/
|
||||
public interface RangeStatistic extends Statistic {
|
||||
/**
|
||||
* The highest value this attribute has held since the beginninYg of the measurement.
|
||||
*/
|
||||
long getHighWaterMark();
|
||||
|
||||
/**
|
||||
* The lowest value this attribute has held since the beginning of the measurement.
|
||||
*/
|
||||
long getLowWaterMark();
|
||||
|
||||
/**
|
||||
* The current value of this attribute.
|
||||
*/
|
||||
long getCurrent();
|
||||
}
|
||||
59
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/Statistic.java
vendored
Normal file
59
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/Statistic.java
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.statistics;
|
||||
|
||||
/**
|
||||
* The Statistic model and its sub-models specify the data models which are requried to be used to provide the performance data described by the specific attributes in the Stats models.
|
||||
*/
|
||||
public interface Statistic {
|
||||
/**
|
||||
* The name of this Statistic.
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* The unit of measurement for this Statistic.
|
||||
* Valid values for TimeStatistic measurements are "HOUR", "MINUTE", "SECOND", "MILLISECOND", "MICROSECOND" and "NANOSECOND".
|
||||
*/
|
||||
String getUnit();
|
||||
|
||||
/**
|
||||
* A human-readable description of the Statistic.
|
||||
*/
|
||||
String getDescription();
|
||||
|
||||
/**
|
||||
* The time of the first measurement represented as a long, whose value is the number of milliseconds since January 1, 1970, 00:00:00.
|
||||
*/
|
||||
long getStartTime();
|
||||
|
||||
/**
|
||||
* The time of the last measurement represented as a long, whose value is the number of milliseconds since January 1, 1970, 00:00:00.
|
||||
*/
|
||||
long getLastSampleTime();
|
||||
}
|
||||
46
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/Stats.java
vendored
Normal file
46
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/Stats.java
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.statistics;
|
||||
|
||||
public interface Stats {
|
||||
|
||||
/**
|
||||
* Get a Statistic by name.
|
||||
*/
|
||||
Statistic getStatistic(String statisticName);
|
||||
|
||||
/**
|
||||
* Returns an array of Strings which are the names of the attributes from the specific Stats submodel that this object supports. Attributes named in the list must correspond to attributes that will return a Statistic object of the appropriate type which contains valid performance data. The return value of attributes in the Stats submodel that are not included in the statisticNames list must be null. For each name in the statisticNames list there must be one Statistic with the same name in the statistics list.
|
||||
*/
|
||||
String [] getStatisticNames();
|
||||
|
||||
/**
|
||||
* Returns an array containing all of the Statistic objects supported by this Stats object.
|
||||
*/
|
||||
Statistic[] getStatistics();
|
||||
}
|
||||
47
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/StringStatistic.java
vendored
Normal file
47
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/StringStatistic.java
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.statistics;
|
||||
|
||||
/**
|
||||
* Custom statistic type created for the Sun ONE Application Server.
|
||||
* The goal is to be able to represent changing attribute values that are strings
|
||||
* in the form of Statistics. Semantically, it is analogous to a {@link CountStatistic},
|
||||
* the only difference being in the value that is returned. Unlike a CountStatistic
|
||||
* (which always is unidirectional), this Statistic type is not having any
|
||||
* specified direction, simply because there is no natural order. An example
|
||||
* of the values that an instance of this statistic type can assume is: A State
|
||||
* Statistic which can have "CONNECTED, CLOSED, DISCONNECTED" as the permissible
|
||||
* values and the current value can be any one of them (and them only).
|
||||
* The permissible values are upto a particular implementation.
|
||||
*/
|
||||
|
||||
public interface StringStatistic extends Statistic {
|
||||
/**
|
||||
* Returns the String value of the statistic
|
||||
*/
|
||||
String getCurrent();
|
||||
}
|
||||
53
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/TimeStatistic.java
vendored
Normal file
53
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/TimeStatistic.java
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.statistics;
|
||||
|
||||
/**
|
||||
* Specifies standard timing measurements.
|
||||
*/
|
||||
public interface TimeStatistic extends Statistic {
|
||||
/**
|
||||
* Number of times the operation was invoked since the beginning of this measurement.
|
||||
*/
|
||||
long getCount();
|
||||
|
||||
/**
|
||||
* The maximum amount of time taken to complete one invocation of this operation since the beginning of this measurement.
|
||||
*/
|
||||
long getMaxTime();
|
||||
|
||||
/**
|
||||
* The minimum amount of time taken to complete one invocation of this operation since the beginning of this measurement.
|
||||
*/
|
||||
long getMinTime();
|
||||
|
||||
/**
|
||||
* This is the sum total of time taken to complete every invocation of this operation since the beginning of this measurement. Dividing totalTime by count will give you the average execution time for this operation.
|
||||
*/
|
||||
long getTotalTime();
|
||||
}
|
||||
44
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/annotations/Reset.java
vendored
Normal file
44
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/annotations/Reset.java
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.statistics.annotations;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jennifer Chou
|
||||
* Date: Sep 16, 2009
|
||||
*/
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.METHOD})
|
||||
public @interface Reset {
|
||||
}
|
||||
155
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/impl/AverageRangeStatisticImpl.java
vendored
Normal file
155
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/impl/AverageRangeStatisticImpl.java
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.statistics.impl;
|
||||
|
||||
import java.util.Map;
|
||||
import java.lang.reflect.*;
|
||||
import com.sun.org.glassfish.external.statistics.AverageRangeStatistic;
|
||||
|
||||
/**
|
||||
* An implementation of AverageRangeStatistic that provides ways to change the
|
||||
* state externally through mutators. Convenience class that is useful for
|
||||
* components that gather the statistical data.
|
||||
* By merely changing the count (which is a mandatory measurement), rest of the statistical
|
||||
* information could be deduced.
|
||||
*/
|
||||
|
||||
public final class AverageRangeStatisticImpl extends StatisticImpl implements
|
||||
AverageRangeStatistic, InvocationHandler {
|
||||
|
||||
private long currentVal = 0L;
|
||||
private long highWaterMark = Long.MIN_VALUE;
|
||||
private long lowWaterMark = Long.MAX_VALUE;
|
||||
private long numberOfSamples = 0L;
|
||||
private long runningTotal = 0L;
|
||||
|
||||
private final long initCurrentVal;
|
||||
private final long initHighWaterMark;
|
||||
private final long initLowWaterMark;
|
||||
private final long initNumberOfSamples;
|
||||
private final long initRunningTotal;
|
||||
|
||||
private final AverageRangeStatistic as =
|
||||
(AverageRangeStatistic) Proxy.newProxyInstance(
|
||||
AverageRangeStatistic.class.getClassLoader(),
|
||||
new Class[] { AverageRangeStatistic.class },
|
||||
this);
|
||||
|
||||
public AverageRangeStatisticImpl(long curVal, long highMark, long lowMark,
|
||||
String name, String unit, String desc,
|
||||
long startTime, long sampleTime) {
|
||||
super(name, unit, desc, startTime, sampleTime);
|
||||
currentVal = curVal;
|
||||
initCurrentVal = curVal;
|
||||
highWaterMark = highMark;
|
||||
initHighWaterMark = highMark;
|
||||
lowWaterMark = lowMark;
|
||||
initLowWaterMark = lowMark;
|
||||
numberOfSamples = 0L;
|
||||
initNumberOfSamples = numberOfSamples;
|
||||
runningTotal = 0L;
|
||||
initRunningTotal = runningTotal;
|
||||
}
|
||||
|
||||
public synchronized AverageRangeStatistic getStatistic() {
|
||||
return as;
|
||||
}
|
||||
|
||||
public synchronized String toString() {
|
||||
return super.toString() + NEWLINE +
|
||||
"Current: " + getCurrent() + NEWLINE +
|
||||
"LowWaterMark: " + getLowWaterMark() + NEWLINE +
|
||||
"HighWaterMark: " + getHighWaterMark() + NEWLINE +
|
||||
"Average:" + getAverage();
|
||||
}
|
||||
|
||||
public synchronized Map getStaticAsMap() {
|
||||
Map m = super.getStaticAsMap();
|
||||
m.put("current", getCurrent());
|
||||
m.put("lowwatermark", getLowWaterMark());
|
||||
m.put("highwatermark", getHighWaterMark());
|
||||
m.put("average", getAverage());
|
||||
return m;
|
||||
}
|
||||
|
||||
public synchronized void reset() {
|
||||
super.reset();
|
||||
currentVal = initCurrentVal;
|
||||
highWaterMark = initHighWaterMark;
|
||||
lowWaterMark = initLowWaterMark;
|
||||
numberOfSamples = initNumberOfSamples;
|
||||
runningTotal = initRunningTotal;
|
||||
sampleTime = -1L;
|
||||
}
|
||||
|
||||
public synchronized long getAverage() {
|
||||
if(numberOfSamples == 0) {
|
||||
return -1;
|
||||
} else {
|
||||
return runningTotal / numberOfSamples;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized long getCurrent() {
|
||||
return currentVal;
|
||||
}
|
||||
|
||||
public synchronized void setCurrent(long curVal) {
|
||||
currentVal = curVal;
|
||||
lowWaterMark = (curVal >= lowWaterMark ? lowWaterMark : curVal);
|
||||
highWaterMark = (curVal >= highWaterMark ? curVal : highWaterMark);
|
||||
numberOfSamples++;
|
||||
runningTotal += curVal;
|
||||
sampleTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public synchronized long getHighWaterMark() {
|
||||
return highWaterMark;
|
||||
}
|
||||
|
||||
public synchronized long getLowWaterMark() {
|
||||
return lowWaterMark;
|
||||
}
|
||||
|
||||
// todo: equals implementation
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
checkMethod(method);
|
||||
|
||||
Object result;
|
||||
try {
|
||||
result = method.invoke(this, args);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw e.getTargetException();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("unexpected invocation exception: " +
|
||||
e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
96
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/impl/BoundaryStatisticImpl.java
vendored
Normal file
96
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/impl/BoundaryStatisticImpl.java
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.statistics.impl;
|
||||
import com.sun.org.glassfish.external.statistics.BoundaryStatistic;
|
||||
import java.util.Map;
|
||||
import java.lang.reflect.*;
|
||||
|
||||
/**
|
||||
* @author Sreenivas Munnangi
|
||||
*/
|
||||
public final class BoundaryStatisticImpl extends StatisticImpl
|
||||
implements BoundaryStatistic, InvocationHandler {
|
||||
|
||||
private final long lowerBound;
|
||||
private final long upperBound;
|
||||
|
||||
private final BoundaryStatistic bs =
|
||||
(BoundaryStatistic) Proxy.newProxyInstance(
|
||||
BoundaryStatistic.class.getClassLoader(),
|
||||
new Class[] { BoundaryStatistic.class },
|
||||
this);
|
||||
|
||||
public BoundaryStatisticImpl(long lower, long upper, String name,
|
||||
String unit, String desc, long startTime,
|
||||
long sampleTime) {
|
||||
super(name, unit, desc, startTime, sampleTime);
|
||||
upperBound = upper;
|
||||
lowerBound = lower;
|
||||
}
|
||||
|
||||
public synchronized BoundaryStatistic getStatistic() {
|
||||
return bs;
|
||||
}
|
||||
|
||||
public synchronized Map getStaticAsMap() {
|
||||
Map m = super.getStaticAsMap();
|
||||
m.put("lowerbound", getLowerBound());
|
||||
m.put("upperbound", getUpperBound());
|
||||
return m;
|
||||
}
|
||||
|
||||
public synchronized long getLowerBound() {
|
||||
return lowerBound;
|
||||
}
|
||||
|
||||
public synchronized long getUpperBound() {
|
||||
return upperBound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void reset() {
|
||||
super.reset();
|
||||
sampleTime = -1L;
|
||||
}
|
||||
|
||||
// todo: equals implementation
|
||||
public Object invoke(Object proxy, Method m, Object[] args) throws Throwable {
|
||||
checkMethod(m);
|
||||
|
||||
Object result;
|
||||
try {
|
||||
result = m.invoke(this, args);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw e.getTargetException();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("unexpected invocation exception: " +
|
||||
e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
161
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/impl/BoundedRangeStatisticImpl.java
vendored
Normal file
161
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/impl/BoundedRangeStatisticImpl.java
vendored
Normal file
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.statistics.impl;
|
||||
|
||||
import com.sun.org.glassfish.external.statistics.BoundedRangeStatistic;
|
||||
import java.util.Map;
|
||||
import java.lang.reflect.*;
|
||||
|
||||
|
||||
/**
|
||||
* @author Sreenivas Munnangi
|
||||
*/
|
||||
public final class BoundedRangeStatisticImpl extends StatisticImpl
|
||||
implements BoundedRangeStatistic, InvocationHandler {
|
||||
|
||||
private long lowerBound = 0L;
|
||||
private long upperBound = 0L;
|
||||
private long currentVal = 0L;
|
||||
private long highWaterMark = Long.MIN_VALUE;
|
||||
private long lowWaterMark = Long.MAX_VALUE;
|
||||
|
||||
private final long initLowerBound;
|
||||
private final long initUpperBound;
|
||||
private final long initCurrentVal;
|
||||
private final long initHighWaterMark;
|
||||
private final long initLowWaterMark;
|
||||
|
||||
private final BoundedRangeStatistic bs =
|
||||
(BoundedRangeStatistic) Proxy.newProxyInstance(
|
||||
BoundedRangeStatistic.class.getClassLoader(),
|
||||
new Class[] { BoundedRangeStatistic.class },
|
||||
this);
|
||||
|
||||
public synchronized String toString() {
|
||||
return super.toString() + NEWLINE +
|
||||
"Current: " + getCurrent() + NEWLINE +
|
||||
"LowWaterMark: " + getLowWaterMark() + NEWLINE +
|
||||
"HighWaterMark: " + getHighWaterMark() + NEWLINE +
|
||||
"LowerBound: " + getLowerBound() + NEWLINE +
|
||||
"UpperBound: " + getUpperBound();
|
||||
}
|
||||
|
||||
|
||||
public BoundedRangeStatisticImpl(long curVal, long highMark, long lowMark,
|
||||
long upper, long lower, String name,
|
||||
String unit, String desc, long startTime,
|
||||
long sampleTime) {
|
||||
super(name, unit, desc, startTime, sampleTime);
|
||||
currentVal = curVal;
|
||||
initCurrentVal = curVal;
|
||||
highWaterMark = highMark;
|
||||
initHighWaterMark = highMark;
|
||||
lowWaterMark = lowMark;
|
||||
initLowWaterMark = lowMark;
|
||||
upperBound = upper;
|
||||
initUpperBound = upper;
|
||||
lowerBound = lower;
|
||||
initLowerBound = lower;
|
||||
}
|
||||
|
||||
public synchronized BoundedRangeStatistic getStatistic() {
|
||||
return bs;
|
||||
}
|
||||
|
||||
public synchronized Map getStaticAsMap() {
|
||||
Map m = super.getStaticAsMap();
|
||||
m.put("current", getCurrent());
|
||||
m.put("lowerbound", getLowerBound());
|
||||
m.put("upperbound", getUpperBound());
|
||||
m.put("lowwatermark", getLowWaterMark());
|
||||
m.put("highwatermark", getHighWaterMark());
|
||||
return m;
|
||||
}
|
||||
|
||||
public synchronized long getCurrent() {
|
||||
return currentVal;
|
||||
}
|
||||
|
||||
public synchronized void setCurrent(long curVal) {
|
||||
currentVal = curVal;
|
||||
lowWaterMark = (curVal >= lowWaterMark ? lowWaterMark : curVal);
|
||||
highWaterMark = (curVal >= highWaterMark ? curVal : highWaterMark);
|
||||
sampleTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public synchronized long getHighWaterMark() {
|
||||
return highWaterMark;
|
||||
}
|
||||
|
||||
public synchronized void setHighWaterMark(long hwm) {
|
||||
highWaterMark = hwm;
|
||||
}
|
||||
|
||||
public synchronized long getLowWaterMark() {
|
||||
return lowWaterMark;
|
||||
}
|
||||
|
||||
public synchronized void setLowWaterMark(long lwm) {
|
||||
lowWaterMark = lwm;
|
||||
}
|
||||
|
||||
public synchronized long getLowerBound() {
|
||||
return lowerBound;
|
||||
}
|
||||
|
||||
public synchronized long getUpperBound() {
|
||||
return upperBound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void reset() {
|
||||
super.reset();
|
||||
lowerBound = initLowerBound;
|
||||
upperBound = initUpperBound;
|
||||
currentVal = initCurrentVal;
|
||||
highWaterMark = initHighWaterMark;
|
||||
lowWaterMark = initLowWaterMark;
|
||||
sampleTime = -1L;
|
||||
}
|
||||
|
||||
// todo: equals implementation
|
||||
public Object invoke(Object proxy, Method m, Object[] args) throws Throwable {
|
||||
checkMethod(m);
|
||||
|
||||
Object result;
|
||||
try {
|
||||
result = m.invoke(this, args);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw e.getTargetException();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("unexpected invocation exception: " +
|
||||
e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
118
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/impl/CountStatisticImpl.java
vendored
Normal file
118
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/impl/CountStatisticImpl.java
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.statistics.impl;
|
||||
import com.sun.org.glassfish.external.statistics.CountStatistic;
|
||||
import java.util.Map;
|
||||
import java.lang.reflect.*;
|
||||
|
||||
/**
|
||||
* @author Sreenivas Munnangi
|
||||
*/
|
||||
public final class CountStatisticImpl extends StatisticImpl
|
||||
implements CountStatistic, InvocationHandler {
|
||||
|
||||
private long count = 0L;
|
||||
private final long initCount;
|
||||
|
||||
private final CountStatistic cs =
|
||||
(CountStatistic) Proxy.newProxyInstance(
|
||||
CountStatistic.class.getClassLoader(),
|
||||
new Class[] { CountStatistic.class },
|
||||
this);
|
||||
|
||||
public CountStatisticImpl(long countVal, String name, String unit,
|
||||
String desc, long sampleTime, long startTime) {
|
||||
super(name, unit, desc, startTime, sampleTime);
|
||||
count = countVal;
|
||||
initCount = countVal;
|
||||
}
|
||||
|
||||
public CountStatisticImpl(String name, String unit, String desc) {
|
||||
this(0L, name, unit, desc, -1L, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public synchronized CountStatistic getStatistic() {
|
||||
return cs;
|
||||
}
|
||||
|
||||
public synchronized Map getStaticAsMap() {
|
||||
Map m = super.getStaticAsMap();
|
||||
m.put("count", getCount());
|
||||
return m;
|
||||
}
|
||||
|
||||
public synchronized String toString() {
|
||||
return super.toString() + NEWLINE + "Count: " + getCount();
|
||||
}
|
||||
|
||||
public synchronized long getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public synchronized void setCount(long countVal) {
|
||||
count = countVal;
|
||||
sampleTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public synchronized void increment() {
|
||||
count++;
|
||||
sampleTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public synchronized void increment(long delta) {
|
||||
count = count + delta;
|
||||
sampleTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public synchronized void decrement() {
|
||||
count--;
|
||||
sampleTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void reset() {
|
||||
super.reset();
|
||||
count = initCount;
|
||||
sampleTime = -1L;
|
||||
}
|
||||
|
||||
// todo: equals implementation
|
||||
public Object invoke(Object proxy, Method m, Object[] args) throws Throwable {
|
||||
checkMethod(m);
|
||||
|
||||
Object result;
|
||||
try {
|
||||
result = m.invoke(this, args);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw e.getTargetException();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("unexpected invocation exception: " +
|
||||
e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
140
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/impl/RangeStatisticImpl.java
vendored
Normal file
140
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/impl/RangeStatisticImpl.java
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.statistics.impl;
|
||||
import com.sun.org.glassfish.external.statistics.RangeStatistic;
|
||||
import java.util.Map;
|
||||
import java.lang.reflect.*;
|
||||
|
||||
/**
|
||||
* @author Sreenivas Munnangi
|
||||
*/
|
||||
public final class RangeStatisticImpl extends StatisticImpl
|
||||
implements RangeStatistic, InvocationHandler {
|
||||
|
||||
private long currentVal = 0L;
|
||||
private long highWaterMark = Long.MIN_VALUE;
|
||||
private long lowWaterMark = Long.MAX_VALUE;
|
||||
private final long initCurrentVal;
|
||||
private final long initHighWaterMark;
|
||||
private final long initLowWaterMark;
|
||||
|
||||
private final RangeStatistic rs =
|
||||
(RangeStatistic) Proxy.newProxyInstance(
|
||||
RangeStatistic.class.getClassLoader(),
|
||||
new Class[] { RangeStatistic.class },
|
||||
this);
|
||||
|
||||
public RangeStatisticImpl(long curVal, long highMark, long lowMark,
|
||||
String name, String unit, String desc,
|
||||
long startTime, long sampleTime) {
|
||||
super(name, unit, desc, startTime, sampleTime);
|
||||
currentVal = curVal;
|
||||
initCurrentVal = curVal;
|
||||
highWaterMark = highMark;
|
||||
initHighWaterMark = highMark;
|
||||
lowWaterMark = lowMark;
|
||||
initLowWaterMark = lowMark;
|
||||
}
|
||||
|
||||
public synchronized RangeStatistic getStatistic() {
|
||||
return rs;
|
||||
}
|
||||
|
||||
public synchronized Map getStaticAsMap() {
|
||||
Map m = super.getStaticAsMap();
|
||||
m.put("current", getCurrent());
|
||||
m.put("lowwatermark", getLowWaterMark());
|
||||
m.put("highwatermark", getHighWaterMark());
|
||||
return m;
|
||||
}
|
||||
|
||||
public synchronized long getCurrent() {
|
||||
return currentVal;
|
||||
}
|
||||
|
||||
public synchronized void setCurrent(long curVal) {
|
||||
currentVal = curVal;
|
||||
lowWaterMark = (curVal >= lowWaterMark ? lowWaterMark : curVal);
|
||||
highWaterMark = (curVal >= highWaterMark ? curVal : highWaterMark);
|
||||
sampleTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the highest value of this statistic, since measurement started.
|
||||
*/
|
||||
public synchronized long getHighWaterMark() {
|
||||
return highWaterMark;
|
||||
}
|
||||
|
||||
public synchronized void setHighWaterMark(long hwm) {
|
||||
highWaterMark = hwm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the lowest value of this statistic, since measurement started.
|
||||
*/
|
||||
public synchronized long getLowWaterMark() {
|
||||
return lowWaterMark;
|
||||
}
|
||||
|
||||
public synchronized void setLowWaterMark(long lwm) {
|
||||
lowWaterMark = lwm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void reset() {
|
||||
super.reset();
|
||||
currentVal = initCurrentVal;
|
||||
highWaterMark = initHighWaterMark;
|
||||
lowWaterMark = initLowWaterMark;
|
||||
sampleTime = -1L;
|
||||
}
|
||||
|
||||
public synchronized String toString() {
|
||||
return super.toString() + NEWLINE +
|
||||
"Current: " + getCurrent() + NEWLINE +
|
||||
"LowWaterMark: " + getLowWaterMark() + NEWLINE +
|
||||
"HighWaterMark: " + getHighWaterMark();
|
||||
}
|
||||
|
||||
// todo: equals implementation
|
||||
public Object invoke(Object proxy, Method m, Object[] args) throws Throwable {
|
||||
checkMethod(m);
|
||||
|
||||
Object result;
|
||||
try {
|
||||
result = m.invoke(this, args);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw e.getTargetException();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("unexpected invocation exception: " +
|
||||
e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
145
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/impl/StatisticImpl.java
vendored
Normal file
145
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/impl/StatisticImpl.java
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.statistics.impl;
|
||||
import com.sun.org.glassfish.external.statistics.Statistic;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* @author Sreenivas Munnangi
|
||||
*/
|
||||
public abstract class StatisticImpl implements Statistic {
|
||||
|
||||
private final String statisticName;
|
||||
private final String statisticUnit;
|
||||
private final String statisticDesc;
|
||||
protected long sampleTime = -1L;
|
||||
private long startTime;
|
||||
public static final String UNIT_COUNT = "count";
|
||||
public static final String UNIT_SECOND = "second";
|
||||
public static final String UNIT_MILLISECOND = "millisecond";
|
||||
public static final String UNIT_MICROSECOND = "microsecond";
|
||||
public static final String UNIT_NANOSECOND = "nanosecond";
|
||||
public static final String START_TIME = "starttime";
|
||||
public static final String LAST_SAMPLE_TIME = "lastsampletime";
|
||||
|
||||
protected final Map<String, Object> statMap = new ConcurrentHashMap<String, Object> ();
|
||||
|
||||
protected static final String NEWLINE = System.getProperty( "line.separator" );
|
||||
|
||||
protected StatisticImpl(String name, String unit, String desc,
|
||||
long start_time, long sample_time) {
|
||||
|
||||
if (isValidString(name)) {
|
||||
statisticName = name;
|
||||
} else {
|
||||
statisticName = "name";
|
||||
}
|
||||
|
||||
if (isValidString(unit)) {
|
||||
statisticUnit = unit;
|
||||
} else {
|
||||
statisticUnit = "unit";
|
||||
}
|
||||
|
||||
if (isValidString(desc)) {
|
||||
statisticDesc = desc;
|
||||
} else {
|
||||
statisticDesc = "description";
|
||||
}
|
||||
|
||||
startTime = start_time;
|
||||
sampleTime = sample_time;
|
||||
}
|
||||
|
||||
protected StatisticImpl(String name, String unit, String desc) {
|
||||
this(name, unit, desc, System.currentTimeMillis(), System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public synchronized Map getStaticAsMap() {
|
||||
if (isValidString(statisticName)) {
|
||||
statMap.put("name", statisticName);
|
||||
}
|
||||
if (isValidString(statisticUnit)) {
|
||||
statMap.put("unit", statisticUnit);
|
||||
}
|
||||
if (isValidString(statisticDesc)) {
|
||||
statMap.put("description", statisticDesc);
|
||||
}
|
||||
statMap.put(StatisticImpl.START_TIME, startTime);
|
||||
statMap.put(StatisticImpl.LAST_SAMPLE_TIME, sampleTime);
|
||||
return statMap;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.statisticName;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.statisticDesc;
|
||||
}
|
||||
|
||||
public String getUnit() {
|
||||
return this.statisticUnit;
|
||||
}
|
||||
|
||||
public synchronized long getLastSampleTime() {
|
||||
return sampleTime;
|
||||
}
|
||||
|
||||
public synchronized long getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public synchronized void reset() {
|
||||
startTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public synchronized String toString() {
|
||||
return "Statistic " + getClass().getName() + NEWLINE +
|
||||
"Name: " + getName() + NEWLINE +
|
||||
"Description: " + getDescription() + NEWLINE +
|
||||
"Unit: " + getUnit() + NEWLINE +
|
||||
"LastSampleTime: " + getLastSampleTime() + NEWLINE +
|
||||
"StartTime: " + getStartTime();
|
||||
}
|
||||
|
||||
protected static boolean isValidString(String str) {
|
||||
return (str!=null && str.length()>0);
|
||||
}
|
||||
|
||||
protected void checkMethod(Method method) {
|
||||
if (method == null || method.getDeclaringClass() == null
|
||||
|| !Statistic.class.isAssignableFrom(method.getDeclaringClass())
|
||||
|| Modifier.isStatic(method.getModifiers())) {
|
||||
throw new RuntimeException("Invalid method on invoke");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
79
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/impl/StatsImpl.java
vendored
Normal file
79
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/impl/StatsImpl.java
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.statistics.impl;
|
||||
import com.sun.org.glassfish.external.statistics.Stats;
|
||||
import com.sun.org.glassfish.external.statistics.Statistic;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author Jennifer Chou
|
||||
*/
|
||||
public final class StatsImpl implements Stats {
|
||||
|
||||
private final StatisticImpl[] statArray;
|
||||
|
||||
protected StatsImpl(StatisticImpl[] statisticArray) {
|
||||
statArray = statisticArray;
|
||||
}
|
||||
|
||||
public synchronized Statistic getStatistic(String statisticName) {
|
||||
Statistic stat = null;
|
||||
for (Statistic s : statArray) {
|
||||
if (s.getName().equals(statisticName)) {
|
||||
stat = s;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return stat;
|
||||
}
|
||||
|
||||
public synchronized String[] getStatisticNames() {
|
||||
ArrayList list = new ArrayList();
|
||||
for (Statistic s : statArray) {
|
||||
list.add(s.getName());
|
||||
}
|
||||
String[] strArray = new String[list.size()];
|
||||
return (String[])list.toArray(strArray);
|
||||
}
|
||||
|
||||
public synchronized Statistic[] getStatistics() {
|
||||
return this.statArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call reset on all of the Statistic objects contained by this Stats object
|
||||
*/
|
||||
public synchronized void reset() {
|
||||
for (StatisticImpl s : statArray) {
|
||||
s.reset();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
106
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/impl/StringStatisticImpl.java
vendored
Normal file
106
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/impl/StringStatisticImpl.java
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.statistics.impl;
|
||||
import com.sun.org.glassfish.external.statistics.StringStatistic;
|
||||
import java.util.Map;
|
||||
import java.lang.reflect.*;
|
||||
|
||||
/**
|
||||
* @author Sreenivas Munnangi
|
||||
*/
|
||||
public final class StringStatisticImpl extends StatisticImpl
|
||||
implements StringStatistic, InvocationHandler {
|
||||
|
||||
private volatile String str = null;
|
||||
private final String initStr;
|
||||
|
||||
private final StringStatistic ss =
|
||||
(StringStatistic) Proxy.newProxyInstance(
|
||||
StringStatistic.class.getClassLoader(),
|
||||
new Class[] { StringStatistic.class },
|
||||
this);
|
||||
|
||||
public StringStatisticImpl(String str, String name, String unit,
|
||||
String desc, long sampleTime, long startTime) {
|
||||
super(name, unit, desc, startTime, sampleTime);
|
||||
this.str = str;
|
||||
initStr = str;
|
||||
}
|
||||
|
||||
public StringStatisticImpl(String name, String unit, String desc) {
|
||||
this("", name, unit, desc, System.currentTimeMillis(), System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public synchronized StringStatistic getStatistic() {
|
||||
return ss;
|
||||
}
|
||||
|
||||
public synchronized Map getStaticAsMap() {
|
||||
Map m = super.getStaticAsMap();
|
||||
if (getCurrent() != null) {
|
||||
m.put("current", getCurrent());
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
public synchronized String toString() {
|
||||
return super.toString() + NEWLINE + "Current-value: " + getCurrent();
|
||||
}
|
||||
|
||||
public String getCurrent() {
|
||||
return str;
|
||||
}
|
||||
|
||||
public void setCurrent(String str) {
|
||||
this.str = str;
|
||||
sampleTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void reset() {
|
||||
super.reset();
|
||||
this.str = initStr;
|
||||
sampleTime = -1L;
|
||||
}
|
||||
|
||||
// todo: equals implementation
|
||||
public Object invoke(Object proxy, Method m, Object[] args) throws Throwable {
|
||||
checkMethod(m);
|
||||
|
||||
Object result;
|
||||
try {
|
||||
result = m.invoke(this, args);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw e.getTargetException();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("unexpected invocation exception: " +
|
||||
e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
160
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/impl/TimeStatisticImpl.java
vendored
Normal file
160
jdkSrc/jdk8/com/sun/org/glassfish/external/statistics/impl/TimeStatisticImpl.java
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package com.sun.org.glassfish.external.statistics.impl;
|
||||
|
||||
import com.sun.org.glassfish.external.statistics.TimeStatistic;
|
||||
import java.util.Map;
|
||||
import java.lang.reflect.*;
|
||||
|
||||
/**
|
||||
* @author Sreenivas Munnangi
|
||||
*/
|
||||
public final class TimeStatisticImpl extends StatisticImpl
|
||||
implements TimeStatistic, InvocationHandler {
|
||||
|
||||
private long count = 0L;
|
||||
private long maxTime = 0L;
|
||||
private long minTime = 0L;
|
||||
private long totTime = 0L;
|
||||
private final long initCount;
|
||||
private final long initMaxTime;
|
||||
private final long initMinTime;
|
||||
private final long initTotTime;
|
||||
|
||||
private final TimeStatistic ts =
|
||||
(TimeStatistic) Proxy.newProxyInstance(
|
||||
TimeStatistic.class.getClassLoader(),
|
||||
new Class[] { TimeStatistic.class },
|
||||
this);
|
||||
|
||||
public synchronized final String toString() {
|
||||
return super.toString() + NEWLINE +
|
||||
"Count: " + getCount() + NEWLINE +
|
||||
"MinTime: " + getMinTime() + NEWLINE +
|
||||
"MaxTime: " + getMaxTime() + NEWLINE +
|
||||
"TotalTime: " + getTotalTime();
|
||||
}
|
||||
|
||||
public TimeStatisticImpl(long counter, long maximumTime, long minimumTime,
|
||||
long totalTime, String name, String unit,
|
||||
String desc, long startTime, long sampleTime) {
|
||||
super(name, unit, desc, startTime, sampleTime);
|
||||
count = counter;
|
||||
initCount = counter;
|
||||
maxTime = maximumTime;
|
||||
initMaxTime = maximumTime;
|
||||
minTime = minimumTime;
|
||||
initMinTime = minimumTime;
|
||||
totTime = totalTime;
|
||||
initTotTime = totalTime;
|
||||
}
|
||||
|
||||
public synchronized TimeStatistic getStatistic() {
|
||||
return ts;
|
||||
}
|
||||
|
||||
public synchronized Map getStaticAsMap() {
|
||||
Map m = super.getStaticAsMap();
|
||||
m.put("count", getCount());
|
||||
m.put("maxtime", getMaxTime());
|
||||
m.put("mintime", getMinTime());
|
||||
m.put("totaltime", getTotalTime());
|
||||
return m;
|
||||
}
|
||||
|
||||
public synchronized void incrementCount(long current) {
|
||||
if (count == 0) {
|
||||
totTime = current;
|
||||
maxTime = current;
|
||||
minTime = current;
|
||||
} else {
|
||||
totTime = totTime + current;
|
||||
maxTime = (current >= maxTime ? current : maxTime);
|
||||
minTime = (current >= minTime ? minTime : current);
|
||||
}
|
||||
count++;
|
||||
sampleTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of times an operation was invoked
|
||||
*/
|
||||
public synchronized long getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the maximum amount of time that it took for one invocation of an
|
||||
* operation, since measurement started.
|
||||
*/
|
||||
public synchronized long getMaxTime() {
|
||||
return maxTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the minimum amount of time that it took for one invocation of an
|
||||
* operation, since measurement started.
|
||||
*/
|
||||
public synchronized long getMinTime() {
|
||||
return minTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the amount of time that it took for all invocations,
|
||||
* since measurement started.
|
||||
*/
|
||||
public synchronized long getTotalTime() {
|
||||
return totTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void reset() {
|
||||
super.reset();
|
||||
count = initCount;
|
||||
maxTime = initMaxTime;
|
||||
minTime = initMinTime;
|
||||
totTime = initTotTime;
|
||||
sampleTime = -1L;
|
||||
}
|
||||
|
||||
// todo: equals implementation
|
||||
public Object invoke(Object proxy, Method m, Object[] args) throws Throwable {
|
||||
checkMethod(m);
|
||||
|
||||
Object result;
|
||||
try {
|
||||
result = m.invoke(this, args);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw e.getTargetException();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("unexpected invocation exception: " +
|
||||
e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user