libjava/classpath/ChangeLog.gcj:
2007-05-31 Matthias Klose <doko@ubuntu.com> * javax/management/NotificationBroadcasterSupport.java (getNotificationInfo): Add cast. * native/jni/qt-peer/Makefile.am (AM_CXXFLAGS): Add libstdc++ include directories. * native/jni/qt-peer/Makefile.in: Regenerate. libjava/ChangeLog: 2007-06-03 Matthias Klose <doko@ubuntu.com> * java/io/natFileWin32.cc (setFilePermissions): New (stub only). _access: Handle EXEC query, stub only. 2007-06-03 Matthias Klose <doko@ubuntu.com> Merged from classpath: * gnu/java/nio/SelectorProviderImpl.java: Whitespace merge. * java/lang/System.java(inheritedChannel): New. * java/lang/Character.java: Remove stray`;'. * java/net/MulticastSocket.java: Merged. * java/text/DateFormatSymbols.java(getInstance): New, comment updates. * java/text/Collator.java(getInstance): Merged. * java/util/Calendar.java: New attributes ALL_STYLES, SHORT, LONG. getDisplayName, getDisplayNames: New. * java/util/logging/Logger.java: Merged. * Regenerate .class and .h files. 2007-06-03 Matthias Klose <doko@ubuntu.com> * java/io/File.java: Merge with classpath-0.95, new method setFilePermissions, new attribute EXEC. * java/io/natFilePosix.cc (setFilePermissions): New. _access: Handle EXEC query. * classpath/lib/java/io/File.class, java/io/File.h: Regenerate. 2007-06-03 Matthias Klose <doko@ubuntu.com> Imported GNU Classpath 0.95. * classpath/Makefile.in, classpath/native/jni/midi-dssi/Makefile.in, classpath/native/jni/classpath/Makefile.in, classpath/native/jni/Makefile.in, classpath/native/jni/gconf-peer/Makefile.in, classpath/native/jni/java-io/Makefile.in, classpath/native/jni/native-lib/Makefile.in, classpath/native/jni/java-util/Makefile.in, classpath/native/jni/midi-alsa/Makefile.in, classpath/native/jni/java-lang/Makefile.in, classpath/native/jni/java-nio/Makefile.in, classpath/native/jni/java-net/Makefile.in, classpath/native/jni/xmlj/Makefile.in, classpath/native/jni/qt-peer/Makefile.in, classpath/native/jni/gtk-peer/Makefile.in, classpath/native/Makefile.in, classpath/native/jawt/Makefile.in, classpath/native/fdlibm/Makefile.in, classpath/native/plugin/Makefile.in, classpath/resource/Makefile.in, classpath/scripts/Makefile.in, classpath/tools/Makefile.in, classpath/doc/Makefile.in, classpath/doc/api/Makefile.in, classpath/lib/Makefile.in, classpath/external/Makefile.in, classpath/external/jsr166/Makefile.in, classpath/external/sax/Makefile.in, classpath/external/w3c_dom/Makefile.in, classpath/external/relaxngDatatype/Makefile.in, classpath/include/Makefile.in, classpath/examples/Makefile.in: Regenerate. * classpath/config.guess, classpath/config.sub, classpath/ltmain.sh : Update. * classpath/configure, classpath/depcomp, classpath/missing, classpath/aclocal.m4, classpath/install-sh: Regenerate. * gnu/classpath/Configuration.java (CLASSPATH_VERSION): Now 0.95. * sources.am: Regenerate. * Makefile.in: Regenerate. * Update the .class files and generated CNI header files, add new .class and generated CNI header files. * Remove generated files for removed java source files: classpath/gnu/java/net/BASE64.java, classpath/gnu/java/security/util/Base64.java, classpath/gnu/java/awt/peer/gtk/GThreadMutex.java, classpath/gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java, classpath/gnu/java/awt/font/autofit/Scaler.java, classpath/gnu/classpath/jdwp/util/Value.java, classpath/gnu/javax/net/ssl/Base64.java. * Remove empty directories. * Makefile.am(nat_source_files): Add natVMOperatingSystemMXBeanImpl.cc. * java/lang/Class.java(setAccessible): Merge from classpath. * java/util/Locale.java: Remove. * gnu/java/lang/management/VMOperatingSystemMXBeanImpl.java, gnu/java/lang/management/natVMOperatingSystemMXBeanImpl.cc: New. * gcj/javaprims.h: Update class declarations. * scripts/classes.pl: Update usage. * HACKING: Mention to build all peers. From-SVN: r125302
This commit is contained in:
parent
af333b9a7f
commit
e1bea0c068
2951 changed files with 80982 additions and 68583 deletions
|
@ -37,6 +37,8 @@ exception statement from your version. */
|
|||
|
||||
package gnu.java.lang.management;
|
||||
|
||||
import gnu.javax.management.Translator;
|
||||
|
||||
import java.lang.management.ManagementPermission;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
|
@ -124,7 +126,7 @@ public class BeanImpl
|
|||
new OpenMBeanAttributeInfoSupport[oldA.length];
|
||||
for (int a = 0; a < oldA.length; ++a)
|
||||
{
|
||||
OpenMBeanParameterInfo param = translate(oldA[a].getType());
|
||||
OpenMBeanParameterInfo param = Translator.translate(oldA[a].getType());
|
||||
if (param.getMinValue() == null)
|
||||
{
|
||||
Object[] lv;
|
||||
|
@ -134,7 +136,8 @@ public class BeanImpl
|
|||
lv = param.getLegalValues().toArray();
|
||||
attribs[a] = new OpenMBeanAttributeInfoSupport(oldA[a].getName(),
|
||||
oldA[a].getDescription(),
|
||||
param.getOpenType(),
|
||||
((OpenType<Object>)
|
||||
param.getOpenType()),
|
||||
oldA[a].isReadable(),
|
||||
oldA[a].isWritable(),
|
||||
oldA[a].isIs(),
|
||||
|
@ -144,13 +147,16 @@ public class BeanImpl
|
|||
else
|
||||
attribs[a] = new OpenMBeanAttributeInfoSupport(oldA[a].getName(),
|
||||
oldA[a].getDescription(),
|
||||
param.getOpenType(),
|
||||
((OpenType<Object>)
|
||||
param.getOpenType()),
|
||||
oldA[a].isReadable(),
|
||||
oldA[a].isWritable(),
|
||||
oldA[a].isIs(),
|
||||
param.getDefaultValue(),
|
||||
param.getMinValue(),
|
||||
param.getMaxValue());
|
||||
((Comparable<Object>)
|
||||
param.getMinValue()),
|
||||
((Comparable<Object>)
|
||||
param.getMaxValue()));
|
||||
}
|
||||
MBeanConstructorInfo[] oldC = info.getConstructors();
|
||||
OpenMBeanConstructorInfo[] cons = new OpenMBeanConstructorInfoSupport[oldC.length];
|
||||
|
@ -166,7 +172,7 @@ public class BeanImpl
|
|||
new OpenMBeanOperationInfoSupport(oldO[a].getName(),
|
||||
oldO[a].getDescription(),
|
||||
translateSignature(oldO[a].getSignature()),
|
||||
translate(oldO[a].getReturnType()).getOpenType(),
|
||||
Translator.translate(oldO[a].getReturnType()).getOpenType(),
|
||||
oldO[a].getImpact());
|
||||
openInfo = new OpenMBeanInfoSupport(info.getClassName(), info.getDescription(),
|
||||
attribs, cons, ops, info.getNotifications());
|
||||
|
@ -201,32 +207,36 @@ public class BeanImpl
|
|||
return ((Enum) value).name();
|
||||
Class vClass = value.getClass();
|
||||
if (vClass.isArray())
|
||||
return value;
|
||||
vClass = vClass.getComponentType();
|
||||
String cName = vClass.getName();
|
||||
String[] allowedTypes = OpenType.ALLOWED_CLASSNAMES;
|
||||
for (int a = 0; a < allowedTypes.length; ++a)
|
||||
if (cName.equals(allowedTypes[a]))
|
||||
return value;
|
||||
if (value instanceof List)
|
||||
{
|
||||
List l = (List) value;
|
||||
Class e = null;
|
||||
TypeVariable[] vars = vClass.getTypeParameters();
|
||||
for (int a = 0; a < vars.length; ++a)
|
||||
if (vars[a].getName().equals("E"))
|
||||
e = (Class) vars[a].getGenericDeclaration();
|
||||
if (e == null)
|
||||
e = Object.class;
|
||||
Object[] array = (Object[]) Array.newInstance(e, l.size());
|
||||
return l.toArray(array);
|
||||
}
|
||||
OpenMBeanInfo info = (OpenMBeanInfo) getMBeanInfo();
|
||||
OpenMBeanAttributeInfo[] attribs =
|
||||
(OpenMBeanAttributeInfo[]) info.getAttributes();
|
||||
MBeanAttributeInfo[] attribs =
|
||||
(MBeanAttributeInfo[]) info.getAttributes();
|
||||
OpenType type = null;
|
||||
for (int a = 0; a < attribs.length; ++a)
|
||||
if (attribs[a].getName().equals("attribute"))
|
||||
type = attribs[a].getOpenType();
|
||||
if (attribs[a].getName().equals(attribute))
|
||||
type = ((OpenMBeanAttributeInfo) attribs[a]).getOpenType();
|
||||
if (value instanceof List)
|
||||
{
|
||||
try
|
||||
{
|
||||
Class e =
|
||||
Class.forName(((ArrayType) type).getElementOpenType().getClassName());
|
||||
List l = (List) value;
|
||||
Object[] array = (Object[]) Array.newInstance(e, l.size());
|
||||
return l.toArray(array);
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
throw (InternalError) (new InternalError("The class of the list " +
|
||||
"element type could not " +
|
||||
"be created").initCause(e));
|
||||
}
|
||||
}
|
||||
if (value instanceof Map)
|
||||
{
|
||||
TabularType ttype = (TabularType) type;
|
||||
|
@ -319,19 +329,13 @@ public class BeanImpl
|
|||
return getCachedMBeanInfo();
|
||||
}
|
||||
|
||||
private OpenType getTypeFromClass(Class c)
|
||||
throws OpenDataException
|
||||
{
|
||||
return translate(c.getName()).getOpenType();
|
||||
}
|
||||
|
||||
private OpenMBeanParameterInfo[] translateSignature(MBeanParameterInfo[] oldS)
|
||||
throws OpenDataException
|
||||
{
|
||||
OpenMBeanParameterInfo[] sig = new OpenMBeanParameterInfoSupport[oldS.length];
|
||||
for (int a = 0; a < oldS.length; ++a)
|
||||
{
|
||||
OpenMBeanParameterInfo param = translate(oldS[a].getType());
|
||||
OpenMBeanParameterInfo param = Translator.translate(oldS[a].getType());
|
||||
if (param.getMinValue() == null)
|
||||
{
|
||||
Object[] lv;
|
||||
|
@ -341,179 +345,24 @@ public class BeanImpl
|
|||
lv = param.getLegalValues().toArray();
|
||||
sig[a] = new OpenMBeanParameterInfoSupport(oldS[a].getName(),
|
||||
oldS[a].getDescription(),
|
||||
param.getOpenType(),
|
||||
((OpenType<Object>)
|
||||
param.getOpenType()),
|
||||
param.getDefaultValue(),
|
||||
lv);
|
||||
}
|
||||
else
|
||||
sig[a] = new OpenMBeanParameterInfoSupport(oldS[a].getName(),
|
||||
oldS[a].getDescription(),
|
||||
param.getOpenType(),
|
||||
((OpenType<Object>)
|
||||
param.getOpenType()),
|
||||
param.getDefaultValue(),
|
||||
param.getMinValue(),
|
||||
param.getMaxValue());
|
||||
((Comparable<Object>)
|
||||
param.getMinValue()),
|
||||
((Comparable<Object>)
|
||||
param.getMaxValue()));
|
||||
}
|
||||
return sig;
|
||||
}
|
||||
|
||||
private OpenMBeanParameterInfo translate(String type)
|
||||
throws OpenDataException
|
||||
{
|
||||
if (type.equals("boolean") || type.equals(Boolean.class.getName()))
|
||||
return new OpenMBeanParameterInfoSupport("TransParam",
|
||||
"Translated parameter",
|
||||
SimpleType.BOOLEAN,
|
||||
null,
|
||||
new Object[] {
|
||||
Boolean.TRUE,
|
||||
Boolean.FALSE
|
||||
});
|
||||
if (type.equals("byte") || type.equals(Byte.class.getName()))
|
||||
return new OpenMBeanParameterInfoSupport("TransParam",
|
||||
"Translated parameter",
|
||||
SimpleType.BYTE,
|
||||
null,
|
||||
Byte.valueOf(Byte.MIN_VALUE),
|
||||
Byte.valueOf(Byte.MAX_VALUE));
|
||||
if (type.equals("char") || type.equals(Character.class.getName()))
|
||||
return new OpenMBeanParameterInfoSupport("TransParam",
|
||||
"Translated parameter",
|
||||
SimpleType.CHARACTER,
|
||||
null,
|
||||
Character.valueOf(Character.MIN_VALUE),
|
||||
Character.valueOf(Character.MAX_VALUE));
|
||||
if (type.equals("double") || type.equals(Double.class.getName()))
|
||||
return new OpenMBeanParameterInfoSupport("TransParam",
|
||||
"Translated parameter",
|
||||
SimpleType.DOUBLE,
|
||||
null,
|
||||
Double.valueOf(Double.MIN_VALUE),
|
||||
Double.valueOf(Double.MAX_VALUE));
|
||||
if (type.equals("float") || type.equals(Float.class.getName()))
|
||||
return new OpenMBeanParameterInfoSupport("TransParam",
|
||||
"Translated parameter",
|
||||
SimpleType.FLOAT,
|
||||
null,
|
||||
Float.valueOf(Float.MIN_VALUE),
|
||||
Float.valueOf(Float.MAX_VALUE));
|
||||
if (type.equals("int") || type.equals(Integer.class.getName()))
|
||||
return new OpenMBeanParameterInfoSupport("TransParam",
|
||||
"Translated parameter",
|
||||
SimpleType.INTEGER,
|
||||
null,
|
||||
Integer.valueOf(Integer.MIN_VALUE),
|
||||
Integer.valueOf(Integer.MAX_VALUE));
|
||||
if (type.equals("long") || type.equals(Long.class.getName()))
|
||||
return new OpenMBeanParameterInfoSupport("TransParam",
|
||||
"Translated parameter",
|
||||
SimpleType.LONG,
|
||||
null,
|
||||
Long.valueOf(Long.MIN_VALUE),
|
||||
Long.valueOf(Long.MAX_VALUE));
|
||||
if (type.equals("short") || type.equals(Short.class.getName()))
|
||||
return new OpenMBeanParameterInfoSupport("TransParam",
|
||||
"Translated parameter",
|
||||
SimpleType.SHORT,
|
||||
null,
|
||||
Short.valueOf(Short.MIN_VALUE),
|
||||
Short.valueOf(Short.MAX_VALUE));
|
||||
if (type.equals(String.class.getName()))
|
||||
return new OpenMBeanParameterInfoSupport("TransParam",
|
||||
"Translated parameter",
|
||||
SimpleType.STRING);
|
||||
if (type.equals("void"))
|
||||
return new OpenMBeanParameterInfoSupport("TransParam",
|
||||
"Translated parameter",
|
||||
SimpleType.VOID);
|
||||
if (type.startsWith("java.util.Map"))
|
||||
{
|
||||
int lparam = type.indexOf("<");
|
||||
int comma = type.indexOf(",", lparam);
|
||||
int rparam = type.indexOf(">", comma);
|
||||
String key = type.substring(lparam + 1, comma).trim();
|
||||
OpenType k = translate(key).getOpenType();
|
||||
OpenType v = translate(type.substring(comma + 1, rparam).trim()).getOpenType();
|
||||
CompositeType ctype = new CompositeType(Map.class.getName(), Map.class.getName(),
|
||||
new String[] { "key", "value" },
|
||||
new String[] { "Map key", "Map value"},
|
||||
new OpenType[] { k, v});
|
||||
TabularType ttype = new TabularType(key, key, ctype,
|
||||
new String[] { "key" });
|
||||
return new OpenMBeanParameterInfoSupport("TransParam",
|
||||
"Translated parameter",
|
||||
ttype);
|
||||
}
|
||||
if (type.startsWith("java.util.List"))
|
||||
{
|
||||
int lparam = type.indexOf("<");
|
||||
int rparam = type.indexOf(">");
|
||||
OpenType e = translate(type.substring(lparam + 1, rparam).trim()).getOpenType();
|
||||
return new OpenMBeanParameterInfoSupport("TransParam",
|
||||
"Translated parameter",
|
||||
new ArrayType(1, e)
|
||||
);
|
||||
}
|
||||
Class c;
|
||||
try
|
||||
{
|
||||
c = Class.forName(type);
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
throw (InternalError)
|
||||
(new InternalError("The class for a type used in a management bean " +
|
||||
"could not be loaded.").initCause(e));
|
||||
}
|
||||
if (c.isEnum())
|
||||
{
|
||||
Object[] values = c.getEnumConstants();
|
||||
String[] names = new String[values.length];
|
||||
for (int a = 0; a < values.length; ++a)
|
||||
names[a] = values[a].toString();
|
||||
return new OpenMBeanParameterInfoSupport("TransParam",
|
||||
"Translated parameter",
|
||||
SimpleType.STRING,
|
||||
null,
|
||||
(Object[]) names);
|
||||
}
|
||||
try
|
||||
{
|
||||
c.getMethod("from", new Class[] { CompositeData.class });
|
||||
Method[] methods = c.getMethods();
|
||||
List names = new ArrayList();
|
||||
List types = new ArrayList();
|
||||
for (int a = 0; a < methods.length; ++a)
|
||||
{
|
||||
String name = methods[a].getName();
|
||||
if (name.startsWith("get"))
|
||||
{
|
||||
names.add(name.substring(3));
|
||||
types.add(getTypeFromClass(methods[a].getReturnType()));
|
||||
}
|
||||
}
|
||||
String[] fields = (String[]) names.toArray();
|
||||
CompositeType ctype = new CompositeType(c.getName(), c.getName(),
|
||||
fields, fields,
|
||||
(OpenType[]) types.toArray());
|
||||
return new OpenMBeanParameterInfoSupport("TransParam",
|
||||
"Translated parameter",
|
||||
ctype);
|
||||
}
|
||||
catch (NoSuchMethodException e)
|
||||
{
|
||||
/* Ignored; we expect this if this isn't a from(CompositeData) class */
|
||||
}
|
||||
if (c.isArray())
|
||||
{
|
||||
int depth;
|
||||
for (depth = 0; c.getName().charAt(depth) == '['; ++depth);
|
||||
OpenType ot = getTypeFromClass(c.getComponentType());
|
||||
return new OpenMBeanParameterInfoSupport("TransParam",
|
||||
"Translated parameter",
|
||||
new ArrayType(depth, ot)
|
||||
);
|
||||
}
|
||||
throw new InternalError("The type used does not have an open type translation.");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -82,6 +82,11 @@ public final class OperatingSystemMXBeanImpl
|
|||
return System.getProperty("os.name");
|
||||
}
|
||||
|
||||
public double getSystemLoadAverage()
|
||||
{
|
||||
return VMOperatingSystemMXBeanImpl.getSystemLoadAverage();
|
||||
}
|
||||
|
||||
public String getVersion()
|
||||
{
|
||||
return System.getProperty("os.version");
|
||||
|
|
|
@ -83,7 +83,19 @@ public final class ThreadMXBeanImpl
|
|||
*/
|
||||
private static final String TIME_ENABLED =
|
||||
"gnu.java.lang.management.ThreadTimeInitallyEnabled";
|
||||
|
||||
|
||||
/**
|
||||
* Constant for monitor usage monitoring support.
|
||||
*/
|
||||
private static final String MONITOR_SUPPORT =
|
||||
"gnu.java.lang.management.MonitorUsageMonitoringSupport";
|
||||
|
||||
/**
|
||||
* Constant for ownable synchronizer usage monitoring support.
|
||||
*/
|
||||
private static final String SYNCHRONIZER_SUPPORT =
|
||||
"gnu.java.lang.management.OwnableSynchronizerUsageMonitoringSupport";
|
||||
|
||||
/**
|
||||
* Flag to indicate whether time monitoring is enabled or not.
|
||||
*/
|
||||
|
@ -112,6 +124,23 @@ public final class ThreadMXBeanImpl
|
|||
contentionEnabled = false;
|
||||
}
|
||||
|
||||
public ThreadInfo[] dumpAllThreads(boolean lockedMonitors,
|
||||
boolean lockedSynchronizers)
|
||||
{
|
||||
return getThreadInfo(getAllThreadIds(), lockedMonitors,
|
||||
lockedSynchronizers);
|
||||
}
|
||||
|
||||
public long[] findDeadlockedThreads()
|
||||
{
|
||||
checkMonitorPermissions();
|
||||
if (!isSynchronizerUsageSupported())
|
||||
throw new UnsupportedOperationException("Ownable synchronizer usage " +
|
||||
"monitoring is not provided " +
|
||||
"by this VM.");
|
||||
return VMThreadMXBeanImpl.findDeadlockedThreads();
|
||||
}
|
||||
|
||||
public long[] findMonitorDeadlockedThreads()
|
||||
{
|
||||
checkMonitorPermissions();
|
||||
|
@ -207,6 +236,27 @@ public final class ThreadMXBeanImpl
|
|||
return infos;
|
||||
}
|
||||
|
||||
public ThreadInfo[] getThreadInfo(long[] ids, boolean lockedMonitors,
|
||||
boolean lockedSynchronizers)
|
||||
{
|
||||
checkMonitorPermissions();
|
||||
if (lockedMonitors && !isObjectMonitorUsageSupported())
|
||||
throw new UnsupportedOperationException("Monitor usage monitoring is " +
|
||||
"not provided by this VM.");
|
||||
if (lockedSynchronizers && !isSynchronizerUsageSupported())
|
||||
throw new UnsupportedOperationException("Ownable synchronizer usage " +
|
||||
"monitoring is not provided " +
|
||||
"by this VM.");
|
||||
ThreadInfo[] infos = getThreadInfo(ids, Integer.MAX_VALUE);
|
||||
if (lockedMonitors)
|
||||
for (ThreadInfo info : infos)
|
||||
VMThreadMXBeanImpl.getMonitorInfo(info);
|
||||
if (lockedSynchronizers)
|
||||
for (ThreadInfo info : infos)
|
||||
VMThreadMXBeanImpl.getLockInfo(info);
|
||||
return infos;
|
||||
}
|
||||
|
||||
public long getThreadUserTime(long id)
|
||||
{
|
||||
if (!isThreadCpuTimeSupported())
|
||||
|
@ -231,6 +281,16 @@ public final class ThreadMXBeanImpl
|
|||
return SystemProperties.getProperty(CURRENT_THREAD_TIME_SUPPORT) != null;
|
||||
}
|
||||
|
||||
public boolean isObjectMonitorUsageSupported()
|
||||
{
|
||||
return SystemProperties.getProperty(MONITOR_SUPPORT) != null;
|
||||
}
|
||||
|
||||
public boolean isSynchronizerUsageSupported()
|
||||
{
|
||||
return SystemProperties.getProperty(SYNCHRONIZER_SUPPORT) != null;
|
||||
}
|
||||
|
||||
public boolean isThreadContentionMonitoringEnabled()
|
||||
{
|
||||
if (isThreadContentionMonitoringSupported())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue