Commit 143145da by Tom Tromey Committed by Tom Tromey

sources.am, [...]: Rebuilt.

	* sources.am, Makefile.in: Rebuilt.
	* java/util/logging/LogManager.java: Removed.
	* java/util/logging/Logger.java (resetLogger): New method, from
	Classpath.
	* java/io/RandomAccessFile.java: Removed.
	* gnu/java/nio/channels/FileChannelImpl.java (create): New
	method.
	(FileChannelImpl): Now private.
	* java/io/FileInputStream.java: Removed.
	* java/io/FileOutputStream.java: Removed.
	* java/security/AccessControlContext.java: Removed.
	* java/lang/ThreadLocal.java: Removed.
	* java/lang/InheritableThreadLocal.java: Removed.
	* java/lang/Thread.java (locals): New field.
	(getThreadLocals): New method.
	* java/lang/natThread.cc (finish_): Clear 'locals'.

From-SVN: r113735
parent a2038cd6
2006-05-12 Tom Tromey <tromey@redhat.com>
* sources.am, Makefile.in: Rebuilt.
* java/util/logging/LogManager.java: Removed.
* java/util/logging/Logger.java (resetLogger): New method, from
Classpath.
* java/io/RandomAccessFile.java: Removed.
* gnu/java/nio/channels/FileChannelImpl.java (create): New
method.
(FileChannelImpl): Now private.
* java/io/FileInputStream.java: Removed.
* java/io/FileOutputStream.java: Removed.
* java/security/AccessControlContext.java: Removed.
* java/lang/ThreadLocal.java: Removed.
* java/lang/InheritableThreadLocal.java: Removed.
* java/lang/Thread.java (locals): New field.
(getThreadLocals): New method.
* java/lang/natThread.cc (finish_): Clear 'locals'.
2006-05-11 Bryce McKinlay <mckinlay@redhat.com> 2006-05-11 Bryce McKinlay <mckinlay@redhat.com>
* gnu/gcj/runtime/NameFinder.java (lookup): If exec'ing addr2line * gnu/gcj/runtime/NameFinder.java (lookup): If exec'ing addr2line
......
# Makefile.in generated by automake 1.9.3 from Makefile.am. # Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc. # 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
SOURCES = $(lib_gnu_awt_xlib_la_SOURCES) $(lib_gnu_java_awt_peer_gtk_la_SOURCES) $(lib_gnu_java_awt_peer_qt_la_SOURCES) $(libgcj_la_SOURCES) $(libgcjawt_la_SOURCES) $(libgij_la_SOURCES) $(gcj_dbtool_SOURCES) $(gen_from_JIS_SOURCES) $(gij_SOURCES) $(grmic_SOURCES) $(grmiregistry_SOURCES) $(jv_convert_SOURCES)
srcdir = @srcdir@ srcdir = @srcdir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
...@@ -3512,9 +3510,9 @@ classpath/java/io/Externalizable.java \ ...@@ -3512,9 +3510,9 @@ classpath/java/io/Externalizable.java \
java/io/File.java \ java/io/File.java \
classpath/java/io/FileDescriptor.java \ classpath/java/io/FileDescriptor.java \
classpath/java/io/FileFilter.java \ classpath/java/io/FileFilter.java \
java/io/FileInputStream.java \ classpath/java/io/FileInputStream.java \
classpath/java/io/FileNotFoundException.java \ classpath/java/io/FileNotFoundException.java \
java/io/FileOutputStream.java \ classpath/java/io/FileOutputStream.java \
classpath/java/io/FilePermission.java \ classpath/java/io/FilePermission.java \
classpath/java/io/FileReader.java \ classpath/java/io/FileReader.java \
classpath/java/io/FileWriter.java \ classpath/java/io/FileWriter.java \
...@@ -3554,7 +3552,7 @@ java/io/PrintStream.java \ ...@@ -3554,7 +3552,7 @@ java/io/PrintStream.java \
classpath/java/io/PrintWriter.java \ classpath/java/io/PrintWriter.java \
classpath/java/io/PushbackInputStream.java \ classpath/java/io/PushbackInputStream.java \
classpath/java/io/PushbackReader.java \ classpath/java/io/PushbackReader.java \
java/io/RandomAccessFile.java \ classpath/java/io/RandomAccessFile.java \
classpath/java/io/Reader.java \ classpath/java/io/Reader.java \
classpath/java/io/SequenceInputStream.java \ classpath/java/io/SequenceInputStream.java \
classpath/java/io/Serializable.java \ classpath/java/io/Serializable.java \
...@@ -3607,7 +3605,7 @@ classpath/java/lang/IllegalStateException.java \ ...@@ -3607,7 +3605,7 @@ classpath/java/lang/IllegalStateException.java \
classpath/java/lang/IllegalThreadStateException.java \ classpath/java/lang/IllegalThreadStateException.java \
classpath/java/lang/IncompatibleClassChangeError.java \ classpath/java/lang/IncompatibleClassChangeError.java \
classpath/java/lang/IndexOutOfBoundsException.java \ classpath/java/lang/IndexOutOfBoundsException.java \
java/lang/InheritableThreadLocal.java \ classpath/java/lang/InheritableThreadLocal.java \
classpath/java/lang/InstantiationError.java \ classpath/java/lang/InstantiationError.java \
classpath/java/lang/InstantiationException.java \ classpath/java/lang/InstantiationException.java \
classpath/java/lang/Integer.java \ classpath/java/lang/Integer.java \
...@@ -3647,7 +3645,7 @@ java/lang/System.java \ ...@@ -3647,7 +3645,7 @@ java/lang/System.java \
java/lang/Thread.java \ java/lang/Thread.java \
classpath/java/lang/ThreadDeath.java \ classpath/java/lang/ThreadDeath.java \
classpath/java/lang/ThreadGroup.java \ classpath/java/lang/ThreadGroup.java \
java/lang/ThreadLocal.java \ classpath/java/lang/ThreadLocal.java \
classpath/java/lang/Throwable.java \ classpath/java/lang/Throwable.java \
classpath/java/lang/TypeNotPresentException.java \ classpath/java/lang/TypeNotPresentException.java \
classpath/java/lang/UnknownError.java \ classpath/java/lang/UnknownError.java \
...@@ -3935,7 +3933,7 @@ classpath/java/rmi/server/Unreferenced.java ...@@ -3935,7 +3933,7 @@ classpath/java/rmi/server/Unreferenced.java
java_rmi_server_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(java_rmi_server_source_files))) java_rmi_server_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(java_rmi_server_source_files)))
java_security_source_files = \ java_security_source_files = \
java/security/AccessControlContext.java \ classpath/java/security/AccessControlContext.java \
classpath/java/security/AccessControlException.java \ classpath/java/security/AccessControlException.java \
java/security/AccessController.java \ java/security/AccessController.java \
classpath/java/security/AlgorithmParameterGenerator.java \ classpath/java/security/AlgorithmParameterGenerator.java \
...@@ -4236,7 +4234,7 @@ classpath/java/util/logging/Filter.java \ ...@@ -4236,7 +4234,7 @@ classpath/java/util/logging/Filter.java \
classpath/java/util/logging/Formatter.java \ classpath/java/util/logging/Formatter.java \
classpath/java/util/logging/Handler.java \ classpath/java/util/logging/Handler.java \
classpath/java/util/logging/Level.java \ classpath/java/util/logging/Level.java \
java/util/logging/LogManager.java \ classpath/java/util/logging/LogManager.java \
classpath/java/util/logging/LogRecord.java \ classpath/java/util/logging/LogRecord.java \
java/util/logging/Logger.java \ java/util/logging/Logger.java \
classpath/java/util/logging/LoggingPermission.java \ classpath/java/util/logging/LoggingPermission.java \
...@@ -7994,7 +7992,13 @@ uninstall-toolexecmainlibDATA: ...@@ -7994,7 +7992,13 @@ uninstall-toolexecmainlibDATA:
# (which will cause the Makefiles to be regenerated when you run `make'); # (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line. # (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS): $(RECURSIVE_TARGETS):
@set fnord $$MAKEFLAGS; amf=$$2; \ @failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \ dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \ target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \ list='$(SUBDIRS)'; for subdir in $$list; do \
...@@ -8006,7 +8010,7 @@ $(RECURSIVE_TARGETS): ...@@ -8006,7 +8010,7 @@ $(RECURSIVE_TARGETS):
local_target="$$target"; \ local_target="$$target"; \
fi; \ fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ || eval $$failcom; \
done; \ done; \
if test "$$dot_seen" = "no"; then \ if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
...@@ -8014,7 +8018,13 @@ $(RECURSIVE_TARGETS): ...@@ -8014,7 +8018,13 @@ $(RECURSIVE_TARGETS):
mostlyclean-recursive clean-recursive distclean-recursive \ mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive: maintainer-clean-recursive:
@set fnord $$MAKEFLAGS; amf=$$2; \ @failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \ dot_seen=no; \
case "$@" in \ case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
...@@ -8035,7 +8045,7 @@ maintainer-clean-recursive: ...@@ -8035,7 +8045,7 @@ maintainer-clean-recursive:
local_target="$$target"; \ local_target="$$target"; \
fi; \ fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ || eval $$failcom; \
done && test -z "$$fail" done && test -z "$$fail"
tags-recursive: tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \ list='$(SUBDIRS)'; for subdir in $$list; do \
......
/* FileChannelImpl.java -- /* FileChannelImpl.java --
Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -103,7 +103,16 @@ public final class FileChannelImpl extends FileChannel ...@@ -103,7 +103,16 @@ public final class FileChannelImpl extends FileChannel
} }
/* Open a file. MODE is a combination of the above mode flags. */ /* Open a file. MODE is a combination of the above mode flags. */
public FileChannelImpl (File file, int mode) throws FileNotFoundException /* This is a static factory method, so that VM implementors can decide
* substitute subclasses of FileChannelImpl. */
public static FileChannelImpl create(File file, int mode)
throws FileNotFoundException
{
return new FileChannelImpl(file, mode);
}
/* Open a file. MODE is a combination of the above mode flags. */
private FileChannelImpl (File file, int mode) throws FileNotFoundException
{ {
final String path = file.getPath(); final String path = file.getPath();
fd = open (path, mode); fd = open (path, mode);
......
/* InheritableThreadLocal -- a ThreadLocal which inherits values across threads
Copyright (C) 2000, 2001, 2002, 2003, 2005 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.lang;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
/**
* A ThreadLocal whose value is inherited by child Threads. The value of the
* InheritableThreadLocal associated with the (parent) Thread is copied to
* the new (child) Thread at the moment of creation.
*
* <p>It is possible to make the value associated with the child Thread a
* function of the value that is associated with the parent Thread by
* overriding the <code>childValue()</code> method. The utility of this class
* is in transferring items like User ID or Transaction ID across threads
* automatically.
*
* @author Mark Wielaard (mark@klomp.org)
* @author Eric Blake (ebb9@email.byu.edu)
* @see ThreadLocal
* @since 1.2
* @status updated to 1.4
*/
public class InheritableThreadLocal extends ThreadLocal
{
/**
* Maps Threads to a List of InheritableThreadLocals (the heritage of that
* Thread). Uses a WeakHashMap so if the Thread is garbage collected the
* List can be collected, too. Maps to a list in case the user overrides
* equals.
*/
private static final Map threadMap
= Collections.synchronizedMap(new WeakHashMap());
/**
* Creates a new InheritableThreadLocal that has no values associated
* with it yet.
*/
public InheritableThreadLocal()
{
Thread currentThread = Thread.currentThread();
// Note that we don't have to synchronize, as only this thread will
// ever modify the returned heritage and threadMap is a synchronizedMap.
List heritage = (List) threadMap.get(currentThread);
if (heritage == null)
{
heritage = new ArrayList();
threadMap.put(currentThread, heritage);
}
heritage.add(this);
}
/**
* Determines the value associated with a newly created child Thread as a
* function of the value associated with the currently executing (parent)
* Thread. The default implementation just returns the parentValue.
*
* @param parentValue the value of this object in the parent thread at
* the moment of creation of the child
* @return the initial value for the child thread
*/
protected Object childValue(Object parentValue)
{
return parentValue;
}
/**
* Generates the childValues of all <code>InheritableThreadLocal</code>s
* that are in the heritage of the current Thread for the newly created
* childThread. Should be called from the contructor Thread.
*
* @param childThread the newly created thread, to inherit from this thread
* @see Thread#Thread(ThreadGroup, Runnable, String)
*/
static void newChildThread(Thread childThread)
{
// The currentThread is the parent of the new thread.
Thread parentThread = Thread.currentThread();
// Note that we don't have to synchronize, as only this thread will
// ever modify the returned heritage and threadMap is a synchronizedMap.
ArrayList heritage = (ArrayList) threadMap.get(parentThread);
if (heritage != null)
{
threadMap.put(childThread, heritage.clone());
// Perform the inheritance.
Iterator it = heritage.iterator();
int i = heritage.size();
while (--i >= 0)
{
InheritableThreadLocal local = (InheritableThreadLocal) it.next();
Object parentValue = local.valueMap.get(parentThread);
if (parentValue != null)
{
Object childValue = local.childValue(parentValue == NULL
? null : parentValue);
local.valueMap.put(childThread, (childValue == null
? NULL : parentValue));
}
}
}
}
}
/* Thread -- an independent thread of executable code /* Thread -- an independent thread of executable code
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation Free Software Foundation
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -41,6 +41,8 @@ package java.lang; ...@@ -41,6 +41,8 @@ package java.lang;
import gnu.gcj.RawData; import gnu.gcj.RawData;
import gnu.gcj.RawDataManaged; import gnu.gcj.RawDataManaged;
import gnu.java.util.WeakIdentityHashMap;
import java.util.Map;
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 /* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
* "The Java Language Specification", ISBN 0-201-63451-1 * "The Java Language Specification", ISBN 0-201-63451-1
...@@ -125,6 +127,11 @@ public class Thread implements Runnable ...@@ -125,6 +127,11 @@ public class Thread implements Runnable
/** The context classloader for this Thread. */ /** The context classloader for this Thread. */
private ClassLoader contextClassLoader; private ClassLoader contextClassLoader;
/** Thread local storage. Package accessible for use by
* InheritableThreadLocal.
*/
WeakIdentityHashMap locals;
// This describes the top-most interpreter frame for this thread. // This describes the top-most interpreter frame for this thread.
RawData interp_frame; RawData interp_frame;
...@@ -914,4 +921,18 @@ public class Thread implements Runnable ...@@ -914,4 +921,18 @@ public class Thread implements Runnable
private final native void initialize_native(); private final native void initialize_native();
private final native static String gen_name(); private final native static String gen_name();
/**
* Returns the map used by ThreadLocal to store the thread local values.
*/
static Map getThreadLocals()
{
Thread thread = currentThread();
Map locals = thread.locals;
if (locals == null)
{
locals = thread.locals = new WeakIdentityHashMap();
}
return locals;
}
} }
/* ThreadLocal -- a variable with a unique value per thread
Copyright (C) 2000, 2002, 2003 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.lang;
import java.util.Collections;
import java.util.Map;
import java.util.WeakHashMap;
/**
* ThreadLocal objects have a different state associated with every
* Thread that accesses them. Every access to the ThreadLocal object
* (through the <code>get()</code> and <code>set()</code> methods)
* only affects the state of the object as seen by the currently
* executing Thread.
*
* <p>The first time a ThreadLocal object is accessed on a particular
* Thread, the state for that Thread's copy of the local variable is set by
* executing the method <code>initialValue()</code>.
* </p>
*
* <p>An example how you can use this:
* </p>
*
* <pre>
* class Connection
* {
* private static ThreadLocal owner = new ThreadLocal()
* {
* public Object initialValue()
* {
* return("nobody");
* }
* };
* ...
* }
* </pre>
*
* <p>Now all instances of connection can see who the owner of the currently
* executing Thread is by calling <code>owner.get()</code>. By default any
* Thread would be associated with 'nobody'. But the Connection object could
* offer a method that changes the owner associated with the Thread on
* which the method was called by calling <code>owner.put("somebody")</code>.
* (Such an owner changing method should then be guarded by security checks.)
* </p>
*
* <p>When a Thread is garbage collected all references to values of
* the ThreadLocal objects associated with that Thread are removed.
* </p>
*
* @author Mark Wielaard (mark@klomp.org)
* @author Eric Blake (ebb9@email.byu.edu)
* @since 1.2
* @status updated to 1.4
*/
public class ThreadLocal
{
/**
* Placeholder to distinguish between uninitialized and null set by the
* user. Do not expose this to the public. Package visible for use by
* InheritableThreadLocal
*/
static final Object NULL = new Object();
/**
* The stored value. Package visible for use by InheritableThreadLocal. */
Object value;
/**
* Maps Threads to values. Uses a WeakHashMap so if a Thread is garbage
* collected the reference to the Value will disappear. A null value means
* uninitialized, while NULL means a user-specified null. Only the
* <code>set(Thread, Object)</code> and <code>get(Thread)</code> methods
* access it. Package visible for use by InheritableThreadLocal.
*/
final Map valueMap = Collections.synchronizedMap(new WeakHashMap());
/**
* Creates a ThreadLocal object without associating any value to it yet.
*/
public ThreadLocal()
{
}
/**
* Called once per thread on the first invocation of get(), if set() was
* not already called. The default implementation returns <code>null</code>.
* Often, this method is overridden to create the appropriate initial object
* for the current thread's view of the ThreadLocal.
*
* @return the initial value of the variable in this thread
*/
protected Object initialValue()
{
return null;
}
/**
* Gets the value associated with the ThreadLocal object for the currently
* executing Thread. If this is the first time the current thread has called
* get(), and it has not already called set(), the value is obtained by
* <code>initialValue()</code>.
*
* @return the value of the variable in this thread
*/
public Object get()
{
Thread currentThread = Thread.currentThread();
// Note that we don't have to synchronize, as only this thread will
// ever modify the returned value and valueMap is a synchronizedMap.
Object value = valueMap.get(currentThread);
if (value == null)
{
value = initialValue();
valueMap.put(currentThread, value == null ? NULL : value);
}
return value == NULL ? null : value;
}
/**
* Sets the value associated with the ThreadLocal object for the currently
* executing Thread. This overrides any existing value associated with the
* current Thread and prevents <code>initialValue()</code> from being
* called if this is the first access to this ThreadLocal in this Thread.
*
* @param value the value to set this thread's view of the variable to
*/
public void set(Object value)
{
// Note that we don't have to synchronize, as only this thread will
// ever modify the returned value and valueMap is a synchronizedMap.
valueMap.put(Thread.currentThread(), value == null ? NULL : value);
}
}
...@@ -216,6 +216,9 @@ java::lang::Thread::finish_ () ...@@ -216,6 +216,9 @@ java::lang::Thread::finish_ ()
// If a method cache was created, free it. // If a method cache was created, free it.
_Jv_FreeMethodCache(); _Jv_FreeMethodCache();
// Clear out thread locals.
locals = NULL;
// Signal any threads that are waiting to join() us. // Signal any threads that are waiting to join() us.
_Jv_MutexLock (&nt->join_mutex); _Jv_MutexLock (&nt->join_mutex);
......
/* AccessControlContext.java --- Access Control Context Class
Copyright (C) 1999, 2004 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.security;
/**
* AccessControlContext makes system resource access decsion
* based on permission rights.
*
* It is used for a specific context and has only one method
* checkPermission. It is similar to AccessController except
* that it makes decsions based on the current context instead
* of the the current thread.
*
* It is created by call AccessController.getContext method.
*
* @author Mark Benvenuto
* @since 1.2
*/
public final class AccessControlContext
{
private ProtectionDomain[] protectionDomains;
private DomainCombiner combiner;
/**
* Construct a new AccessControlContext with the specified
* ProtectionDomains. <code>context</code> must not be
* null and duplicates will be removed.
*
* @param context The ProtectionDomains to use
*/
public AccessControlContext(ProtectionDomain[] context)
{
int i, j, k, count = context.length, count2 = 0;
for (i = 0, j = 0; i < count; i++)
{
for (k = 0; k < i; k++)
if (context[k] == protectionDomains[i])
break;
if (k != i) //it means previous loop did not complete
continue;
count2++;
}
protectionDomains = new ProtectionDomain[count2];
for (i = 0, j = 0; i < count2; i++)
{
for (k = 0; k < i; k++)
if (context[k] == protectionDomains[i])
break;
if (k != i) //it means previous loop did not complete
continue;
protectionDomains[j++] = context[i];
}
}
/**
* Construct a new AccessControlContext with the specified
* ProtectionDomains and DomainCombiner
*
* @since 1.3
*/
public AccessControlContext(AccessControlContext acc,
DomainCombiner combiner)
{
this(acc.protectionDomains);
this.combiner = combiner;
}
/**
* Returns the Domain Combiner associated with the AccessControlContext
*
* @return the DomainCombiner
*/
public DomainCombiner getDomainCombiner()
{
return combiner;
}
/**
* Determines whether or not the specific permission is granted
* depending on the context it is within.
*
* @param perm a permission to check
*
* @throws AccessControlException if the permssion is not permitted
*/
public void checkPermission(Permission perm) throws AccessControlException
{
for (int i = 0; i < protectionDomains.length; i++)
if (protectionDomains[i].implies(perm) == true)
return;
throw new AccessControlException("Permission not granted");
}
/**
* Checks if two AccessControlContexts are equal.
*
* It first checks if obj is an AccessControlContext class, and
* then checks if each ProtectionDomain matches.
*
* @param obj The object to compare this class to
*
* @return true if equal, false otherwise
*/
public boolean equals(Object obj)
{
if (obj instanceof AccessControlContext)
{
AccessControlContext acc = (AccessControlContext) obj;
if (acc.protectionDomains.length != protectionDomains.length)
return false;
for (int i = 0; i < protectionDomains.length; i++)
if (acc.protectionDomains[i] != protectionDomains[i])
return false;
return true;
}
return false;
}
/**
* Computes a hash code of this class
*
* @return a hash code representing this class
*/
public int hashCode()
{
int h = 0;
for (int i = 0; i < protectionDomains.length; i++)
h ^= protectionDomains[i].hashCode();
return h;
}
}
/* Logger.java -- a class for logging messages /* Logger.java -- a class for logging messages
Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -1170,4 +1170,18 @@ public class Logger ...@@ -1170,4 +1170,18 @@ public class Logger
* @return caller of the initial looging method * @return caller of the initial looging method
*/ */
private native StackTraceElement getCallerStackFrame(); private native StackTraceElement getCallerStackFrame();
/**
* Reset and close handlers attached to this logger. This function is package
* private because it must only be available to the LogManager.
*/
void resetLogger()
{
for (int i = 0; i < handlers.length; i++)
{
handlers[i].close();
handlerList.remove(handlers[i]);
}
handlers = getHandlers();
}
} }
...@@ -4114,9 +4114,9 @@ classpath/java/io/Externalizable.java \ ...@@ -4114,9 +4114,9 @@ classpath/java/io/Externalizable.java \
java/io/File.java \ java/io/File.java \
classpath/java/io/FileDescriptor.java \ classpath/java/io/FileDescriptor.java \
classpath/java/io/FileFilter.java \ classpath/java/io/FileFilter.java \
java/io/FileInputStream.java \ classpath/java/io/FileInputStream.java \
classpath/java/io/FileNotFoundException.java \ classpath/java/io/FileNotFoundException.java \
java/io/FileOutputStream.java \ classpath/java/io/FileOutputStream.java \
classpath/java/io/FilePermission.java \ classpath/java/io/FilePermission.java \
classpath/java/io/FileReader.java \ classpath/java/io/FileReader.java \
classpath/java/io/FileWriter.java \ classpath/java/io/FileWriter.java \
...@@ -4156,7 +4156,7 @@ java/io/PrintStream.java \ ...@@ -4156,7 +4156,7 @@ java/io/PrintStream.java \
classpath/java/io/PrintWriter.java \ classpath/java/io/PrintWriter.java \
classpath/java/io/PushbackInputStream.java \ classpath/java/io/PushbackInputStream.java \
classpath/java/io/PushbackReader.java \ classpath/java/io/PushbackReader.java \
java/io/RandomAccessFile.java \ classpath/java/io/RandomAccessFile.java \
classpath/java/io/Reader.java \ classpath/java/io/Reader.java \
classpath/java/io/SequenceInputStream.java \ classpath/java/io/SequenceInputStream.java \
classpath/java/io/Serializable.java \ classpath/java/io/Serializable.java \
...@@ -4221,7 +4221,7 @@ classpath/java/lang/IllegalStateException.java \ ...@@ -4221,7 +4221,7 @@ classpath/java/lang/IllegalStateException.java \
classpath/java/lang/IllegalThreadStateException.java \ classpath/java/lang/IllegalThreadStateException.java \
classpath/java/lang/IncompatibleClassChangeError.java \ classpath/java/lang/IncompatibleClassChangeError.java \
classpath/java/lang/IndexOutOfBoundsException.java \ classpath/java/lang/IndexOutOfBoundsException.java \
java/lang/InheritableThreadLocal.java \ classpath/java/lang/InheritableThreadLocal.java \
classpath/java/lang/InstantiationError.java \ classpath/java/lang/InstantiationError.java \
classpath/java/lang/InstantiationException.java \ classpath/java/lang/InstantiationException.java \
classpath/java/lang/Integer.java \ classpath/java/lang/Integer.java \
...@@ -4261,7 +4261,7 @@ java/lang/System.java \ ...@@ -4261,7 +4261,7 @@ java/lang/System.java \
java/lang/Thread.java \ java/lang/Thread.java \
classpath/java/lang/ThreadDeath.java \ classpath/java/lang/ThreadDeath.java \
classpath/java/lang/ThreadGroup.java \ classpath/java/lang/ThreadGroup.java \
java/lang/ThreadLocal.java \ classpath/java/lang/ThreadLocal.java \
classpath/java/lang/Throwable.java \ classpath/java/lang/Throwable.java \
classpath/java/lang/TypeNotPresentException.java \ classpath/java/lang/TypeNotPresentException.java \
classpath/java/lang/UnknownError.java \ classpath/java/lang/UnknownError.java \
...@@ -4741,7 +4741,7 @@ java/rmi/server.list: $(java_rmi_server_source_files) ...@@ -4741,7 +4741,7 @@ java/rmi/server.list: $(java_rmi_server_source_files)
java_security_source_files = \ java_security_source_files = \
java/security/AccessControlContext.java \ classpath/java/security/AccessControlContext.java \
classpath/java/security/AccessControlException.java \ classpath/java/security/AccessControlException.java \
java/security/AccessController.java \ java/security/AccessController.java \
classpath/java/security/AlgorithmParameterGenerator.java \ classpath/java/security/AlgorithmParameterGenerator.java \
...@@ -5150,7 +5150,7 @@ classpath/java/util/logging/Filter.java \ ...@@ -5150,7 +5150,7 @@ classpath/java/util/logging/Filter.java \
classpath/java/util/logging/Formatter.java \ classpath/java/util/logging/Formatter.java \
classpath/java/util/logging/Handler.java \ classpath/java/util/logging/Handler.java \
classpath/java/util/logging/Level.java \ classpath/java/util/logging/Level.java \
java/util/logging/LogManager.java \ classpath/java/util/logging/LogManager.java \
classpath/java/util/logging/LogRecord.java \ classpath/java/util/logging/LogRecord.java \
java/util/logging/Logger.java \ java/util/logging/Logger.java \
classpath/java/util/logging/LoggingPermission.java \ classpath/java/util/logging/LoggingPermission.java \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment