|
From: <ls...@us...> - 2007-09-08 16:44:24
|
Revision: 3471
http://jnode.svn.sourceforge.net/jnode/?rev=3471&view=rev
Author: lsantha
Date: 2007-09-08 09:44:21 -0700 (Sat, 08 Sep 2007)
Log Message:
-----------
openjdk integration
Added Paths:
-----------
trunk/core/src/openjdk/javax/javax/management/ValueExp.java
trunk/core/src/openjdk/sun/sun/management/AgentConfigurationError.java
trunk/core/src/openjdk/sun/sun/management/ClassLoadingImpl.java
trunk/core/src/openjdk/sun/sun/management/CompilationImpl.java
trunk/core/src/openjdk/sun/sun/management/CompilerThreadStat.java
Added: trunk/core/src/openjdk/javax/javax/management/ValueExp.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/management/ValueExp.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/management/ValueExp.java 2007-09-08 16:44:21 UTC (rev 3471)
@@ -0,0 +1,103 @@
+/*
+ * Copyright 1999-2004 Sun Microsystems, Inc. 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. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.management;
+
+
+/**
+ * Represents values that can be passed as arguments to
+ * relational expressions. Strings, numbers, attributes are valid values
+ * and should be represented by implementations of <CODE>ValueExp</CODE>.
+ *
+ * @since 1.5
+ */
+/*
+ We considered generifying this interface as ValueExp<T>, where T is
+ the Java type that this expression generates. This allows some additional
+ checking in the various methods of the Query class, but in practice
+ not much. Typically you have something like
+ Query.lt(Query.attr("A"), Query.value(5)). We can arrange for Query.value
+ to have type ValueExp<Integer> (or maybe ValueExp<Long> or ValueExp<Number>)
+ but for Query.attr we can't do better than ValueExp<?> or plain ValueExp.
+ So even though we could define Query.lt as:
+ QueryExp <T> lt(ValueExp<T> v1, ValueExp<T> v2)
+ and thus prevent comparing a
+ number against a string, in practice the first ValueExp will almost always
+ be a Query.attr so this check serves no purpose. You would have to
+ write Query.<Number>attr("A"), for example, which would be awful. And,
+ if you wrote Query.<Integer>attr("A") you would then discover that you
+ couldn't compare it against Query.value(5) if the latter is defined as
+ ValueExp<Number>, or against Query.value(5L) if it is defined as
+ ValueExp<Integer>.
+
+ Worse, for Query.in we would like to define:
+ QueryExp <T> in(ValueExp<T> val, ValueExp<T>[] valueList)
+ but this is unusable because you cannot write
+ "new ValueExp<Integer>[] {...}" (the compiler forbids it).
+
+ The few mistakes you might catch with this generification certainly
+ wouldn't justify the hassle of modifying user code to get the checks
+ to be made and the "unchecked" warnings that would arise if it
+ wasn't so modified.
+
+ We could reconsider this if the Query methods were augmented, for example
+ with:
+ AttributeValueExp<Number> numberAttr(String name);
+ AttributeValueExp<String> stringAttr(String name);
+ AttributeValueExp<Boolean> booleanAttr(String name);
+ QueryExp <T> in(ValueExp<T> val, Set<ValueExp<T>> valueSet).
+ But it's not really clear what numberAttr should do if it finds that the
+ attribute is not in fact a Number.
+ */
+public interface ValueExp extends java.io.Serializable {
+
+ /**
+ * Applies the ValueExp on a MBean.
+ *
+ * @param name The name of the MBean on which the ValueExp will be applied.
+ *
+ * @return The <CODE>ValueExp</CODE>.
+ *
+ * @exception BadStringOperationException
+ * @exception BadBinaryOpValueExpException
+ * @exception BadAttributeValueExpException
+ * @exception InvalidApplicationException
+ */
+ public ValueExp apply(ObjectName name)
+ throws BadStringOperationException, BadBinaryOpValueExpException,
+ BadAttributeValueExpException, InvalidApplicationException;
+
+ /**
+ * Sets the MBean server on which the query is to be performed.
+ *
+ * @param s The MBean server on which the query is to be performed.
+ *
+ * @deprecated This method is not needed because a
+ * <code>ValueExp</code> can access the MBean server in which it
+ * is being evaluated by using {@link QueryEval#getMBeanServer()}.
+ */
+ @Deprecated
+ public void setMBeanServer(MBeanServer s) ;
+}
Added: trunk/core/src/openjdk/sun/sun/management/AgentConfigurationError.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/management/AgentConfigurationError.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/management/AgentConfigurationError.java 2007-09-08 16:44:21 UTC (rev 3471)
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2004-2005 Sun Microsystems, Inc. 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. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.management;
+
+/**
+ * Configuration Error thrown by a management agent.
+ */
+public class AgentConfigurationError extends Error {
+ public static final String AGENT_EXCEPTION =
+ "agent.err.exception";
+ public static final String CONFIG_FILE_NOT_FOUND =
+ "agent.err.configfile.notfound";
+ public static final String CONFIG_FILE_OPEN_FAILED =
+ "agent.err.configfile.failed";
+ public static final String CONFIG_FILE_CLOSE_FAILED =
+ "agent.err.configfile.closed.failed";
+ public static final String CONFIG_FILE_ACCESS_DENIED =
+ "agent.err.configfile.access.denied";
+ public static final String EXPORT_ADDRESS_FAILED =
+ "agent.err.exportaddress.failed";
+ public static final String AGENT_CLASS_NOT_FOUND =
+ "agent.err.agentclass.notfound";
+ public static final String AGENT_CLASS_FAILED =
+ "agent.err.agentclass.failed";
+ public static final String AGENT_CLASS_PREMAIN_NOT_FOUND =
+ "agent.err.premain.notfound";
+ public static final String AGENT_CLASS_ACCESS_DENIED =
+ "agent.err.agentclass.access.denied";
+ public static final String AGENT_CLASS_INVALID =
+ "agent.err.invalid.agentclass";
+ public static final String INVALID_JMXREMOTE_PORT =
+ "agent.err.invalid.jmxremote.port";
+ public static final String PASSWORD_FILE_NOT_SET =
+ "agent.err.password.file.notset";
+ public static final String PASSWORD_FILE_NOT_READABLE =
+ "agent.err.password.file.not.readable";
+ public static final String PASSWORD_FILE_READ_FAILED =
+ "agent.err.password.file.read.failed";
+ public static final String PASSWORD_FILE_NOT_FOUND =
+ "agent.err.password.file.notfound";
+ public static final String ACCESS_FILE_NOT_SET =
+ "agent.err.access.file.notset";
+ public static final String ACCESS_FILE_NOT_READABLE =
+ "agent.err.access.file.not.readable";
+ public static final String ACCESS_FILE_READ_FAILED =
+ "agent.err.access.file.read.failed";
+ public static final String ACCESS_FILE_NOT_FOUND =
+ "agent.err.access.file.notfound";
+ public static final String PASSWORD_FILE_ACCESS_NOT_RESTRICTED =
+ "agent.err.password.file.access.notrestricted";
+ public static final String CONNECTOR_SERVER_IO_ERROR =
+ "agent.err.connector.server.io.error";
+ public static final String INVALID_OPTION =
+ "agent.err.invalid.option";
+ public static final String INVALID_SNMP_PORT =
+ "agent.err.invalid.snmp.port";
+ public static final String INVALID_SNMP_TRAP_PORT =
+ "agent.err.invalid.snmp.trap.port";
+ public static final String UNKNOWN_SNMP_INTERFACE =
+ "agent.err.unknown.snmp.interface";
+ public static final String SNMP_ACL_FILE_NOT_SET =
+ "agent.err.acl.file.notset";
+ public static final String SNMP_ACL_FILE_NOT_FOUND =
+ "agent.err.acl.file.notfound";
+ public static final String SNMP_ACL_FILE_NOT_READABLE =
+ "agent.err.acl.file.not.readable";
+ public static final String SNMP_ACL_FILE_READ_FAILED =
+ "agent.err.acl.file.read.failed";
+ public static final String SNMP_ACL_FILE_ACCESS_NOT_RESTRICTED =
+ "agent.err.acl.file.access.notrestricted";
+ public static final String SNMP_ADAPTOR_START_FAILED =
+ "agent.err.snmp.adaptor.start.failed";
+ public static final String SNMP_MIB_INIT_FAILED =
+ "agent.err.snmp.mib.init.failed";
+
+ private final String error;
+ private final String[] params;
+
+ public AgentConfigurationError(String error) {
+ super();
+ this.error = error;
+ this.params = null;
+ }
+
+ public AgentConfigurationError(String error, Throwable cause) {
+ super(cause);
+ this.error = error;
+ this.params = null;
+ }
+
+ public AgentConfigurationError(String error, String... params) {
+ super();
+ this.error = error;
+ this.params = new String[params.length];
+ for (int i = 0; i < params.length; i++) {
+ this.params[i] = params[i];
+ }
+ }
+
+ public AgentConfigurationError(String error, Throwable cause, String... params) {
+ super(cause);
+ this.error = error;
+ this.params = new String[params.length];
+ for (int i = 0; i < params.length; i++) {
+ this.params[i] = params[i];
+ }
+ }
+
+ public String getError() {
+ return error;
+ }
+
+ public String[] getParams() {
+ return params;
+ }
+}
Added: trunk/core/src/openjdk/sun/sun/management/ClassLoadingImpl.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/management/ClassLoadingImpl.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/management/ClassLoadingImpl.java 2007-09-08 16:44:21 UTC (rev 3471)
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2003-2005 Sun Microsystems, Inc. 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. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.management;
+
+import java.lang.management.ClassLoadingMXBean;
+
+/**
+ * Implementation class for the class loading subsystem.
+ * Standard and committed hotspot-specific metrics if any.
+ *
+ * ManagementFactory.getClassLoadingMXBean() returns an instance
+ * of this class.
+ */
+class ClassLoadingImpl implements ClassLoadingMXBean {
+
+ private final VMManagement jvm;
+
+ /**
+ * Constructor of ClassLoadingImpl class.
+ */
+ ClassLoadingImpl(VMManagement vm) {
+ this.jvm = vm;
+ }
+
+ public long getTotalLoadedClassCount() {
+ return jvm.getTotalClassCount();
+ }
+
+ public int getLoadedClassCount() {
+ return jvm.getLoadedClassCount();
+ }
+
+ public long getUnloadedClassCount() {
+ return jvm.getUnloadedClassCount();
+ }
+
+ public boolean isVerbose() {
+ return jvm.getVerboseClass();
+ }
+
+ public void setVerbose(boolean value) {
+ ManagementFactory.checkControlAccess();
+
+ setVerboseClass(value);
+ }
+ native static void setVerboseClass(boolean value);
+}
Added: trunk/core/src/openjdk/sun/sun/management/CompilationImpl.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/management/CompilationImpl.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/management/CompilationImpl.java 2007-09-08 16:44:21 UTC (rev 3471)
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2003-2005 Sun Microsystems, Inc. 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. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.management;
+
+import java.lang.management.CompilationMXBean;
+
+/**
+ * Implementation class for the compilation subsystem.
+ * Standard and committed hotspot-specific metrics if any.
+ *
+ * ManagementFactory.getCompilationMXBean() returns an instance
+ * of this class.
+ */
+class CompilationImpl implements CompilationMXBean {
+
+ private final VMManagement jvm;
+ private final String name;
+
+ /**
+ * Constructor of CompilationImpl class.
+ */
+ CompilationImpl(VMManagement vm) {
+ this.jvm = vm;
+ this.name = jvm.getCompilerName();
+ if (name == null) {
+ throw new InternalError("Null compiler name");
+ }
+ }
+
+ public java.lang.String getName() {
+ return name;
+ }
+
+ public boolean isCompilationTimeMonitoringSupported() {
+ return jvm.isCompilationTimeMonitoringSupported();
+ }
+
+ public long getTotalCompilationTime() {
+ if (!isCompilationTimeMonitoringSupported()) {
+ throw new UnsupportedOperationException(
+ "Compilation time monitoring is not supported.");
+ }
+
+ return jvm.getTotalCompileTime();
+ }
+
+}
Added: trunk/core/src/openjdk/sun/sun/management/CompilerThreadStat.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/management/CompilerThreadStat.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/management/CompilerThreadStat.java 2007-09-08 16:44:21 UTC (rev 3471)
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2003 Sun Microsystems, Inc. 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. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.management;
+
+/**
+ */
+public class CompilerThreadStat implements java.io.Serializable {
+ private String name;
+ private long taskCount;
+ private long compileTime;
+ private MethodInfo lastMethod;
+
+ CompilerThreadStat(String name, long taskCount, long time, MethodInfo lastMethod) {
+ this.name = name;
+ this.taskCount = taskCount;
+ this.compileTime = time;
+ this.lastMethod = lastMethod;
+ };
+
+ /**
+ * Returns the name of the compiler thread associated with
+ * this compiler thread statistic.
+ *
+ * @return the name of the compiler thread.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns the number of compile tasks performed by the compiler thread
+ * associated with this compiler thread statistic.
+ *
+ * @return the number of compile tasks performed by the compiler thread.
+ */
+ public long getCompileTaskCount() {
+ return taskCount;
+ }
+
+ /**
+ * Returns the accumulated elapsed time spent by the compiler thread
+ * associated with this compiler thread statistic.
+ *
+ * @return the accumulated elapsed time spent by the compiler thread.
+ */
+ public long getCompileTime() {
+ return compileTime;
+ }
+
+ /**
+ * Returns the information about the last method compiled by
+ * the compiler thread associated with this compiler thread statistic.
+ *
+ * @return a {@link MethodInfo} object for the last method
+ * compiled by the compiler thread.
+ */
+ public MethodInfo getLastCompiledMethodInfo() {
+ return lastMethod;
+ }
+
+ public String toString() {
+ return getName() + " compileTasks = " + getCompileTaskCount()
+ + " compileTime = " + getCompileTime();
+ }
+
+ private static final long serialVersionUID = 6992337162326171013L;
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|