[ecj+jmx] FYI: Additions to build generics import of 2006/07/09.
Andrew John Hughes
gnu_andrew@member.fsf.org
Sun Jul 23 20:58:00 GMT 2006
This patch adds various files and updates some autogenerated
ones in order to progress further in building the branch.
Currently, it's stuck on PR#28458.
Changelog:
2006-07-23 Andrew John Hughes <gnu_andrew@member.fsf.org>
* libjava/Makefile.in:
Regenerated.
* libjava/scripts/classes.pl:
Ignore .svn directories.
* libjava/scripts/makemake.tcl:
Include sun directory.
* libjava/gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
* libjava/gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
* libjava/gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
* libjava/gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
* libjava/gnu/java/lang/management/VMThreadMXBeanImpl.java,
* libjava/gnu/java/lang/management/VMMemoryMXBeanImpl.java,
* libjava/gnu/java/lang/management/VMCompilationMXBeanImpl.java,
* libjava/gnu/java/nio/VMChannel.java:
Copied over from classpath/vm/reference.
* libjava/gnu/java/nio/channels/FileChannelImpl.java:
(getNativeFD()): Implemented.
* libjava/gcj/javaprims.h:
Updated for generics merge from 20060709.
* libjava/javax/naming/spi/NamingManager.java:
Copied over from classpath/vm/reference.
* libjava/sources.am:
Regenerated.
* libjava/java/lang/Thread.java:
(getId()): Implemented.
(getState()): Likewise.
(getAllStackTraces()): Likewise.
(getStackTrace()): Likewise.
* libjava/java/lang/management/VMManagementFactory.java,
* libjava/java/net/VMURLConnection.java:
Copied over from classpath/vm/reference.
* libjava/classpath/vm/reference/java/lang/management/VMThreadInfo.java:
Removed.
* libjava/classpath/native/fdlibm/namespace.h:
Changed back to GCJ LOCAL version.
* libjava/sun/reflect/Reflection.java,
* libjava/sun/reflect/misc/ReflectUtil.java,
* libjava/sun/misc/Unsafe.java:
Copied over from classpath/vm/reference.
--
Andrew :-)
Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html
public class gcj extends Freedom implements Java { ... }
-------------- next part --------------
Index: libjava/Makefile.in
===================================================================
--- libjava/Makefile.in (revision 115486)
+++ libjava/Makefile.in (working copy)
@@ -246,7 +246,8 @@ am__DEPENDENCIES_1 = gnu/awt.lo gnu/awt/
javax/swing/text/html.lo javax/swing/text/html/parser.lo \
javax/swing/text/rtf.lo javax/swing/tree.lo \
javax/swing/undo.lo javax/transaction.lo \
- javax/transaction/xa.lo org/ietf/jgss.lo
+ javax/transaction/xa.lo org/ietf/jgss.lo sun/misc.lo \
+ sun/reflect.lo sun/reflect/annotation.lo sun/reflect/misc.lo
am__DEPENDENCIES_2 = gnu-CORBA.lo gnu-java-awt-peer-gtk.lo \
gnu-java-awt-peer-swing.lo gnu-java-beans.lo gnu-javax-rmi.lo \
gnu-javax-sound-midi.lo gnu-xml.lo javax-imageio.lo \
@@ -1588,7 +1589,14 @@ classpath/gnu/java/lang/management/Memor
classpath/gnu/java/lang/management/OperatingSystemMXBeanImpl.java \
classpath/gnu/java/lang/management/RuntimeMXBeanImpl.java \
classpath/gnu/java/lang/management/ThreadMXBeanImpl.java \
-gnu/java/lang/management/VMRuntimeMXBeanImpl.java
+gnu/java/lang/management/VMClassLoadingMXBeanImpl.java \
+gnu/java/lang/management/VMCompilationMXBeanImpl.java \
+gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java \
+gnu/java/lang/management/VMMemoryMXBeanImpl.java \
+gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java \
+gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java \
+gnu/java/lang/management/VMRuntimeMXBeanImpl.java \
+gnu/java/lang/management/VMThreadMXBeanImpl.java
gnu_java_lang_management_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_lang_management_source_files)))
gnu_java_lang_reflect_source_files = \
@@ -1870,6 +1878,7 @@ gnu/java/nio/ServerSocketChannelSelectio
gnu/java/nio/SocketChannelImpl.java \
gnu/java/nio/SocketChannelSelectionKey.java \
classpath/gnu/java/nio/SocketChannelSelectionKeyImpl.java \
+gnu/java/nio/VMChannel.java \
gnu/java/nio/VMPipe.java \
gnu/java/nio/VMSelector.java
@@ -4031,7 +4040,8 @@ classpath/java/lang/management/MemoryUsa
classpath/java/lang/management/OperatingSystemMXBean.java \
classpath/java/lang/management/RuntimeMXBean.java \
classpath/java/lang/management/ThreadInfo.java \
-classpath/java/lang/management/ThreadMXBean.java
+classpath/java/lang/management/ThreadMXBean.java \
+java/lang/management/VMManagementFactory.java
java_lang_management_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(java_lang_management_source_files)))
java_lang_ref_source_files = \
@@ -4122,7 +4132,8 @@ classpath/java/net/URLStreamHandler.java
classpath/java/net/URLStreamHandlerFactory.java \
classpath/java/net/UnknownHostException.java \
classpath/java/net/UnknownServiceException.java \
-java/net/VMNetworkInterface.java
+java/net/VMNetworkInterface.java \
+java/net/VMURLConnection.java
java_net_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(java_net_source_files)))
java_nio_source_files = \
@@ -4938,7 +4949,7 @@ classpath/javax/naming/spi/DirStateFacto
classpath/javax/naming/spi/DirectoryManager.java \
classpath/javax/naming/spi/InitialContextFactory.java \
classpath/javax/naming/spi/InitialContextFactoryBuilder.java \
-classpath/javax/naming/spi/NamingManager.java \
+javax/naming/spi/NamingManager.java \
classpath/javax/naming/spi/ObjectFactory.java \
classpath/javax/naming/spi/ObjectFactoryBuilder.java \
classpath/javax/naming/spi/ResolveResult.java \
@@ -6709,6 +6720,22 @@ classpath/external/sax/org/xml/sax/helpe
classpath/external/sax/org/xml/sax/helpers/XMLReaderAdapter.java \
classpath/external/sax/org/xml/sax/helpers/XMLReaderFactory.java
+sun_misc_source_files = \
+sun/misc/Unsafe.java
+
+sun_misc_header_files = $(patsubst %.java,%.h,$(sun_misc_source_files))
+sun_reflect_source_files = \
+sun/reflect/Reflection.java
+
+sun_reflect_header_files = $(patsubst %.java,%.h,$(sun_reflect_source_files))
+sun_reflect_annotation_source_files = \
+classpath/sun/reflect/annotation/AnnotationInvocationHandler.java
+
+sun_reflect_annotation_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(sun_reflect_annotation_source_files)))
+sun_reflect_misc_source_files = \
+sun/reflect/misc/ReflectUtil.java
+
+sun_reflect_misc_header_files = $(patsubst %.java,%.h,$(sun_reflect_misc_source_files))
all_packages_source_files = \
gnu/awt.list \
gnu/awt/j2d.list \
@@ -6938,7 +6965,11 @@ all_packages_source_files = \
javax/swing/undo.list \
javax/transaction.list \
javax/transaction/xa.list \
- org/ietf/jgss.list
+ org/ietf/jgss.list \
+ sun/misc.list \
+ sun/reflect.list \
+ sun/reflect/annotation.list \
+ sun/reflect/misc.list
ordinary_header_files = \
$(gnu_awt_header_files) \
@@ -7170,7 +7201,11 @@ ordinary_header_files = \
$(javax_swing_undo_header_files) \
$(javax_transaction_header_files) \
$(javax_transaction_xa_header_files) \
- $(org_ietf_jgss_header_files)
+ $(org_ietf_jgss_header_files) \
+ $(sun_misc_header_files) \
+ $(sun_reflect_header_files) \
+ $(sun_reflect_annotation_header_files) \
+ $(sun_reflect_misc_header_files)
bc_objects = \
gnu-CORBA.lo \
@@ -10472,6 +10507,30 @@ org-xml.lo: $(org_xml_source_files)
$(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o org-xml.lo @org-xml.list
@rm -f org-xml.list
+sun/misc.list: $(sun_misc_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ echo classpath/lib/sun/misc/*.class > sun/misc.list
+
+-include sun/misc.deps
+
+sun/reflect.list: $(sun_reflect_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ echo classpath/lib/sun/reflect/*.class > sun/reflect.list
+
+-include sun/reflect.deps
+
+sun/reflect/annotation.list: $(sun_reflect_annotation_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ echo classpath/lib/sun/reflect/annotation/*.class > sun/reflect/annotation.list
+
+-include sun/reflect/annotation.deps
+
+sun/reflect/misc.list: $(sun_reflect_misc_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ echo classpath/lib/sun/reflect/misc/*.class > sun/reflect/misc.list
+
+-include sun/reflect/misc.deps
+
$(generic_header_files):
$(MYGCJH) --cni --all classpath/lib --cmdfile=$(srcdir)/headers.txt
Index: libjava/scripts/classes.pl
===================================================================
--- libjava/scripts/classes.pl (revision 115472)
+++ libjava/scripts/classes.pl (working copy)
@@ -44,6 +44,7 @@ sub scan
while (defined ($name = $d->read))
{
next if $name eq 'CVS';
+ next if $name eq '.svn';
next if $name eq '.';
next if $name eq '..';
if ($dir eq 'java'
Index: libjava/scripts/makemake.tcl
===================================================================
--- libjava/scripts/makemake.tcl (revision 115472)
+++ libjava/scripts/makemake.tcl (working copy)
@@ -214,7 +214,7 @@ proc scan_directory {basedir subdir} {
# Scan known packages beneath the base directory for .java source
# files.
proc scan_packages {basedir} {
- foreach subdir {gnu java javax org META-INF} {
+ foreach subdir {gnu java javax org sun META-INF} {
if {[file exists $basedir/$subdir]} {
scan_directory $basedir $subdir
}
Index: libjava/gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java
===================================================================
--- libjava/gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java (revision 0)
+++ libjava/gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java (revision 0)
@@ -0,0 +1,80 @@
+/* VMGarbageCollectorMXBeanImpl.java - VM interface for a GC bean
+ Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.java.lang.management;
+
+/**
+ * Provides access to information about the garbage collectors
+ * of the virtual machine. Garbage collectors are responsible
+ * for removing unreferenced objects from memory. A garbage
+ * collector is a type of memory manager, so this interface
+ * is combined with that of generic memory managers. An instance
+ * of this bean for each garbage collector is obtained by calling
+ * {@link ManagementFactory#getGarbageCollectorMXBeans()}.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.5
+ */
+final class VMGarbageCollectorMXBeanImpl
+{
+
+ /**
+ * Returns the number of collections the garbage collector
+ * represented by this bean has made. -1 is returned if the
+ * collection count is undefined.
+ *
+ * @param name the name of the garbage collector.
+ * @return the number of collections made, or -1 if this is
+ * undefined.
+ */
+ static native long getCollectionCount(String name);
+
+ /**
+ * Returns the accumulated number of milliseconds this garbage
+ * collector has spent freeing the memory used by unreferenced
+ * objects. -1 is returned if the collection time is undefined.
+ * Note that the accumulated time may not change, even when the
+ * collection count increases, if the time taken is sufficiently
+ * short; this depends on the resolution of the timer used.
+ *
+ * @param name the name of the garbage collector.
+ * @return the accumulated number of milliseconds spent collecting,
+ * or -1 if this is undefined.
+ */
+ static native long getCollectionTime(String name);
+
+}
Index: libjava/gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java
===================================================================
--- libjava/gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java (revision 0)
+++ libjava/gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java (revision 0)
@@ -0,0 +1,186 @@
+/* MemoryPoolMXBeanImpl.java - VM interface for memory pool beans
+ Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.java.lang.management;
+
+import java.lang.management.MemoryUsage;
+
+/**
+ * Provides access to information on the memory resources or
+ * pools used by the current invocation of the virtual machine.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.5
+ */
+final class VMMemoryPoolMXBeanImpl
+{
+
+ /**
+ * Returns memory usage statistics for the specified pool
+ * just after a best-effort attempt to free memory. This
+ * is valid only for certain garbage collectors.
+ *
+ * @param name the name of the pool to obtain statistics on.
+ * @return a {@link java.lang.management.MemoryUsage} object
+ * containing the statistics or <code>null</code>
+ * if this pool does not support such statistics.
+ */
+ static native MemoryUsage getCollectionUsage(String name);
+
+ /**
+ * Returns the collection usage threshold for the specified pool.
+ * This is only called if this functionality is supported
+ * by the virtual machine (i.e. the appropriate property,
+ * <code>gnu.java.lang.management.CollectionUsageThresholdSupport</code>,
+ * is defined). The value is initially zero.
+ *
+ * @param name the name of the pool to obtain statistics on.
+ * @return the collection usage threshold.
+ */
+ static native long getCollectionUsageThreshold(String name);
+
+ /**
+ * Returns the number of times the collection usage threshold
+ * has been met or exceeded by the specified pool.
+ * This is only called if this functionality is supported
+ * by the virtual machine (i.e. the appropriate property,
+ * <code>gnu.java.lang.management.CollectionUsageThresholdSupport</code>,
+ * is defined).
+ *
+ * @param name the name of the pool to obtain statistics on.
+ * @return the collection usage threshold count.
+ */
+ static native long getCollectionUsageThresholdCount(String name);
+
+ /**
+ * Returns an array of names of memory managers which manage
+ * the specified pool.
+ *
+ * @param name the name of the pool to obtain statistics on.
+ * @return a list of memory managers for the pool.
+ */
+ static native String[] getMemoryManagerNames(String name);
+
+ /**
+ * Returns the peak usage level of the specified pool.
+ * This is only called if the pool is valid.
+ *
+ * @param name the name of the pool to obtain statistics on.
+ * @return a {@link java.lang.management.MemoryUsage} object
+ * containing the statistics.
+ */
+ static native MemoryUsage getPeakUsage(String name);
+
+ /**
+ * Returns the current usage level of the specified pool.
+ * This is only called if the pool is valid.
+ *
+ * @param name the name of the pool to obtain statistics on.
+ * @return a {@link java.lang.management.MemoryUsage} object
+ * containing the statistics.
+ */
+ static native MemoryUsage getUsage(String name);
+
+ /**
+ * Returns the usage threshold for the specified pool.
+ * This is only called if this functionality is supported
+ * by the virtual machine (i.e. the appropriate property,
+ * <code>gnu.java.lang.management.UsageThresholdSupport</code>,
+ * is defined). The value is initially defined by the
+ * virtual machine.
+ *
+ * @param name the name of the pool to obtain statistics on.
+ * @return the usage threshold.
+ */
+ static native long getUsageThreshold(String name);
+
+ /**
+ * Returns the number of times the usage threshold
+ * has been met or exceeded by the specified pool.
+ * This is only called if this functionality is supported
+ * by the virtual machine (i.e. the appropriate property,
+ * <code>gnu.java.lang.management.UsageThresholdSupport</code>,
+ * is defined).
+ *
+ * @param name the name of the pool to obtain statistics on.
+ * @return the usage threshold count.
+ */
+ static native long getUsageThresholdCount(String name);
+
+ /**
+ * Returns true if the specified pool is still valid i.e.
+ * it is still in use by the virtual machine.
+ *
+ * @param name the name of the pool to check the validity of.
+ * @return true if the pool is valid.
+ */
+ static native boolean isValid(String name);
+
+ /**
+ * Resets the peak usage level to the current usage level for
+ * the specified pool.
+ *
+ * @param name the name of the pool to reset the peak usage of.
+ */
+ static native void resetPeakUsage(String name);
+
+ /**
+ * Sets the collection usage threshold for the specified
+ * pool to the supplied value.
+ * This is only called if this functionality is supported
+ * by the virtual machine (i.e. the appropriate property,
+ * <code>gnu.java.lang.management.CollectionUsageThresholdSupport</code>,
+ * is defined).
+ *
+ * @param name the name of the pool to set the threshold of.
+ * @param threshold the new threshold level.
+ */
+ static native void setCollectionUsageThreshold(String name, long threshold);
+
+ /**
+ * Sets the usage threshold for the specified pool to the supplied value.
+ * This is only called if this functionality is supported
+ * by the virtual machine (i.e. the appropriate property,
+ * <code>gnu.java.lang.management.UsageThresholdSupport</code>,
+ * is defined).
+ *
+ * @param name the name of the pool to set the threshold of.
+ * @param threshold the new threshold level.
+ */
+ static native void setUsageThreshold(String name, long threshold);
+
+}
Index: libjava/gnu/java/lang/management/VMClassLoadingMXBeanImpl.java
===================================================================
--- libjava/gnu/java/lang/management/VMClassLoadingMXBeanImpl.java (revision 0)
+++ libjava/gnu/java/lang/management/VMClassLoadingMXBeanImpl.java (revision 0)
@@ -0,0 +1,89 @@
+/* VMClassLoadingMXBeanImpl.java - VM impl. of a class loading bean
+ Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.java.lang.management;
+
+/**
+ * Provides access to information about the class loading
+ * behaviour of the current invocation of the virtual
+ * machine. Instances of this bean are obtained by calling
+ * {@link ManagementFactory#getClassLoadingMXBean()}.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.5
+ */
+final class VMClassLoadingMXBeanImpl
+{
+
+ /**
+ * Returns the number of classes currently loaded by
+ * the virtual machine.
+ *
+ * @return the number of loaded classes.
+ */
+ static native int getLoadedClassCount();
+
+ /**
+ * Returns the number of classes that have been unloaded
+ * by the virtual machine since it was started.
+ *
+ * @return the number of unloaded classes.
+ */
+ static native long getUnloadedClassCount();
+
+ /**
+ * Returns true if the virtual machine will emit additional
+ * information when classes are loaded and unloaded. The
+ * format of the output is left up to the virtual machine.
+ *
+ * @return true if verbose class loading output is on.
+ */
+ static native boolean isVerbose();
+
+ /**
+ * Turns on or off the emission of additional information
+ * when classes are loaded and unloaded. The format of the
+ * output is left up to the virtual machine. This method
+ * may be called by multiple threads concurrently, but there
+ * is only one global setting of verbosity that is affected.
+ *
+ * @param verbose the new setting for verbose class loading
+ * output.
+ */
+ static native void setVerbose(boolean verbose);
+
+}
Index: libjava/gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java
===================================================================
--- libjava/gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java (revision 0)
+++ libjava/gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java (revision 0)
@@ -0,0 +1,95 @@
+/* VMMemoryManagerMXBeanImpl.java - VM interface for a memory manager bean
+ Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.java.lang.management;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryPoolMXBean;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Provides access to information about the memory managers
+ * of the virtual machine. An instance of this bean for each
+ * memory manager is obtained by calling
+ * {@link ManagementFactory#getMemoryManagerMXBeans()}.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.5
+ */
+final class VMMemoryManagerMXBeanImpl
+{
+
+ /**
+ * Returns an array containing the names of the memory pools
+ * this memory manager manages.
+ *
+ * @param name the name of the memory manager.
+ * @return an array containing the name of each memory pool
+ * this manager is responsible for.
+ */
+ static String[] getMemoryPoolNames(String name)
+ {
+ List managedPools = new ArrayList();
+ Iterator beans = ManagementFactory.getMemoryPoolMXBeans().iterator();
+ while (beans.hasNext())
+ {
+ MemoryPoolMXBean bean = (MemoryPoolMXBean) beans.next();
+ String[] managers = bean.getMemoryManagerNames();
+ for (int a = 0; a < managers.length; ++a)
+ if (managers[a].equals(name))
+ {
+ managedPools.add(bean.getName());
+ break;
+ }
+ }
+ return (String[]) managedPools.toArray(new String[managedPools.size()]);
+ }
+
+ /**
+ * Returns true if this memory manager is still valid. A memory
+ * manager becomes invalid when it is removed by the virtual machine
+ * and no longer used.
+ *
+ * @param name the name of the memory manager.
+ * @return true if this memory manager is valid.
+ */
+ static native boolean isValid(String name);
+
+}
Index: libjava/gnu/java/lang/management/VMThreadMXBeanImpl.java
===================================================================
--- libjava/gnu/java/lang/management/VMThreadMXBeanImpl.java (revision 0)
+++ libjava/gnu/java/lang/management/VMThreadMXBeanImpl.java (revision 0)
@@ -0,0 +1,207 @@
+/* VMThreadMXBeanImpl.java - VM impl. of a thread bean
+ Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.java.lang.management;
+
+import java.lang.management.ThreadInfo;
+
+/**
+ * Provides access to information about the threads
+ * of the virtual machine. An instance of this bean is
+ * obtained by calling
+ * {@link ManagementFactory#getThreadMXBean()}.
+ * See {@link java.lang.management.ThreadMXBean} for
+ * full documentation.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.5
+ */
+final class VMThreadMXBeanImpl
+{
+
+ /**
+ * Cache of how many threads were found.
+ */
+ private static int filled;
+
+ /**
+ * Returns the ids of cycles of deadlocked threads, occurring
+ * due to monitor ownership.
+ *
+ * @return the ids of the deadlocked threads.
+ */
+ static native long[] findMonitorDeadlockedThreads();
+
+ /* This is the same as in Thread.getAllStackTraces() */
+ static Thread[] getAllThreads()
+ {
+ ThreadGroup group = Thread.currentThread().getThreadGroup();
+ while (group.getParent() != null)
+ group = group.getParent();
+ int arraySize = group.activeCount();
+ Thread[] threadList = new Thread[arraySize];
+ filled = group.enumerate(threadList);
+ while (filled == arraySize)
+ {
+ arraySize *= 2;
+ threadList = new Thread[arraySize];
+ filled = group.enumerate(threadList);
+ }
+ return threadList;
+ }
+
+ /**
+ * Returns the id of all live threads at the time of execution.
+ *
+ * @return the live thread ids.
+ */
+ static long[] getAllThreadIds()
+ {
+ Thread[] threadList = getAllThreads();
+ long[] ids = new long[filled];
+ for (int a = 0; a < filled; ++a)
+ ids[a] = threadList[a].getId();
+ return ids;
+ }
+
+ /**
+ * Returns the number of nanoseconds of CPU time
+ * the current thread has used in total. This is
+ * only called if this feature is enabled and
+ * supported.
+ *
+ * @return the nanoseconds of CPU time used by
+ * the current thread.
+ */
+ static native long getCurrentThreadCpuTime();
+
+ /**
+ * Returns the number of nanoseconds of user time
+ * the current thread has used in total. This is
+ * only called if this feature is enabled and
+ * supported.
+ *
+ * @return the nanoseconds of user time used by
+ * the current thread.
+ */
+ static native long getCurrentThreadUserTime();
+
+ /**
+ * Returns the number of live daemon threads.
+ *
+ * @return the number of live daemon threads.
+ */
+ static int getDaemonThreadCount()
+ {
+ Thread[] threadList = getAllThreads();
+ int daemonCount = 0;
+ for (int a = 0; a < filled; ++a)
+ {
+ if (threadList[a].isDaemon())
+ ++daemonCount;
+ }
+ return daemonCount;
+ }
+
+ /**
+ * Returns the current peak number of live threads.
+ *
+ * @return the peak number of live threads.
+ */
+ static native int getPeakThreadCount();
+
+ /**
+ * Returns the number of live threads.
+ *
+ * @return the number of live threads.
+ */
+ static int getThreadCount()
+ {
+ getAllThreads();
+ return filled;
+ }
+
+ /**
+ * Returns the number of nanoseconds of CPU time
+ * the specified thread has used in total. This is
+ * only called if this feature is enabled and
+ * supported.
+ *
+ * @param id the thread to obtain statistics on.
+ * @return the nanoseconds of CPU time used by
+ * the thread.
+ */
+ static native long getThreadCpuTime(long id);
+
+ /**
+ * Returns the {@link java.lang.management.ThreadInfo}
+ * which corresponds to the specified id.
+ *
+ * @param id the id of the thread.
+ * @param maxDepth the depth of the stack trace.
+ * @return the corresponding <code>ThreadInfo</code>.
+ */
+ static native ThreadInfo getThreadInfoForId(long id, int maxDepth);
+
+ /**
+ * Returns the number of nanoseconds of user time
+ * the specified thread has used in total. This is
+ * only called if this feature is enabled and
+ * supported.
+ *
+ * @param id the thread to obtain statistics on.
+ * @return the nanoseconds of user time used by
+ * the thread.
+ */
+ static native long getThreadUserTime(long id);
+
+ /**
+ * Returns the total number of threads that have
+ * been started over the lifetime of the virtual
+ * machine.
+ *
+ * @return the total number of threads started.
+ */
+ static native long getTotalStartedThreadCount();
+
+ /**
+ * Resets the peak thread count to the current
+ * number of live threads.
+ */
+ static native void resetPeakThreadCount();
+
+}
Index: libjava/gnu/java/lang/management/VMMemoryMXBeanImpl.java
===================================================================
--- libjava/gnu/java/lang/management/VMMemoryMXBeanImpl.java (revision 0)
+++ libjava/gnu/java/lang/management/VMMemoryMXBeanImpl.java (revision 0)
@@ -0,0 +1,109 @@
+/* VMMemoryMXBeanImpl.java - VM impl. of a memory bean
+ Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.java.lang.management;
+
+import java.lang.management.MemoryUsage;
+
+/**
+ * Provides access to information about the memory
+ * management of the current invocation of the virtual
+ * machine. Instances of this bean are obtained by calling
+ * {@link ManagementFactory#getMemoryMXBean()}.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.5
+ */
+final class VMMemoryMXBeanImpl
+{
+
+ /**
+ * Returns an instance of {@link java.lang.management.MemoryUsage}
+ * with appropriate initial, used, committed and maximum values
+ * for the heap. By default, this uses the methods of
+ * {@link java.lang.Runtime} to provide some of the values.
+ *
+ * @return an {@link java.lang.management.MemoryUsage} instance
+ * for the heap.
+ */
+ static MemoryUsage getHeapMemoryUsage()
+ {
+ Runtime runtime = Runtime.getRuntime();
+ long totalMem = runtime.totalMemory();
+ return new MemoryUsage(-1, totalMem - runtime.freeMemory(),
+ totalMem, runtime.maxMemory());
+ }
+
+ /**
+ * Returns an instance of {@link java.lang.management.MemoryUsage}
+ * with appropriate initial, used, committed and maximum values
+ * for non-heap memory.
+ *
+ * @return an {@link java.lang.management.MemoryUsage} instance
+ * for non-heap memory.
+ */
+ static native MemoryUsage getNonHeapMemoryUsage();
+
+ /**
+ * Returns the number of objects ready to be garbage collected.
+ *
+ * @return the number of finalizable objects.
+ */
+ static native int getObjectPendingFinalizationCount();
+
+ /**
+ * Returns true if the virtual machine will emit additional
+ * information when memory is allocated and deallocated. The
+ * format of the output is left up to the virtual machine.
+ *
+ * @return true if verbose class loading output is on.
+ */
+ static native boolean isVerbose();
+
+ /**
+ * Turns on or off the emission of additional information
+ * when memory is allocated and deallocated. The format of the
+ * output is left up to the virtual machine. This method
+ * may be called by multiple threads concurrently, but there
+ * is only one global setting of verbosity that is affected.
+ *
+ * @param verbose the new setting for verbose class loading
+ * output.
+ */
+ static native void setVerbose(boolean verbose);
+
+}
Index: libjava/gnu/java/lang/management/VMCompilationMXBeanImpl.java
===================================================================
--- libjava/gnu/java/lang/management/VMCompilationMXBeanImpl.java (revision 0)
+++ libjava/gnu/java/lang/management/VMCompilationMXBeanImpl.java (revision 0)
@@ -0,0 +1,66 @@
+/* VMCompilationMXBeanImpl.java - VM implementation of a compilation bean
+ Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.java.lang.management;
+
+/**
+ * Provides access to information about the JIT
+ * compiler of the virtual machine, if one exists.
+ * Instances of this bean are obtained by calling
+ * {@link ManagementFactory#getCompilationMXBean()},
+ * if this is the case.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.5
+ */
+final class VMCompilationMXBeanImpl
+{
+
+ /**
+ * Returns the number of milliseconds the JIT
+ * compiler has spent compiling Java bytecode
+ * to native machine code. This is only called
+ * if a JIT compiler exists and the
+ * gnu.java.lang.management.CompilationTimeSupport
+ * property has been set.
+ *
+ * @return the number of milliseconds spent
+ * compiling.
+ */
+ static native long getTotalCompilationTime();
+
+}
Index: libjava/gnu/java/nio/VMChannel.java
===================================================================
--- libjava/gnu/java/nio/VMChannel.java (revision 0)
+++ libjava/gnu/java/nio/VMChannel.java (revision 0)
@@ -0,0 +1,197 @@
+/* VMChannel.java -- Native interface suppling channel operations.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.nio;
+
+import gnu.classpath.Configuration;
+import gnu.java.net.PlainSocketImpl;
+import gnu.java.nio.PipeImpl.SinkChannelImpl;
+import gnu.java.nio.PipeImpl.SourceChannelImpl;
+import gnu.java.nio.channels.FileChannelImpl;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+/**
+ * Native interface to support configuring of channel to run in a non-blocking
+ * manner and support scatter/gather io operations.
+ *
+ * @author Michael Barker <mike@middlesoft.co.uk>
+ *
+ */
+public class VMChannel
+{
+ private final int fd;
+
+ private VMChannel(int fd)
+ {
+ this.fd = fd;
+ }
+
+ public static VMChannel getVMChannel(PlainSocketImpl socket)
+ {
+ return new VMChannel(socket.getNativeFD());
+ }
+
+ public static VMChannel getVMChannel(SourceChannelImpl source)
+ {
+ return new VMChannel(source.getNativeFD());
+ }
+
+ public static VMChannel getVMChannel(SinkChannelImpl sink)
+ {
+ return new VMChannel(sink.getNativeFD());
+ }
+
+ public static VMChannel getVMChannel(FileChannelImpl file)
+ {
+ return new VMChannel(file.getNativeFD());
+ }
+
+ static
+ {
+ // load the shared library needed for native methods.
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary ("javanio");
+ }
+ initIDs();
+ }
+
+ /**
+ * Set the file descriptor to have the required blocking
+ * setting.
+ *
+ * @param fd
+ * @param blocking
+ */
+ public native void setBlocking(int fd, boolean blocking);
+
+ public void setBlocking(boolean blocking)
+ {
+ setBlocking(fd, blocking);
+ }
+
+
+ /**
+ * Reads a byte buffer directly using the supplied file descriptor.
+ * Assumes that the buffer is a DirectBuffer.
+ *
+ * @param fd Native file descriptor to read from.
+ * @param dst Direct Byte Buffer to read to.
+ * @return Number of bytes read.
+ * @throws IOException If an error occurs or dst is not a direct buffers.
+ */
+ native int read(int fd, ByteBuffer dst)
+ throws IOException;
+
+ public int read(ByteBuffer dst)
+ throws IOException
+ {
+ return read(fd, dst);
+ }
+
+ /**
+ * Reads into byte buffers directly using the supplied file descriptor.
+ * Assumes that the buffer list contains DirectBuffers. Will perform a
+ * scattering read.
+ *
+ * @param fd Native file descriptor to read from.
+ * @param dsts An array direct byte buffers.
+ * @param offset Index of the first buffer to read to.
+ * @param length The number of buffers to read to.
+ * @return Number of bytes read.
+ * @throws IOException If an error occurs or the dsts are not direct buffers.
+ */
+ native long readScattering(int fd, ByteBuffer[] dsts, int offset, int length)
+ throws IOException;
+
+ public long readScattering(ByteBuffer[] dsts, int offset, int length)
+ throws IOException
+ {
+ if (offset + length > dsts.length)
+ throw new IndexOutOfBoundsException("offset + length > dsts.length");
+
+ return readScattering(fd, dsts, offset, length);
+ }
+
+ /**
+ * Writes from a direct byte bufer using the supplied file descriptor.
+ * Assumes the buffer is a DirectBuffer.
+ *
+ * @param fd
+ * @param src
+ * @return Number of bytes written.
+ * @throws IOException
+ */
+ native int write(int fd, ByteBuffer src)
+ throws IOException;
+
+ public int write(ByteBuffer src)
+ throws IOException
+ {
+ return write(fd, src);
+ }
+
+ /**
+ * Writes from byte buffers directly using the supplied file descriptor.
+ * Assumes the that buffer list constains DirectBuffers. Will perform
+ * as gathering write.
+ *
+ * @param fd
+ * @param srcs
+ * @param offset
+ * @param length
+ * @return Number of bytes written.
+ * @throws IOException
+ */
+ native long writeGathering(int fd, ByteBuffer[] srcs, int offset, int length)
+ throws IOException;
+
+ public long writeGathering(ByteBuffer[] srcs, int offset, int length)
+ throws IOException
+ {
+ if (offset + length > srcs.length)
+ throw new IndexOutOfBoundsException("offset + length > srcs.length");
+
+ return writeGathering(fd, srcs, offset, length);
+ }
+
+ private native static void initIDs();
+
+}
Index: libjava/gnu/java/nio/channels/FileChannelImpl.java
===================================================================
--- libjava/gnu/java/nio/channels/FileChannelImpl.java (revision 115472)
+++ libjava/gnu/java/nio/channels/FileChannelImpl.java (working copy)
@@ -533,4 +533,13 @@ public final class FileChannelImpl exten
return this;
}
+
+ /**
+ * @return The native file descriptor.
+ */
+ public int getNativeFD()
+ {
+ return fd;
+ }
+
}
Index: libjava/gcj/javaprims.h
===================================================================
--- libjava/gcj/javaprims.h (revision 115472)
+++ libjava/gcj/javaprims.h (working copy)
@@ -165,6 +165,7 @@ extern "Java"
class ConcreteProcess;
class ConcreteProcess$EOFInputStream;
class ConcreteProcess$ProcessManager;
+ class Deprecated;
class Double;
class Enum;
class EnumConstantNotPresentException;
@@ -201,8 +202,10 @@ extern "Java"
class NumberFormatException;
class Object;
class OutOfMemoryError;
+ class Override;
class Package;
class Process;
+ class ProcessBuilder;
class Readable;
class Runnable;
class Runtime;
@@ -220,8 +223,13 @@ extern "Java"
class StringBuffer;
class StringBuilder;
class StringIndexOutOfBoundsException;
+ class SuppressWarnings;
class System;
+ class System$EnvironmentCollection;
+ class System$EnvironmentMap;
+ class System$EnvironmentSet;
class Thread;
+ class Thread$State;
class Thread$UncaughtExceptionHandler;
class ThreadDeath;
class ThreadGroup;
@@ -247,6 +255,13 @@ extern "Java"
class Annotation;
class AnnotationFormatError;
class AnnotationTypeMismatchException;
+ class Documented;
+ class ElementType;
+ class IncompleteAnnotationException;
+ class Inherited;
+ class Retention;
+ class RetentionPolicy;
+ class Target;
}
namespace instrument
@@ -258,6 +273,24 @@ extern "Java"
class UnmodifiableClassException;
}
+ namespace management
+ {
+ class ClassLoadingMXBean;
+ class CompilationMXBean;
+ class GarbageCollectorMXBean;
+ class ManagementFactory;
+ class ManagementPermission;
+ class MemoryMXBean;
+ class MemoryManagerMXBean;
+ class MemoryPoolMXBean;
+ class MemoryUsage;
+ class OperatingSystemMXBean;
+ class RuntimeMXBean;
+ class ThreadInfo;
+ class ThreadMXBean;
+ class VMManagementFactory;
+ }
+
namespace ref
{
class PhantomReference;
@@ -304,17 +337,22 @@ extern "Java"
class AbstractList;
class AbstractList$1;
class AbstractList$2;
+ class AbstractList$3;
class AbstractList$RandomAccessSubList;
class AbstractList$SubList;
- class AbstractList$SubList$3;
class AbstractMap;
class AbstractMap$1;
- class AbstractMap$1$2;
+ class AbstractMap$2;
class AbstractMap$3;
- class AbstractMap$3$4;
- class AbstractMap$BasicMapEntry;
+ class AbstractMap$4;
+ class AbstractMap$SimpleEntry;
+ class AbstractMap$SimpleImmutableEntry;
+ class AbstractQueue;
class AbstractSequentialList;
class AbstractSet;
+ class ArrayDeque;
+ class ArrayDeque$DeqIterator;
+ class ArrayDeque$DescendingIterator;
class ArrayList;
class Arrays;
class Arrays$ArrayList;
@@ -323,6 +361,25 @@ extern "Java"
class Collection;
class Collections;
class Collections$1;
+ class Collections$1SynchronizedMapEntry;
+ class Collections$2;
+ class Collections$3;
+ class Collections$4;
+ class Collections$5;
+ class Collections$6;
+ class Collections$7;
+ class Collections$8;
+ class Collections$9;
+ class Collections$CheckedCollection;
+ class Collections$CheckedIterator;
+ class Collections$CheckedList;
+ class Collections$CheckedListIterator;
+ class Collections$CheckedMap;
+ class Collections$CheckedMap$CheckedEntrySet;
+ class Collections$CheckedRandomAccessList;
+ class Collections$CheckedSet;
+ class Collections$CheckedSortedMap;
+ class Collections$CheckedSortedSet;
class Collections$CopiesList;
class Collections$EmptyList;
class Collections$EmptyMap;
@@ -330,17 +387,12 @@ extern "Java"
class Collections$ReverseComparator;
class Collections$SingletonList;
class Collections$SingletonMap;
- class Collections$SingletonMap$3;
class Collections$SingletonSet;
- class Collections$SingletonSet$2;
class Collections$SynchronizedCollection;
class Collections$SynchronizedIterator;
class Collections$SynchronizedList;
class Collections$SynchronizedListIterator;
class Collections$SynchronizedMap;
- class Collections$SynchronizedMap$4$SynchronizedMapEntry;
- class Collections$SynchronizedMap$5;
- class Collections$SynchronizedMap$5$6;
class Collections$SynchronizedRandomAccessList;
class Collections$SynchronizedSet;
class Collections$SynchronizedSortedMap;
@@ -351,8 +403,7 @@ extern "Java"
class Collections$UnmodifiableListIterator;
class Collections$UnmodifiableMap;
class Collections$UnmodifiableMap$UnmodifiableEntrySet;
- class Collections$UnmodifiableMap$UnmodifiableEntrySet$7;
- class Collections$UnmodifiableMap$UnmodifiableEntrySet$7$8;
+ class Collections$UnmodifiableMap$UnmodifiableEntrySet$UnmodifiableMapEntry;
class Collections$UnmodifiableRandomAccessList;
class Collections$UnmodifiableSet;
class Collections$UnmodifiableSortedMap;
@@ -361,12 +412,30 @@ extern "Java"
class ConcurrentModificationException;
class Currency;
class Date;
+ class Deque;
class Dictionary;
+ class DuplicateFormatFlagsException;
class EmptyStackException;
+ class EnumMap;
+ class EnumMap$1;
+ class EnumMap$2;
+ class EnumMap$3;
+ class EnumMap$4;
+ class EnumMap$5;
+ class EnumMap$6;
+ class EnumMap$7;
+ class EnumSet;
+ class EnumSet$1;
class Enumeration;
class EventListener;
class EventListenerProxy;
class EventObject;
+ class FormatFlagsConversionMismatchException;
+ class Formattable;
+ class FormattableFlags;
+ class Formatter;
+ class Formatter$BigDecimalLayoutForm;
+ class FormatterClosedException;
class GregorianCalendar;
class HashMap;
class HashMap$1;
@@ -392,6 +461,13 @@ extern "Java"
class IdentityHashMap$3;
class IdentityHashMap$IdentityEntry;
class IdentityHashMap$IdentityIterator;
+ class IllegalFormatCodePointException;
+ class IllegalFormatConversionException;
+ class IllegalFormatException;
+ class IllegalFormatFlagsException;
+ class IllegalFormatPrecisionException;
+ class IllegalFormatWidthException;
+ class InputMismatchException;
class InvalidPropertiesFormatException;
class Iterator;
class LinkedHashMap;
@@ -407,14 +483,21 @@ extern "Java"
class Locale;
class Map;
class Map$Entry;
+ class MissingFormatArgumentException;
+ class MissingFormatWidthException;
class MissingResourceException;
+ class NavigableMap;
+ class NavigableSet;
class NoSuchElementException;
class Observable;
class Observer;
+ class PriorityQueue;
+ class PriorityQueue$1;
class Properties;
class PropertyPermission;
class PropertyPermissionCollection;
class PropertyResourceBundle;
+ class Queue;
class Random;
class RandomAccess;
class ResourceBundle;
@@ -436,22 +519,205 @@ extern "Java"
class TreeMap$1;
class TreeMap$2;
class TreeMap$3;
+ class TreeMap$4;
+ class TreeMap$5;
+ class TreeMap$6;
class TreeMap$Node;
class TreeMap$SubMap;
- class TreeMap$SubMap$4;
- class TreeMap$SubMap$5;
- class TreeMap$SubMap$6;
class TreeMap$TreeIterator;
class TreeSet;
+ class UnknownFormatConversionException;
+ class UnknownFormatFlagsException;
class VMTimeZone;
class Vector;
class Vector$1;
class WeakHashMap;
class WeakHashMap$1;
+ class WeakHashMap$2;
class WeakHashMap$WeakBucket;
class WeakHashMap$WeakBucket$WeakEntry;
class WeakHashMap$WeakEntrySet;
- class WeakHashMap$WeakEntrySet$2;
+
+ namespace concurrent
+ {
+ class AbstractExecutorService;
+ class ArrayBlockingQueue;
+ class ArrayBlockingQueue$Itr;
+ class BlockingDeque;
+ class BlockingQueue;
+ class BrokenBarrierException;
+ class Callable;
+ class CancellationException;
+ class CompletionService;
+ class ConcurrentHashMap;
+ class ConcurrentHashMap$EntryIterator;
+ class ConcurrentHashMap$EntrySet;
+ class ConcurrentHashMap$HashEntry;
+ class ConcurrentHashMap$HashIterator;
+ class ConcurrentHashMap$KeyIterator;
+ class ConcurrentHashMap$KeySet;
+ class ConcurrentHashMap$Segment;
+ class ConcurrentHashMap$ValueIterator;
+ class ConcurrentHashMap$Values;
+ class ConcurrentHashMap$WriteThroughEntry;
+ class ConcurrentLinkedQueue;
+ class ConcurrentLinkedQueue$Itr;
+ class ConcurrentLinkedQueue$Node;
+ class ConcurrentMap;
+ class ConcurrentNavigableMap;
+ class ConcurrentSkipListMap;
+ class ConcurrentSkipListMap$ComparableUsingComparator;
+ class ConcurrentSkipListMap$EntryIterator;
+ class ConcurrentSkipListMap$EntrySet;
+ class ConcurrentSkipListMap$HeadIndex;
+ class ConcurrentSkipListMap$Index;
+ class ConcurrentSkipListMap$Iter;
+ class ConcurrentSkipListMap$KeyIterator;
+ class ConcurrentSkipListMap$KeySet;
+ class ConcurrentSkipListMap$Node;
+ class ConcurrentSkipListMap$SubMap;
+ class ConcurrentSkipListMap$SubMap$SubMapEntryIterator;
+ class ConcurrentSkipListMap$SubMap$SubMapIter;
+ class ConcurrentSkipListMap$SubMap$SubMapKeyIterator;
+ class ConcurrentSkipListMap$SubMap$SubMapValueIterator;
+ class ConcurrentSkipListMap$ValueIterator;
+ class ConcurrentSkipListMap$Values;
+ class ConcurrentSkipListSet;
+ class CopyOnWriteArrayList;
+ class CopyOnWriteArraySet;
+ class CountDownLatch;
+ class CountDownLatch$Sync;
+ class CyclicBarrier;
+ class CyclicBarrier$Generation;
+ class DelayQueue;
+ class DelayQueue$Itr;
+ class Delayed;
+ class Exchanger;
+ class Exchanger$Node;
+ class Exchanger$Slot;
+ class ExecutionException;
+ class Executor;
+ class ExecutorCompletionService;
+ class ExecutorCompletionService$QueueingFuture;
+ class ExecutorService;
+ class Executors;
+ class Executors$1;
+ class Executors$2;
+ class Executors$3;
+ class Executors$4;
+ class Executors$5;
+ class Executors$6;
+ class Executors$DefaultThreadFactory;
+ class Executors$DelegatedExecutorService;
+ class Executors$DelegatedScheduledExecutorService;
+ class Executors$FinalizableDelegatedExecutorService;
+ class Executors$PrivilegedCallable;
+ class Executors$PrivilegedCallableUsingCurrentClassLoader;
+ class Executors$PrivilegedThreadFactory;
+ class Executors$RunnableAdapter;
+ class Future;
+ class FutureTask;
+ class FutureTask$Sync;
+ class LinkedBlockingDeque;
+ class LinkedBlockingDeque$AbstractItr;
+ class LinkedBlockingDeque$DescendingItr;
+ class LinkedBlockingDeque$Itr;
+ class LinkedBlockingDeque$Node;
+ class LinkedBlockingQueue;
+ class LinkedBlockingQueue$Itr;
+ class LinkedBlockingQueue$Node;
+ class PriorityBlockingQueue;
+ class PriorityBlockingQueue$Itr;
+ class RejectedExecutionException;
+ class RejectedExecutionHandler;
+ class RunnableFuture;
+ class RunnableScheduledFuture;
+ class ScheduledExecutorService;
+ class ScheduledFuture;
+ class ScheduledThreadPoolExecutor;
+ class ScheduledThreadPoolExecutor$1;
+ class ScheduledThreadPoolExecutor$DelayedWorkQueue;
+ class ScheduledThreadPoolExecutor$ScheduledFutureTask;
+ class Semaphore;
+ class Semaphore$FairSync;
+ class Semaphore$NonfairSync;
+ class Semaphore$Sync;
+ class SynchronousQueue;
+ class SynchronousQueue$EmptyIterator;
+ class SynchronousQueue$FifoWaitQueue;
+ class SynchronousQueue$LifoWaitQueue;
+ class SynchronousQueue$TransferQueue;
+ class SynchronousQueue$TransferQueue$QNode;
+ class SynchronousQueue$TransferStack;
+ class SynchronousQueue$TransferStack$SNode;
+ class SynchronousQueue$Transferer;
+ class SynchronousQueue$WaitQueue;
+ class ThreadFactory;
+ class ThreadPoolExecutor;
+ class ThreadPoolExecutor$AbortPolicy;
+ class ThreadPoolExecutor$CallerRunsPolicy;
+ class ThreadPoolExecutor$DiscardOldestPolicy;
+ class ThreadPoolExecutor$DiscardPolicy;
+ class ThreadPoolExecutor$Worker;
+ class TimeUnit;
+ class TimeUnit$1;
+ class TimeUnit$2;
+ class TimeUnit$3;
+ class TimeUnit$4;
+ class TimeUnit$5;
+ class TimeUnit$6;
+ class TimeUnit$7;
+ class TimeoutException;
+ namespace atomic
+ {
+ class AtomicBoolean;
+ class AtomicInteger;
+ class AtomicIntegerArray;
+ class AtomicIntegerFieldUpdater;
+ class AtomicIntegerFieldUpdater$AtomicIntegerFieldUpdaterImpl;
+ class AtomicLong;
+ class AtomicLongArray;
+ class AtomicLongFieldUpdater;
+ class AtomicLongFieldUpdater$CASUpdater;
+ class AtomicLongFieldUpdater$LockedUpdater;
+ class AtomicMarkableReference;
+ class AtomicMarkableReference$ReferenceBooleanPair;
+ class AtomicReference;
+ class AtomicReferenceArray;
+ class AtomicReferenceFieldUpdater;
+ class AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl;
+ class AtomicStampedReference;
+ class AtomicStampedReference$ReferenceIntegerPair;
+ }
+
+ namespace locks
+ {
+ class AbstractOwnableSynchronizer;
+ class AbstractQueuedLongSynchronizer;
+ class AbstractQueuedLongSynchronizer$ConditionObject;
+ class AbstractQueuedLongSynchronizer$Node;
+ class AbstractQueuedSynchronizer;
+ class AbstractQueuedSynchronizer$ConditionObject;
+ class AbstractQueuedSynchronizer$Node;
+ class Condition;
+ class Lock;
+ class LockSupport;
+ class ReadWriteLock;
+ class ReentrantLock;
+ class ReentrantLock$FairSync;
+ class ReentrantLock$NonfairSync;
+ class ReentrantLock$Sync;
+ class ReentrantReadWriteLock;
+ class ReentrantReadWriteLock$FairSync;
+ class ReentrantReadWriteLock$NonfairSync;
+ class ReentrantReadWriteLock$ReadLock;
+ class ReentrantReadWriteLock$Sync;
+ class ReentrantReadWriteLock$Sync$HoldCounter;
+ class ReentrantReadWriteLock$Sync$ThreadLocalHoldCounter;
+ class ReentrantReadWriteLock$WriteLock;
+ }
+ }
+
namespace jar
{
class Attributes;
@@ -480,6 +746,7 @@ extern "Java"
class LogRecord;
class Logger;
class Logger$1;
+ class LoggingMXBean;
class LoggingPermission;
class MemoryHandler;
class SimpleFormatter;
Index: libjava/javax/naming/spi/NamingManager.java
===================================================================
--- libjava/javax/naming/spi/NamingManager.java (revision 0)
+++ libjava/javax/naming/spi/NamingManager.java (revision 0)
@@ -0,0 +1,659 @@
+/* NamingManager.java -- Creates contexts and objects
+ Copyright (C) 2000, 2001, 2002, 2003, 2004,
+ 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.spi;
+
+// GCJ LOCAL - We don't have this yet.
+// import gnu.classpath.VMStackWalker;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.StringTokenizer;
+
+import javax.naming.CannotProceedException;
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.naming.NoInitialContextException;
+import javax.naming.RefAddr;
+import javax.naming.Reference;
+import javax.naming.Referenceable;
+import javax.naming.StringRefAddr;
+
+/**
+ * Contains methods for creating contexts and objects referred to by
+ * location information. The location is specified in the scope of the
+ * certain naming or directory service. This class only contais static
+ * methods and cannot be instantiated.
+ */
+public class NamingManager
+{
+ /**
+ * The environment property into which getContinuationContext() stores the
+ * value of the CannotProceedException parameter. The value of this field
+ * is <i>java.naming.spi.CannotProceedException<i>.
+ */
+ public static final String CPE = "java.naming.spi.CannotProceedException";
+
+ private static InitialContextFactoryBuilder icfb;
+
+ // Package private so DirectoryManager can access it.
+ static ObjectFactoryBuilder ofb;
+
+ // This class cannot be instantiated.
+ NamingManager ()
+ {
+ }
+
+ /**
+ * Checks if the initial context factory builder has been set.
+ *
+ * @return true if the builder has been set
+ *
+ * @see #setInitialContextFactoryBuilder(InitialContextFactoryBuilder)
+ */
+ public static boolean hasInitialContextFactoryBuilder ()
+ {
+ return icfb != null;
+ }
+
+ /**
+ * Creates the initial context. If the initial object factory builder has
+ * been set with {@link #setObjectFactoryBuilder(ObjectFactoryBuilder)},
+ * the work is delegated to this builder. Otherwise, the method searches
+ * for the property Context.INITIAL_CONTEXT_FACTORY first in the passed
+ * table and then in the system properties. The value of this property is
+ * uses as a class name to install the context factory. The corresponding
+ * class must exist, be public and have the public parameterless constructor.
+ *
+ * @param environment the properties, used to create the context.
+ *
+ * @return the created context
+ *
+ * @throws NoInitialContextException if the initial builder is not set,
+ * the property Context.INITIAL_CONTEXT_FACTORY is missing of the
+ * class, named by this property, cannot be instantiated.
+ * @throws NamingException if throws by the context factory
+ */
+ public static Context getInitialContext (Hashtable<?, ?> environment)
+ throws NamingException
+ {
+ InitialContextFactory icf = null;
+
+ if (icfb != null)
+ icf = icfb.createInitialContextFactory(environment);
+ else
+ {
+ String java_naming_factory_initial = null;
+ if (environment != null)
+ java_naming_factory_initial
+ = (String) environment.get (Context.INITIAL_CONTEXT_FACTORY);
+ if (java_naming_factory_initial == null)
+ java_naming_factory_initial =
+ System.getProperty (Context.INITIAL_CONTEXT_FACTORY);
+ if (java_naming_factory_initial == null)
+ throw new
+ NoInitialContextException ("Can't find property: "
+ + Context.INITIAL_CONTEXT_FACTORY);
+
+ try
+ {
+ icf = (InitialContextFactory)Class.forName
+ (java_naming_factory_initial, true,
+ Thread.currentThread().getContextClassLoader())
+ .newInstance ();
+ }
+ catch (Exception exception)
+ {
+ NoInitialContextException e
+ = new NoInitialContextException
+ ("Can't load InitialContextFactory class: "
+ + java_naming_factory_initial);
+ e.setRootCause(exception);
+ throw e;
+ }
+ }
+
+ return icf.getInitialContext (environment);
+ }
+
+ /**
+ * <p>
+ * Creates the URL context for the given URL scheme id.
+ * </p>
+ * <p>
+ * The class name of the factory that creates the context has the naming
+ * pattern scheme-idURLContextFactory. For instance, the factory for the "ftp"
+ * sheme should be named "ftpURLContextFactory".
+ * </p>
+ * <p>
+ * The Context.URL_PKG_PREFIXES environment property contains the
+ * colon-separated list of the possible package prefixes. The package name is
+ * constructed concatenating the package prefix with the scheme id. This
+ * property is searched in the passed <i>environment</i> parameter and later
+ * in the system properties.
+ * </p>
+ * <p>
+ * If the factory class cannot be found in the specified packages, system will
+ * try to use the default internal factory for the given scheme.
+ * </p>
+ * <p>
+ * After the factory is instantiated, its method
+ * {@link ObjectFactory#getObjectInstance(Object, Name, Context, Hashtable)}
+ * is called to create and return the object instance.
+ *
+ * @param refInfo passed to the factory
+ * @param name passed to the factory
+ * @param nameCtx passed to the factory
+ * @param scheme the url scheme that must be supported by the given context
+ * @param environment the properties for creating the factory and context (may
+ * be null)
+ * @return the created context
+ * @throws NamingException if thrown by the factory when creating the context.
+ */
+ static Context getURLContext(Object refInfo, Name name, Context nameCtx,
+ String scheme, Hashtable<?,?> environment)
+ throws NamingException
+ {
+ // Specified as the default in the docs. Unclear if this is
+ // right for us.
+ String defaultPrefix = "com.sun.jndi.url";
+
+ StringBuffer allPrefixes = new StringBuffer();
+
+ String prefixes;
+ if (environment != null)
+ {
+ prefixes = (String) environment.get(Context.URL_PKG_PREFIXES);
+ if (prefixes != null)
+ allPrefixes.append(prefixes);
+ }
+
+ prefixes = System.getProperty(Context.URL_PKG_PREFIXES);
+ if (prefixes != null)
+ {
+ if (allPrefixes.length() > 0)
+ allPrefixes.append(':');
+ allPrefixes.append(prefixes);
+ }
+
+ if (allPrefixes.length() > 0)
+ allPrefixes.append(':');
+ allPrefixes.append(defaultPrefix);
+
+ scheme = scheme + "." + scheme + "URLContextFactory";
+
+ StringTokenizer tokens = new StringTokenizer(allPrefixes.toString(), ":");
+ while (tokens.hasMoreTokens())
+ {
+ String aTry = tokens.nextToken();
+ try
+ {
+ String tryClass = aTry + "." + scheme;
+ Class factoryClass = forName(tryClass);
+ if (factoryClass != null)
+ {
+ ObjectFactory factory = (ObjectFactory) factoryClass.newInstance();
+ Object obj = factory.getObjectInstance(refInfo, name, nameCtx,
+ environment);
+ Context ctx = (Context) obj;
+ if (ctx != null)
+ return ctx;
+ }
+ }
+ catch (ClassNotFoundException _1)
+ {
+ // Ignore it.
+ }
+ catch (ClassCastException _2)
+ {
+ // This means that the class we found was not an
+ // ObjectFactory or that the factory returned something
+ // which was not a Context.
+ }
+ catch (InstantiationException _3)
+ {
+ // If we couldn't instantiate the factory we might get
+ // this.
+ }
+ catch (IllegalAccessException _4)
+ {
+ // Another possibility when instantiating.
+ }
+ catch (NamingException _5)
+ {
+ throw _5;
+ }
+ catch (Exception _6)
+ {
+ // Anything from getObjectInstance.
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Load the class with the given name. This method tries to use the context
+ * class loader first. If this fails, it searches for the suitable class
+ * loader in the caller stack trace. This method is a central point where all
+ * requests to find a class by name are delegated.
+ */
+ static Class forName(String className)
+ {
+ try
+ {
+ return Class.forName(className, true,
+ Thread.currentThread().getContextClassLoader());
+ }
+ catch (ClassNotFoundException nex)
+ {
+ /**
+ * Returns the first user defined class loader on the call stack, or
+ * null when no non-null class loader was found.
+ */
+// GCJ LOCAL - We don't have VMStackWalker yet.
+// We only try the SystemClassLoader for now.
+// Class[] ctx = VMStackWalker.getClassContext();
+// for (int i = 0; i < ctx.length; i++)
+// {
+ // Since we live in a class loaded by the bootstrap
+ // class loader, getClassLoader is safe to call without
+ // needing to be wrapped in a privileged action.
+// ClassLoader cl = ctx[i].getClassLoader();
+ ClassLoader cl = ClassLoader.getSystemClassLoader();
+ try
+ {
+ if (cl != null)
+ return Class.forName(className, true, cl);
+ }
+ catch (ClassNotFoundException nex2)
+ {
+ // Try next.
+ }
+// }
+ }
+ return null;
+ }
+
+
+ /**
+ * <p>
+ * Creates the URL context for the given URL scheme id.
+ * </p>
+ * <p>
+ * The class name of the factory that creates the context has the naming
+ * pattern scheme-idURLContextFactory. For instance, the factory for the
+ * "ftp" scheme should be named "ftpURLContextFactory".
+ * The Context.URL_PKG_PREFIXES environment property contains the
+ * colon-separated list of the possible package prefixes. The package name
+ * is constructed by concatenating the package prefix with the scheme id.
+ * </p>
+ * <p>
+ * If the factory class cannot be found in the specified packages, the
+ * system will try to use the default internal factory for the given scheme.
+ * </p>
+ * <p>
+ * After the factory is instantiated, its method
+ * {@link ObjectFactory#getObjectInstance(Object, Name, Context, Hashtable)}
+ * is called to create and return the object instance.
+ *
+ * @param scheme the url scheme that must be supported by the given context
+ * @param environment the properties for creating the factory and context
+ * (may be null)
+ * @return the created context
+ * @throws NamingException if thrown by the factory when creating the
+ * context.
+ */
+ public static Context getURLContext (String scheme,
+ Hashtable<?, ?> environment)
+ throws NamingException
+ {
+ return getURLContext (null, null, null, scheme, environment);
+ }
+
+ /**
+ * Sets the initial object factory builder.
+ *
+ * @param builder the builder to set
+ *
+ * @throws SecurityException if the builder cannot be installed due
+ * security restrictions.
+ * @throws NamingException if the builder cannot be installed due other
+ * reasons
+ * @throws IllegalStateException if setting the builder repeatedly
+ */
+ public static void setObjectFactoryBuilder (ObjectFactoryBuilder builder)
+ throws NamingException
+ {
+ SecurityManager sm = System.getSecurityManager ();
+ if (sm != null)
+ sm.checkSetFactory ();
+ // Once the builder is installed it cannot be replaced.
+ if (ofb != null)
+ throw new IllegalStateException ("object factory builder already installed");
+ if (builder != null)
+ ofb = builder;
+ }
+
+ static StringTokenizer getPlusPath (String property, Hashtable env,
+ Context nameCtx)
+ throws NamingException
+ {
+ String path = (String) env.get (property);
+ if (nameCtx == null)
+ nameCtx = getInitialContext (env);
+ String path2 = (String) nameCtx.getEnvironment ().get (property);
+ if (path == null)
+ path = path2;
+ else if (path2 != null)
+ path += ":" + path2;
+ return new StringTokenizer (path != null ? path : "", ":");
+ }
+
+ /**
+ * <p>Creates an object for the specified name context, environment and
+ * referencing context object.</p>
+ * <p>
+ * If the builder factory is set by
+ * {@link #setObjectFactoryBuilder(ObjectFactoryBuilder)}, the call is
+ * delegated to that factory. Otherwise, the object is created using the
+ * following rules:
+ * <ul>
+ * <li>If the referencing object (refInfo) contains the factory class name,
+ * the object is created by this factory. If the creation fails,
+ * the parameter refInfo is returned as the method return value.</li>
+ * <li>If the referencing object has no factory class name, and the addresses
+ * are StringRefAddrs having the address type "URL", the object is
+ * created by the URL context factory. The used factory corresponds the
+ * the naming schema of the each URL. If the attempt to create
+ * the object this way is not successful, the subsequent rule is
+ * tried.</li>
+ * <li> If the refInfo is not an instance of Reference or Referencable
+ * (for example, null), the object is created by the factories,
+ * specified in the Context.OBJECT_FACTORIES property of the
+ * environment and the provider resource file, associated with the
+ * nameCtx. The value of this property is the colon separated list
+ * of the possible factories. If none of the factories can be
+ * loaded, the refInfo is returned.
+ * </ul>
+ * </p>
+ * <p>The object factory must be public and have the public parameterless
+ * constructor.</p>
+ *
+ * @param refInfo the referencing object, for which the new object must be
+ * created (can be null). If not null, it is usually an instance of
+ * the {@link Reference} or {@link Referenceable}.
+ * @param name the name of the object. The name is relative to
+ * the nameCtx naming context. The value of this parameter can be
+ * null if the name is not specified.
+ * @param nameCtx the naming context, in which scope the name of the new
+ * object is specified. If this parameter is null, the name is
+ * specified in the scope of the initial context.
+ * @param environment contains additional information for creating the object.
+ * This paramter can be null if there is no need to provide any
+ * additional information.
+ *
+ * @return the created object. If the creation fails, in some cases
+ * the parameter refInfo may be returned.
+ *
+ * @throws NamingException if the attempt to name the new object has failed
+ * @throws Exception if the object factory throws it. The object factory
+ * only throws an exception if it does not want other factories
+ * to be used to create the object.
+ */
+ public static Object getObjectInstance (Object refInfo,
+ Name name,
+ Context nameCtx,
+ Hashtable<?, ?> environment)
+ throws Exception
+ {
+ ObjectFactory factory = null;
+
+ if (ofb != null)
+ factory = ofb.createObjectFactory (refInfo, environment);
+ else
+ {
+ // First see if we have a Reference or a Referenceable. If so
+ // we do some special processing.
+ Object ref2 = refInfo;
+ if (refInfo instanceof Referenceable)
+ ref2 = ((Referenceable) refInfo).getReference ();
+ if (ref2 instanceof Reference)
+ {
+ Reference ref = (Reference) ref2;
+
+ // If we have a factory class name then we use that.
+ String fClass = ref.getFactoryClassName ();
+ if (fClass != null)
+ {
+ // Exceptions here are passed to the caller.
+ Class k = Class.forName (fClass,
+ true,
+ Thread.currentThread().getContextClassLoader());
+ factory = (ObjectFactory) k.newInstance ();
+ }
+ else
+ {
+ // There's no factory class name. If the address is a
+ // StringRefAddr with address type `URL', then we try
+ // the URL's context factory.
+ Enumeration e = ref.getAll ();
+ while (e.hasMoreElements ())
+ {
+ RefAddr ra = (RefAddr) e.nextElement ();
+ if (ra instanceof StringRefAddr
+ && "URL".equals (ra.getType ()))
+ {
+ factory
+ = (ObjectFactory) getURLContext (refInfo,
+ name,
+ nameCtx,
+ (String) ra.getContent (),
+ environment);
+ Object obj = factory.getObjectInstance (refInfo,
+ name,
+ nameCtx,
+ environment);
+ if (obj != null)
+ return obj;
+ }
+ }
+
+ // Have to try the next step.
+ factory = null;
+ }
+ }
+
+ // Now look at OBJECT_FACTORIES to find the factory.
+ if (factory == null)
+ {
+ StringTokenizer tokens = getPlusPath (Context.OBJECT_FACTORIES,
+ environment, nameCtx);
+
+ while (tokens.hasMoreTokens ())
+ {
+ String klassName = tokens.nextToken ();
+ Class k = Class.forName (klassName,
+ true,
+ Thread.currentThread().getContextClassLoader());
+ factory = (ObjectFactory) k.newInstance ();
+ Object obj = factory.getObjectInstance (refInfo, name,
+ nameCtx, environment);
+ if (obj != null)
+ return obj;
+ }
+
+ // Failure.
+ return refInfo;
+ }
+ }
+
+ if (factory == null)
+ return refInfo;
+ Object obj = factory.getObjectInstance (refInfo, name,
+ nameCtx, environment);
+ return obj == null ? refInfo : obj;
+ }
+
+ /**
+ * Sets the initial context factory builder.
+ *
+ * @param builder the builder to set
+ *
+ * @throws SecurityException if the builder cannot be installed due
+ * security restrictions.
+ * @throws NamingException if the builder cannot be installed due other
+ * reasons
+ * @throws IllegalStateException if setting the builder repeatedly
+ *
+ * @see #hasInitialContextFactoryBuilder()
+ */
+ public static void setInitialContextFactoryBuilder
+ (InitialContextFactoryBuilder builder)
+ throws NamingException
+ {
+ SecurityManager sm = System.getSecurityManager ();
+ if (sm != null)
+ sm.checkSetFactory ();
+ // Once the builder is installed it cannot be replaced.
+ if (icfb != null)
+ throw new IllegalStateException ("ctx factory builder already installed");
+ if (builder != null)
+ icfb = builder;
+ }
+
+ /**
+ * Creates a context in which the context operation must be continued.
+ * This method is used by operations on names that span multiple namespaces.
+ *
+ * @param cpe the exception that triggered this continuation. This method
+ * obtains the environment ({@link CannotProceedException#getEnvironment()}
+ * and sets the environment property {@link #CPE} = cpe.
+ *
+ * @return a non null context for continuing the operation
+ *
+ * @throws NamingException if the naming problems have occured
+ */
+ public static Context getContinuationContext (CannotProceedException cpe)
+ throws NamingException
+ {
+ Hashtable env = cpe.getEnvironment ();
+ if (env != null)
+ env.put (CPE, cpe);
+
+ // TODO: Check if this implementation matches the API specification
+ try
+ {
+ Object obj = getObjectInstance (cpe.getResolvedObj(),
+ cpe.getAltName (),
+ cpe.getAltNameCtx (),
+ env);
+ if (obj != null)
+ return (Context) obj;
+ }
+ catch (Exception _)
+ {
+ }
+
+ // fix stack trace for re-thrown exception (message confusing otherwise)
+ cpe.fillInStackTrace();
+
+ throw cpe;
+ }
+
+ /**
+ * Get the object state for binding.
+ *
+ * @param obj the object, for that the binding state must be retrieved. Cannot
+ * be null.
+ * @param name the name of this object, related to the nameCtx. Can be null if
+ * not specified.
+ * @param nameCtx the naming context, to that the object name is related. Can
+ * be null if the name is related to the initial default context.
+ * @param environment the properties for creating the object state. Can be
+ * null if no properties are provided.
+ * @return the object state for binding, may be null if no changes are
+ * returned by the factory
+ * @throws NamingException
+ */
+ public static Object getStateToBind (Object obj, Name name,
+ Context nameCtx, Hashtable<?, ?> environment)
+ throws NamingException
+ {
+ StringTokenizer tokens = getPlusPath (Context.STATE_FACTORIES,
+ environment, nameCtx);
+ while (tokens.hasMoreTokens ())
+ {
+ String klassName = tokens.nextToken ();
+ try
+ {
+ Class k = Class.forName (klassName,
+ true,
+ Thread.currentThread().getContextClassLoader());
+ StateFactory factory = (StateFactory) k.newInstance ();
+ Object o = factory.getStateToBind (obj, name, nameCtx,
+ environment);
+ if (o != null)
+ return o;
+ }
+ catch (ClassNotFoundException _1)
+ {
+ // Ignore it.
+ }
+ catch (ClassCastException _2)
+ {
+ // This means that the class we found was not an
+ // ObjectFactory or that the factory returned something
+ // which was not a Context.
+ }
+ catch (InstantiationException _3)
+ {
+ // If we couldn't instantiate the factory we might get
+ // this.
+ }
+ catch (IllegalAccessException _4)
+ {
+ // Another possibility when instantiating.
+ }
+ }
+
+ return obj;
+ }
+}
Index: libjava/sources.am
===================================================================
--- libjava/sources.am (revision 115472)
+++ libjava/sources.am (working copy)
@@ -1062,7 +1062,14 @@ classpath/gnu/java/lang/management/Memor
classpath/gnu/java/lang/management/OperatingSystemMXBeanImpl.java \
classpath/gnu/java/lang/management/RuntimeMXBeanImpl.java \
classpath/gnu/java/lang/management/ThreadMXBeanImpl.java \
-gnu/java/lang/management/VMRuntimeMXBeanImpl.java
+gnu/java/lang/management/VMClassLoadingMXBeanImpl.java \
+gnu/java/lang/management/VMCompilationMXBeanImpl.java \
+gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java \
+gnu/java/lang/management/VMMemoryMXBeanImpl.java \
+gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java \
+gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java \
+gnu/java/lang/management/VMRuntimeMXBeanImpl.java \
+gnu/java/lang/management/VMThreadMXBeanImpl.java
gnu_java_lang_management_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_lang_management_source_files)))
@@ -1456,6 +1463,7 @@ gnu/java/nio/ServerSocketChannelSelectio
gnu/java/nio/SocketChannelImpl.java \
gnu/java/nio/SocketChannelSelectionKey.java \
classpath/gnu/java/nio/SocketChannelSelectionKeyImpl.java \
+gnu/java/nio/VMChannel.java \
gnu/java/nio/VMPipe.java \
gnu/java/nio/VMSelector.java
@@ -4472,7 +4480,8 @@ classpath/java/lang/management/MemoryUsa
classpath/java/lang/management/OperatingSystemMXBean.java \
classpath/java/lang/management/RuntimeMXBean.java \
classpath/java/lang/management/ThreadInfo.java \
-classpath/java/lang/management/ThreadMXBean.java
+classpath/java/lang/management/ThreadMXBean.java \
+java/lang/management/VMManagementFactory.java
java_lang_management_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(java_lang_management_source_files)))
@@ -4595,7 +4604,8 @@ classpath/java/net/URLStreamHandler.java
classpath/java/net/URLStreamHandlerFactory.java \
classpath/java/net/UnknownHostException.java \
classpath/java/net/UnknownServiceException.java \
-java/net/VMNetworkInterface.java
+java/net/VMNetworkInterface.java \
+java/net/VMURLConnection.java
java_net_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(java_net_source_files)))
@@ -5696,7 +5706,7 @@ classpath/javax/naming/spi/DirStateFacto
classpath/javax/naming/spi/DirectoryManager.java \
classpath/javax/naming/spi/InitialContextFactory.java \
classpath/javax/naming/spi/InitialContextFactoryBuilder.java \
-classpath/javax/naming/spi/NamingManager.java \
+javax/naming/spi/NamingManager.java \
classpath/javax/naming/spi/ObjectFactory.java \
classpath/javax/naming/spi/ObjectFactoryBuilder.java \
classpath/javax/naming/spi/ResolveResult.java \
@@ -7817,6 +7827,54 @@ org-xml.lo: $(org_xml_source_files)
$(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o org-xml.lo @org-xml.list
@rm -f org-xml.list
+sun_misc_source_files = \
+sun/misc/Unsafe.java
+
+sun_misc_header_files = $(patsubst %.java,%.h,$(sun_misc_source_files))
+
+sun/misc.list: $(sun_misc_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ echo classpath/lib/sun/misc/*.class > sun/misc.list
+
+-include sun/misc.deps
+
+
+sun_reflect_source_files = \
+sun/reflect/Reflection.java
+
+sun_reflect_header_files = $(patsubst %.java,%.h,$(sun_reflect_source_files))
+
+sun/reflect.list: $(sun_reflect_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ echo classpath/lib/sun/reflect/*.class > sun/reflect.list
+
+-include sun/reflect.deps
+
+
+sun_reflect_annotation_source_files = \
+classpath/sun/reflect/annotation/AnnotationInvocationHandler.java
+
+sun_reflect_annotation_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(sun_reflect_annotation_source_files)))
+
+sun/reflect/annotation.list: $(sun_reflect_annotation_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ echo classpath/lib/sun/reflect/annotation/*.class > sun/reflect/annotation.list
+
+-include sun/reflect/annotation.deps
+
+
+sun_reflect_misc_source_files = \
+sun/reflect/misc/ReflectUtil.java
+
+sun_reflect_misc_header_files = $(patsubst %.java,%.h,$(sun_reflect_misc_source_files))
+
+sun/reflect/misc.list: $(sun_reflect_misc_source_files)
+ @$(mkinstalldirs) $(dir $@)
+ echo classpath/lib/sun/reflect/misc/*.class > sun/reflect/misc.list
+
+-include sun/reflect/misc.deps
+
+
all_packages_source_files = \
gnu/awt.list \
@@ -8047,7 +8105,11 @@ all_packages_source_files = \
javax/swing/undo.list \
javax/transaction.list \
javax/transaction/xa.list \
- org/ietf/jgss.list
+ org/ietf/jgss.list \
+ sun/misc.list \
+ sun/reflect.list \
+ sun/reflect/annotation.list \
+ sun/reflect/misc.list
ordinary_header_files = \
$(gnu_awt_header_files) \
@@ -8279,7 +8341,11 @@ ordinary_header_files = \
$(javax_swing_undo_header_files) \
$(javax_transaction_header_files) \
$(javax_transaction_xa_header_files) \
- $(org_ietf_jgss_header_files)
+ $(org_ietf_jgss_header_files) \
+ $(sun_misc_header_files) \
+ $(sun_reflect_header_files) \
+ $(sun_reflect_annotation_header_files) \
+ $(sun_reflect_misc_header_files)
bc_objects = \
gnu-CORBA.lo \
Index: libjava/java/lang/Thread.java
===================================================================
--- libjava/java/lang/Thread.java (revision 115472)
+++ libjava/java/lang/Thread.java (working copy)
@@ -42,6 +42,12 @@ package java.lang;
import gnu.gcj.RawData;
import gnu.gcj.RawDataManaged;
import gnu.java.util.WeakIdentityHashMap;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.ThreadInfo;
+import java.lang.management.ThreadMXBean;
+
+import java.util.HashMap;
import java.util.Map;
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
@@ -1027,6 +1033,15 @@ public class Thread implements Runnable
return defaultHandler;
}
+ /**
+ * Returns the unique identifier for this thread. This ID is generated
+ * on thread creation, and may be re-used on its death.
+ *
+ * @return a positive long number representing the thread's ID.
+ * @since 1.5
+ */
+ public native long getId();
+
/**
* <p>
* This interface is used to handle uncaught exceptions
@@ -1084,4 +1099,136 @@ public class Thread implements Runnable
*/
void uncaughtException(Thread thr, Throwable exc);
}
+
+ /**
+ * <p>
+ * Represents the current state of a thread, according to the VM rather
+ * than the operating system. It can be one of the following:
+ * </p>
+ * <ul>
+ * <li>NEW -- The thread has just been created but is not yet running.</li>
+ * <li>RUNNABLE -- The thread is currently running or can be scheduled
+ * to run.</li>
+ * <li>BLOCKED -- The thread is blocked waiting on an I/O operation
+ * or to obtain a lock.</li>
+ * <li>WAITING -- The thread is waiting indefinitely for another thread
+ * to do something.</li>
+ * <li>TIMED_WAITING -- The thread is waiting for a specific amount of time
+ * for another thread to do something.</li>
+ * <li>TERMINATED -- The thread has exited.</li>
+ * </ul>
+ *
+ * @since 1.5
+ */
+ public enum State
+ {
+ BLOCKED, NEW, RUNNABLE, TERMINATED, TIMED_WAITING, WAITING;
+ }
+
+
+ /**
+ * Returns the current state of the thread. This
+ * is designed for monitoring thread behaviour, rather
+ * than for synchronization control.
+ *
+ * @return the current thread state.
+ */
+ public native State getState();
+
+ /**
+ * <p>
+ * Returns a map of threads to stack traces for each
+ * live thread. The keys of the map are {@link Thread}
+ * objects, which map to arrays of {@link StackTraceElement}s.
+ * The results obtained from Calling this method are
+ * equivalent to calling {@link getStackTrace()} on each
+ * thread in succession. Threads may be executing while
+ * this takes place, and the results represent a snapshot
+ * of the thread at the time its {@link getStackTrace()}
+ * method is called.
+ * </p>
+ * <p>
+ * The stack trace information contains the methods called
+ * by the thread, with the most recent method forming the
+ * first element in the array. The array will be empty
+ * if the virtual machine can not obtain information on the
+ * thread.
+ * </p>
+ * <p>
+ * To execute this method, the current security manager
+ * (if one exists) must allow both the
+ * <code>"getStackTrace"</code> and
+ * <code>"modifyThreadGroup"</code> {@link RuntimePermission}s.
+ * </p>
+ *
+ * @return a map of threads to arrays of {@link StackTraceElement}s.
+ * @throws SecurityException if a security manager exists, and
+ * prevents either or both the runtime
+ * permissions specified above.
+ * @since 1.5
+ * @see #getStackTrace()
+ */
+ public static Map<Thread, StackTraceElement[]> getAllStackTraces()
+ {
+ ThreadGroup group = currentThread().group;
+ while (group.getParent() != null)
+ group = group.getParent();
+ int arraySize = group.activeCount();
+ Thread[] threadList = new Thread[arraySize];
+ int filled = group.enumerate(threadList);
+ while (filled == arraySize)
+ {
+ arraySize *= 2;
+ threadList = new Thread[arraySize];
+ filled = group.enumerate(threadList);
+ }
+ Map traces = new HashMap();
+ for (int a = 0; a < filled; ++a)
+ traces.put(threadList[a],
+ threadList[a].getStackTrace());
+ return traces;
+ }
+
+ /**
+ * <p>
+ * Returns an array of {@link StackTraceElement}s
+ * representing the current stack trace of this thread.
+ * The first element of the array is the most recent
+ * method called, and represents the top of the stack.
+ * The elements continue in this order, with the last
+ * element representing the bottom of the stack.
+ * </p>
+ * <p>
+ * A zero element array is returned for threads which
+ * have not yet started (and thus have not yet executed
+ * any methods) or for those which have terminated.
+ * Where the virtual machine can not obtain a trace for
+ * the thread, an empty array is also returned. The
+ * virtual machine may also omit some methods from the
+ * trace in non-zero arrays.
+ * </p>
+ * <p>
+ * To execute this method, the current security manager
+ * (if one exists) must allow both the
+ * <code>"getStackTrace"</code> and
+ * <code>"modifyThreadGroup"</code> {@link RuntimePermission}s.
+ * </p>
+ *
+ * @return a stack trace for this thread.
+ * @throws SecurityException if a security manager exists, and
+ * prevents the use of the
+ * <code>"getStackTrace"</code>
+ * permission.
+ * @since 1.5
+ * @see #getAllStackTraces()
+ */
+ public StackTraceElement[] getStackTrace()
+ {
+ SecurityManager sm = SecurityManager.current; // Be thread-safe.
+ if (sm != null)
+ sm.checkPermission(new RuntimePermission("getStackTrace"));
+ ThreadMXBean bean = ManagementFactory.getThreadMXBean();
+ ThreadInfo info = bean.getThreadInfo(getId(), Integer.MAX_VALUE);
+ return info.getStackTrace();
+ }
}
Index: libjava/java/lang/management/VMManagementFactory.java
===================================================================
--- libjava/java/lang/management/VMManagementFactory.java (revision 0)
+++ libjava/java/lang/management/VMManagementFactory.java (revision 0)
@@ -0,0 +1,75 @@
+/* VMManagementFactory.java - VM interface for obtaining system beans.
+ Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package java.lang.management;
+
+/**
+ * Provides lists of resources required by the
+ * {@link java.lang.management.ManagementFactory} for
+ * creating beans.
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ * @since 1.5
+ */
+final class VMManagementFactory
+{
+
+ /**
+ * Return a list of the names of the currently available
+ * memory pools within the virtual machine.
+ *
+ * @return a list of memory pool names.
+ */
+ static native String[] getMemoryPoolNames();
+
+ /**
+ * Return a list of the names of the currently available
+ * memory managers within the virtual machine. This should
+ * not include the garbage collectors listed below.
+ *
+ * @return a list of memory manager names.
+ */
+ static native String[] getMemoryManagerNames();
+
+ /**
+ * Return a list of the names of the currently available
+ * garbage collectors within the virtual machine.
+ *
+ * @return a list of garbage collector names.
+ */
+ static native String[] getGarbageCollectorNames();
+}
Index: libjava/java/net/VMURLConnection.java
===================================================================
--- libjava/java/net/VMURLConnection.java (revision 0)
+++ libjava/java/net/VMURLConnection.java (revision 0)
@@ -0,0 +1,79 @@
+/* VMURLConnection - VM code for URLConnection
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.net;
+
+import gnu.classpath.Configuration;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+final class VMURLConnection
+{
+ public static final int LENGTH = 1024;
+
+ static
+ {
+ if (Configuration.INIT_LOAD_LIBRARY)
+ System.loadLibrary("javanet");
+ init();
+ }
+
+ private static native void init();
+
+ private static native String guessContentTypeFromBuffer(byte[] b, int valid);
+
+ /**
+ * This is called from URLConnection to guess the mime type of a
+ * stream. This method may return null to indicate that it could
+ * not guess a type.
+ */
+ static String guessContentTypeFromStream(InputStream is)
+ throws IOException
+ {
+ if (! is.markSupported())
+ return null;
+ is.mark(LENGTH);
+ byte[] bytes = new byte[LENGTH];
+ int r = is.read(bytes);
+ if (r < 0)
+ return null;
+ is.reset();
+ return guessContentTypeFromBuffer(bytes, r);
+ }
+}
Index: libjava/classpath/vm/reference/java/lang/management/VMThreadInfo.java
===================================================================
--- libjava/classpath/vm/reference/java/lang/management/VMThreadInfo.java (revision 115472)
+++ libjava/classpath/vm/reference/java/lang/management/VMThreadInfo.java (working copy)
@@ -1,159 +0,0 @@
-/* VMThreadInfo.java - Information on a thread
- Copyright (C) 2006 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath 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 for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.lang.management;
-
-/**
- * Provides low-level information about a thread.
- *
- * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- * @since 1.5
- * @see java.lang.management.ThreadInfo
- */
-final class VMThreadInfo
-{
-
- /**
- * Return the number of times the specified thread
- * has been in the {@link java.lang.Thread.State#BLOCKED}
- * state.
- *
- * @param thread the thread to return statistics on.
- * @return the number of times the thread has been blocked.
- */
- static native long getBlockedCount(Thread thread);
-
- /**
- * Returns the accumulated number of milliseconds the
- * specified thread has spent in the
- * {@link java.lang.Thread.State#BLOCKED} state. This
- * method is only called if thread contention monitoring
- * is both supported and enabled.
- *
- * @param thread the thread to return statistics on.
- * @return the accumulated number of milliseconds the
- * thread has been blocked for.
- */
- static native long getBlockedTime(Thread thread);
-
- /**
- * Returns the monitor lock the specified thread is
- * waiting for. This is only called when the thread
- * is in the {@link java.lang.Thread.State#BLOCKED}
- * state.
- *
- * @param thread the thread to return statistics on.
- * @return the monitor lock the thread is waiting for.
- */
- static native Object getLock(Thread thread);
-
- /**
- * Returns the thread which currently owns the monitor
- * lock the specified thread is waiting for. This is
- * only called when the thread is in the
- * {@link java.lang.Thread.State#BLOCKED} state. It
- * may return <code>null</code> if the lock is not held
- * by another thread.
- *
- * @param thread the thread to return statistics on.
- * @return the thread which owns the monitor lock the
- * thread is waiting for, or <code>null</code>
- * if it doesn't have an owner.
- */
- static native Thread getLockOwner(Thread thread);
-
- /**
- * Return the number of times the specified thread
- * has been in the {@link java.lang.Thread.State#WAITING}
- * or {@link java.lang.Thread.State#TIMED_WAITING} states.
- *
- * @param thread the thread to return statistics on.
- * @return the number of times the thread has been in
- * waiting state.
- */
- static native long getWaitedCount(Thread thread);
-
- /**
- * Returns the accumulated number of milliseconds the
- * specified thread has spent in either the
- * {@link java.lang.Thread.State#WAITING} or
- * {@link java.lang.Thread.State#TIMED_WAITING} states.
- * This method is only called if thread contention
- * monitoring is both supported and enabled.
- *
- * @param thread the thread to return statistics on.
- * @return the accumulated number of milliseconds the
- * thread has been in a waiting state for.
- */
- static native long getWaitedTime(Thread thread);
-
- /**
- * Returns true if the specified thread is in a native
- * method.
- *
- * @param thread the thread to return statistics on.
- * @return true if the thread is in a native method, false
- * otherwise.
- */
- static native boolean isInNative(Thread thread);
-
- /**
- * Returns true if the specified thread is suspended.
- *
- * @param thread the thread to return statistics on.
- * @return true if the thread is suspended, false otherwise.
- */
- static native boolean isSuspended(Thread thread);
-
- /**
- * Returns a stack trace for the specified thread of
- * the supplied depth. If the depth is
- * <code>Integer.MAX_VALUE</code>, then the returned
- * depth is equal to the full stack trace available.
- * The depth will be greater than zero, due to
- * filtering in methods prior to this call.
- *
- * @param thread the thread whose stack trace should
- * be returned.
- * @param maxDepth the maximum depth of the trace.
- * This will be greater than zero.
- * <code>Integer.MAX_VALUE</code>
- * represents the full trace.
- */
- static native StackTraceElement[] getStackTrace(Thread thread,
- int maxDepth);
-}
Index: libjava/classpath/native/fdlibm/namespace.h
===================================================================
--- libjava/classpath/native/fdlibm/namespace.h (revision 115472)
+++ libjava/classpath/native/fdlibm/namespace.h (working copy)
@@ -1,70 +1,3 @@
-/* Warning ! This is a generated file. Use build_mathnamespace to regenerate it */
-#define acos ClasspathMath_acos
-#define asin ClasspathMath_asin
-#define atan ClasspathMath_atan
-#define atan2 ClasspathMath_atan2
-#define cos ClasspathMath_cos
-#define sin ClasspathMath_sin
-#define tan ClasspathMath_tan
-#define cosh ClasspathMath_cosh
-#define sinh ClasspathMath_sinh
-#define tanh ClasspathMath_tanh
-#define exp ClasspathMath_exp
-#define frexp ClasspathMath_frexp
-#define ldexp ClasspathMath_ldexp
-#define expm1 ClasspathMath_expm1
-#define log ClasspathMath_log
-#define log10 ClasspathMath_log10
-#define log1p ClasspathMath_log1p
-#define modf ClasspathMath_modf
-#define pow ClasspathMath_pow
-#define sqrt ClasspathMath_sqrt
-#define ceil ClasspathMath_ceil
-#define fabs ClasspathMath_fabs
-#define floor ClasspathMath_floor
-#define fmod ClasspathMath_fmod
-#define erf ClasspathMath_erf
-#define erfc ClasspathMath_erfc
-#define gamma ClasspathMath_gamma
-#define hypot ClasspathMath_hypot
-#define finite ClasspathMath_finite
-#define j0 ClasspathMath_j0
-#define j1 ClasspathMath_j1
-#define jn ClasspathMath_jn
-#define lgamma ClasspathMath_lgamma
-#define y0 ClasspathMath_y0
-#define y1 ClasspathMath_y1
-#define yn ClasspathMath_yn
-#define acosh ClasspathMath_acosh
-#define asinh ClasspathMath_asinh
-#define cbrt ClasspathMath_cbrt
-#define logb ClasspathMath_logb
-#define nextafter ClasspathMath_nextafter
-#define remainder ClasspathMath_remainder
-#define logb ClasspathMath_logb
-#define scalb ClasspathMath_scalb
-#define significand ClasspathMath_significand
-#define logbf ClasspathMath_logbf
-#define scalbf ClasspathMath_scalbf
-#define significandf ClasspathMath_significandf
-#define copysign ClasspathMath_copysign
-#define ilogb ClasspathMath_ilogb
-#define rint ClasspathMath_rint
-#define rintf ClasspathMath_rintf
-#define scalbn ClasspathMath_scalbn
-#define __ieee754_sqrt ClasspathMath___ieee754_sqrt
-#define __ieee754_asin ClasspathMath___ieee754_asin
-#define __ieee754_asin ClasspathMath___ieee754_asin
-#define __ieee754_atan2 ClasspathMath___ieee754_atan2
-#define __ieee754_exp ClasspathMath___ieee754_exp
-#define __ieee754_fmod ClasspathMath___ieee754_fmod
-#define __ieee754_log ClasspathMath___ieee754_log
-#define __ieee754_pow ClasspathMath___ieee754_pow
-#define __ieee754_rem_pio2 ClasspathMath___ieee754_rem_pio2
-#define __ieee754_remainder ClasspathMath___ieee754_remainder
-#define __ieee754_scalb ClasspathMath___ieee754_scalb
-#define __ieee754_acos ClasspathMath___ieee754_acos
-#define __kernel_cos ClasspathMath___kernel_cos
-#define __kernel_sin ClasspathMath___kernel_sin
-#define __kernel_tan ClasspathMath___kernel_tan
-#define __kernel_rem_pio2 ClasspathMath___kernel_rem_pio2
+/* GCJ LOCAL We don't use the renaming here, so this file is empty for us.
+ * Warning ! This is a generated file. Use build_mathnamespace to regenerate it
+ */
Index: libjava/sun/reflect/Reflection.java
===================================================================
--- libjava/sun/reflect/Reflection.java (revision 0)
+++ libjava/sun/reflect/Reflection.java (revision 0)
@@ -0,0 +1,54 @@
+/* Reflection.java - JSR 166 reflection hooks
+ Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package sun.reflect;
+
+// GCJ LOCAL - We don't have this yet.
+// import gnu.classpath.VMStackWalker;
+
+public class Reflection
+{
+ /**
+ * A stack-walking wrapper method used by the JSR 166 RI.
+ */
+ public static Class getCallerClass(int depth)
+ {
+ // GCJ LOCAL - We don't have VMStackWalker yet.
+ // return VMStackWalker.getClassContext()[depth];
+ return null;
+ }
+}
Index: libjava/sun/reflect/misc/ReflectUtil.java
===================================================================
--- libjava/sun/reflect/misc/ReflectUtil.java (revision 0)
+++ libjava/sun/reflect/misc/ReflectUtil.java (revision 0)
@@ -0,0 +1,93 @@
+/* ReflectUtil.java - JSR 166 reflection hooks
+ Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package sun.reflect.misc;
+
+import java.lang.reflect.Modifier;
+
+public class ReflectUtil
+{
+ // We use this inaccessible inner class as an argument type
+ // in verifyMemberAccess. All current users of this method
+ // in the JSR 166 RI pass 'null' for this argument, and
+ // consequently we don't know what it means. Using a funny
+ // type like this for the argument means that if the RI changes,
+ // we will see a compilation error.
+ private static class MustBeNull
+ {
+ }
+
+ public static void checkPackageAccess(Class declaringClass)
+ {
+ // FIXME: not sure what to check here.
+ }
+
+ /**
+ * Perform access checks on a member of a class. This API is
+ * derived from the public domain code in the JSR 166 reference
+ * implementation.
+ * @param caller the class requesting access to the member
+ * @param declarer the declaring class of the member
+ * @param ignored unknown parameter; always null
+ * @param modifiers the modifiers on the member
+ * @return true if access is granted, false otherwise
+ */
+ public static void ensureMemberAccess(Class caller,
+ Class declarer,
+ MustBeNull ignored,
+ int modifiers)
+ {
+ // Same class, always ok.
+ if (caller == declarer)
+ return;
+ // Public access is ok.
+ if ((modifiers & Modifier.PUBLIC) != 0)
+ return;
+ // Protected access and request comes from
+ // a subclass of the declarer -- ok.
+ if ((modifiers & Modifier.PROTECTED) != 0
+ && declarer.isAssignableFrom(caller))
+ return;
+ // Package-private access, or protected access,
+ // and the packages are the same --ok.
+ if ((modifiers & Modifier.PRIVATE) == 0
+ && caller.getPackage() == declarer.getPackage())
+ return;
+ // Otherwise, no.
+ throw new IllegalAccessError();
+ }
+}
Index: libjava/sun/misc/Unsafe.java
===================================================================
--- libjava/sun/misc/Unsafe.java (revision 0)
+++ libjava/sun/misc/Unsafe.java (revision 0)
@@ -0,0 +1,328 @@
+/* Unsafe.java - Unsafe operations needed for concurrency
+ Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package sun.misc;
+
+import java.lang.reflect.Field;
+
+/**
+ * This class should provide access to low-level operations and its
+ * use should be limited to trusted code. Fields can be accessed using
+ * memory addresses, with undefined behaviour occurring if invalid memory
+ * addresses are given.
+ *
+ * @author Tom Tromey (tromey@redhat.com)
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ */
+public class Unsafe
+{
+ // Singleton class.
+ private static Unsafe unsafe = new Unsafe();
+
+ /**
+ * Private default constructor to prevent creation of an arbitrary
+ * number of instances.
+ */
+ private Unsafe()
+ {
+ }
+
+ /**
+ * Retrieve the singleton instance of <code>Unsafe</code>. The calling
+ * method should guard this instance from untrusted code, as it provides
+ * access to low-level operations such as direct memory access.
+ *
+ * @throws SecurityException if a security manager exists and prevents
+ * access to the system properties.
+ */
+ public static Unsafe getUnsafe()
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkPropertiesAccess();
+ return unsafe;
+ }
+
+ /**
+ * Returns the memory address offset of the given static field.
+ * The offset is merely used as a means to access a particular field
+ * in the other methods of this class. The value is unique to the given
+ * field and the same value should be returned on each subsequent call.
+ *
+ * @param field the field whose offset should be returned.
+ * @return the offset of the given field.
+ */
+ public native long objectFieldOffset(Field field);
+
+ /**
+ * Compares the value of the integer field at the specified offset
+ * in the supplied object with the given expected value, and updates
+ * it if they match. The operation of this method should be atomic,
+ * thus providing an uninterruptible way of updating an integer field.
+ *
+ * @param obj the object containing the field to modify.
+ * @param offset the offset of the integer field within <code>obj</code>.
+ * @param expect the expected value of the field.
+ * @param update the new value of the field if it equals <code>expect</code>.
+ * @return true if the field was changed.
+ */
+ public native boolean compareAndSwapInt(Object obj, long offset,
+ int expect, int update);
+
+ /**
+ * Compares the value of the long field at the specified offset
+ * in the supplied object with the given expected value, and updates
+ * it if they match. The operation of this method should be atomic,
+ * thus providing an uninterruptible way of updating a long field.
+ *
+ * @param obj the object containing the field to modify.
+ * @param offset the offset of the long field within <code>obj</code>.
+ * @param expect the expected value of the field.
+ * @param update the new value of the field if it equals <code>expect</code>.
+ * @return true if the field was changed.
+ */
+ public native boolean compareAndSwapLong(Object obj, long offset,
+ long expect, long update);
+
+ /**
+ * Compares the value of the object field at the specified offset
+ * in the supplied object with the given expected value, and updates
+ * it if they match. The operation of this method should be atomic,
+ * thus providing an uninterruptible way of updating an object field.
+ *
+ * @param obj the object containing the field to modify.
+ * @param offset the offset of the object field within <code>obj</code>.
+ * @param expect the expected value of the field.
+ * @param update the new value of the field if it equals <code>expect</code>.
+ * @return true if the field was changed.
+ */
+ public native boolean compareAndSwapObject(Object obj, long offset,
+ Object expect, Object update);
+
+ /**
+ * Sets the value of the integer field at the specified offset in the
+ * supplied object to the given value. This is an ordered or lazy
+ * version of <code>putIntVolatile(Object,long,int)</code>, which
+ * doesn't guarantee the immediate visibility of the change to other
+ * threads. It is only really useful where the integer field is
+ * <code>volatile</code>, and is thus expected to change unexpectedly.
+ *
+ * @param obj the object containing the field to modify.
+ * @param offset the offset of the integer field within <code>obj</code>.
+ * @param value the new value of the field.
+ * @see #putIntVolatile(Object,long,int)
+ */
+ public native void putOrderedInt(Object obj, long offset, int value);
+
+ /**
+ * Sets the value of the long field at the specified offset in the
+ * supplied object to the given value. This is an ordered or lazy
+ * version of <code>putLongVolatile(Object,long,long)</code>, which
+ * doesn't guarantee the immediate visibility of the change to other
+ * threads. It is only really useful where the long field is
+ * <code>volatile</code>, and is thus expected to change unexpectedly.
+ *
+ * @param obj the object containing the field to modify.
+ * @param offset the offset of the long field within <code>obj</code>.
+ * @param value the new value of the field.
+ * @see #putLongVolatile(Object,long,long)
+ */
+ public native void putOrderedLong(Object obj, long offset, long value);
+
+ /**
+ * Sets the value of the object field at the specified offset in the
+ * supplied object to the given value. This is an ordered or lazy
+ * version of <code>putObjectVolatile(Object,long,Object)</code>, which
+ * doesn't guarantee the immediate visibility of the change to other
+ * threads. It is only really useful where the object field is
+ * <code>volatile</code>, and is thus expected to change unexpectedly.
+ *
+ * @param obj the object containing the field to modify.
+ * @param offset the offset of the object field within <code>obj</code>.
+ * @param value the new value of the field.
+ */
+ public native void putOrderedObject(Object obj, long offset, Object value);
+
+ /**
+ * Sets the value of the integer field at the specified offset in the
+ * supplied object to the given value, with volatile store semantics.
+ *
+ * @param obj the object containing the field to modify.
+ * @param offset the offset of the integer field within <code>obj</code>.
+ * @param value the new value of the field.
+ */
+ public native void putIntVolatile(Object obj, long offset, int value);
+
+ /**
+ * Retrieves the value of the integer field at the specified offset in the
+ * supplied object with volatile load semantics.
+ *
+ * @param obj the object containing the field to read.
+ * @param offset the offset of the integer field within <code>obj</code>.
+ */
+ public native int getIntVolatile(Object obj, long offset);
+
+ /**
+ * Sets the value of the long field at the specified offset in the
+ * supplied object to the given value, with volatile store semantics.
+ *
+ * @param obj the object containing the field to modify.
+ * @param offset the offset of the long field within <code>obj</code>.
+ * @param value the new value of the field.
+ * @see #putLong(Object,long,long)
+ */
+ public native void putLongVolatile(Object obj, long offset, long value);
+
+ /**
+ * Sets the value of the long field at the specified offset in the
+ * supplied object to the given value.
+ *
+ * @param obj the object containing the field to modify.
+ * @param offset the offset of the long field within <code>obj</code>.
+ * @param value the new value of the field.
+ * @see #putLongVolatile(Object,long,long)
+ */
+ public native void putLong(Object obj, long offset, long value);
+
+ /**
+ * Retrieves the value of the long field at the specified offset in the
+ * supplied object with volatile load semantics.
+ *
+ * @param obj the object containing the field to read.
+ * @param offset the offset of the long field within <code>obj</code>.
+ * @see #getLong(Object,long)
+ */
+ public native long getLongVolatile(Object obj, long offset);
+
+ /**
+ * Retrieves the value of the long field at the specified offset in the
+ * supplied object.
+ *
+ * @param obj the object containing the field to read.
+ * @param offset the offset of the long field within <code>obj</code>.
+ * @see #getLongVolatile(Object,long)
+ */
+ public native long getLong(Object obj, long offset);
+
+ /**
+ * Sets the value of the object field at the specified offset in the
+ * supplied object to the given value, with volatile store semantics.
+ *
+ * @param obj the object containing the field to modify.
+ * @param offset the offset of the object field within <code>obj</code>.
+ * @param value the new value of the field.
+ * @see #putObject(Object,long,Object)
+ */
+ public native void putObjectVolatile(Object obj, long offset, Object value);
+
+ /**
+ * Sets the value of the object field at the specified offset in the
+ * supplied object to the given value.
+ *
+ * @param obj the object containing the field to modify.
+ * @param offset the offset of the object field within <code>obj</code>.
+ * @param value the new value of the field.
+ * @see #putObjectVolatile(Object,long,Object)
+ */
+ public native void putObject(Object obj, long offset, Object value);
+
+ /**
+ * Retrieves the value of the object field at the specified offset in the
+ * supplied object with volatile load semantics.
+ *
+ * @param obj the object containing the field to read.
+ * @param offset the offset of the object field within <code>obj</code>.
+ */
+ public native Object getObjectVolatile(Object obj, long offset);
+
+ /**
+ * Returns the offset of the first element for a given array class.
+ * To access elements of the array class, this value may be used along
+ * with that returned by
+ * <a href="#arrayIndexScale"><code>arrayIndexScale</code></a>,
+ * if non-zero.
+ *
+ * @param arrayClass the class for which the first element's address should
+ * be obtained.
+ * @return the offset of the first element of the array class.
+ * @see arrayIndexScale(Class)
+ */
+ public native int arrayBaseOffset(Class arrayClass);
+
+ /**
+ * Returns the scale factor used for addressing elements of the supplied
+ * array class. Where a suitable scale factor can not be returned (e.g.
+ * for primitive types), zero should be returned. The returned value
+ * can be used with
+ * <a href="#arrayBaseOffset"><code>arrayBaseOffset</code></a>
+ * to access elements of the class.
+ *
+ * @param arrayClass the class whose scale factor should be returned.
+ * @return the scale factor, or zero if not supported for this array class.
+ */
+ public native int arrayIndexScale(Class arrayClass);
+
+ /**
+ * Releases the block on a thread created by
+ * <a href="#park"><code>park</code></a>. This method can also be used
+ * to terminate a blockage caused by a prior call to <code>park</code>.
+ * This operation is unsafe, as the thread must be guaranteed to be
+ * live. This is true of Java, but not native code.
+ *
+ * @param thread the thread to unblock.
+ */
+ public native void unpark(Thread thread);
+
+ /**
+ * Blocks the thread until a matching
+ * <a href="#unpark"><code>unpark</code></a> occurs, the thread is
+ * interrupted or the optional timeout expires. If an <code>unpark</code>
+ * call has already occurred, this also counts. A timeout value of zero
+ * is defined as no timeout. When <code>isAbsolute</code> is
+ * <code>true</code>, the timeout is in milliseconds relative to the
+ * epoch. Otherwise, the value is the number of nanoseconds which must
+ * occur before timeout. This call may also return spuriously (i.e.
+ * for no apparent reason).
+ *
+ * @param isAbsolute true if the timeout is specified in milliseconds from
+ * the epoch.
+ * @param time either the number of nanoseconds to wait, or a time in
+ * milliseconds from the epoch to wait for.
+ */
+ public native void park(boolean isAbsolute, long time);
+
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20060723/3f7c603c/attachment.sig>
More information about the Java-patches
mailing list