aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/java/net
AgeCommit message (Expand)AuthorFilesLines
2008-10-21re PR libgcj/37636 (java tools are unable to find resource files)Matthias Klose9-20/+84
2008-06-28Import GNU Classpath (classpath-0_97_2-release).Matthias Klose7-26/+27
2008-01-21re PR libgcj/34369 (java.net.URI.relativize(URI) method returns incorrect res...Luciano Chavez1-4/+10
2007-08-04Import GNU Classpath (libgcj-import-20070727).Matthias Klose1-7/+3
2007-06-03libjava/classpath/ChangeLog.gcj:Matthias Klose11-168/+58
2007-02-05Proxy.java (equals): Handle case where address==null.Tom Tromey1-4/+6
2007-01-09Merged gcj-eclipse branch to trunk.Tom Tromey14-239/+749
2006-11-032006-11-03 Gary Benson <gbenson@redhat.com>Gary Benson2-5/+5
2006-10-052006-10-05 Gary Benson <gbenson@redhat.com>Gary Benson1-3/+7
2006-09-20InetAddress.java: Updated to latest.Gary Benson5-250/+634
2006-09-052006-09-05 Gary Benson <gbenson@redhat.com>Gary Benson1-14/+13
2006-08-292006-08-29 Gary Benson <gbenson@redhat.com>Gary Benson2-6/+47
2006-08-24NetworkInterface.java (getInetAddresses): Bracket IPv6 addresses.Gary Benson1-1/+4
2006-08-14Imported GNU Classpath 0.92Mark Wielaard6-648/+373
2006-05-18Imported GNU Classpath 0.90Mark Wielaard6-318/+498
2006-03-10Imported GNU Classpath 0.90Mark Wielaard6-194/+333
2006-01-17Imported GNU Classpath 0.20Mark Wielaard3-139/+16
2006-01-15Update copyright year for last patch.Anthony Green1-1/+1
2006-01-15ServerSocket.java (accept): Remove bogus security check.Anthony Green1-5/+3
2005-12-28[multiple changes]Anthony Green1-19/+1
2005-11-18Imported GNU Classpath gcj-import-20051117.Mark Wielaard2-55/+55
2005-11-15Imported GNU Classpath 0.19 + gcj-import-20051115.Mark Wielaard8-48/+110
2005-09-23Imported Classpath 0.18.Tom Tromey5-27/+72
2005-07-16Initial revisionTom Tromey49-0/+15310
pan class="hl com"> * of the value that is associated with the parent Thread by overriding the * <code>childValue()</code> method. * * @since 1.2 * @author Mark Wielaard (mark@klomp.org) */ public class InheritableThreadLocal extends ThreadLocal { /** * Maps Threads to a Set of InheritableThreadLocals * (the heritage of that Thread). * Uses a WeakHashMap so if the Thread is garbage collected the reference * to that Set disappears. * Both <code>AddToHeritage</code> access and modify it so they have to * synchronize on the threadMap when they do. */ private static Map threadMap = new WeakHashMap(); /** * Creates a new InheritableThreadLocal that has no values associated * with it yet. */ public InheritableThreadLocal() { super(); } /** * Determines the value associated with a newly created child Thread * as a function of the value associated with the currently executing * (parent) Thread. * <p> * The default implementation just returns the parentValue. */ protected Object childValue(Object parentValue) { return parentValue; } /** * Adds this <code>InheritableThreadLocal</code> to the heritage of the * current Thread and returns the value of the <code>ThreadLocal</code> * for the Thread. The value will be either the last value that the * current Thread has set, or the childValue of the last value that the * parent Thread set before the current Thread was created, or the * initialValue of the <code>ThreadLocal</code>. * * @see ThreadLocal#get() */ public Object get() { addToHeritage(); return super.get(); } /** * Adds this <code>InheritableThreadLocal</code> to the heritage of the * current Thread and sets the value of the <code>ThreadLocal</code> * for the Thread. * * @see ThreadLocal#set(Object) */ public void set(Object value) { addToHeritage(); super.set(value); } /** * Adds this <code>InheritableThreadLocal</code> to the heritage * of the current Thread. */ private void addToHeritage() { Thread currentThread = Thread.currentThread(); Set heritage; synchronized(threadMap) { heritage = (Set)threadMap.get(currentThread); } // Note that we don't have to synchronize on the heritage Set // since only this Thread (or the parent Thread when creating // the heritage) ever modifies it. if (heritage == null) { heritage = new HashSet(); synchronized(threadMap) { threadMap.put(currentThread, heritage); } } if (!heritage.contains(this)) { heritage.add(this); } } /** * 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 of java.lang.Thread. */ static void newChildThread(Thread childThread) { // The currentThread is the parent of the new thread Thread parentThread = Thread.currentThread(); // Inherit all the InheritableThreadLocals of the parent thread Set heritage; synchronized(threadMap) { heritage = (Set)threadMap.get(parentThread); } // Note that we don't have to synchronize on the heritage Set // since only this Thread (or the parent Thread when creating // the heritage) ever modifies it. if (heritage != null) { synchronized(threadMap) { threadMap.put(childThread, new HashSet(heritage)); } // And constructs all the new child values // (has to be done now that we are executing in the parentThread) Iterator it = heritage.iterator(); while (it.hasNext()) { InheritableThreadLocal local = (InheritableThreadLocal) it.next(); // Note that the parentValue cannot be null // If it was it would not be in the heritage Object parentValue = local.get(parentThread).getValue(); Object childValue = local.childValue(parentValue); ThreadLocal.Value v = new ThreadLocal.Value(childValue); local.set(childThread, v); } } } }