changeset 10324:db3fb55cc7f4

Merge
author mfang
date Thu, 11 Dec 2014 11:41:44 -0800
parents 0fd9eb32e610 41fd3cb76d9f
children 5c31204d19e5
files
diffstat 34 files changed, 1451 insertions(+), 376 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Wed Dec 10 13:54:12 2014 -0800
+++ b/.hgtags	Thu Dec 11 11:41:44 2014 -0800
@@ -351,3 +351,4 @@
 ffc348308de2e872f5d510d440604c3726a67a18 jdk8u40-b14
 31dac938108da722c56a0526fba7f6ae84773056 jdk8u40-b15
 9dc67d03e6e540f646f27092ed23e94e95fa789e jdk8u40-b16
+fc4f5546417071c70cffd89ca83302309f6f7da9 jdk8u40-b17
--- a/src/macosx/native/sun/awt/AWTWindow.m	Wed Dec 10 13:54:12 2014 -0800
+++ b/src/macosx/native/sun/awt/AWTWindow.m	Thu Dec 11 11:41:44 2014 -0800
@@ -104,6 +104,67 @@
 
 @implementation AWTWindow_Normal
 AWT_NS_WINDOW_IMPLEMENTATION
+
+// Gesture support
+- (void)postGesture:(NSEvent *)event as:(jint)type a:(jdouble)a b:(jdouble)b {
+    AWT_ASSERT_APPKIT_THREAD;
+
+    JNIEnv *env = [ThreadUtilities getJNIEnv];
+    jobject platformWindow = [((AWTWindow *)self.delegate).javaPlatformWindow jObjectWithEnv:env];
+    if (platformWindow != NULL) {
+        // extract the target AWT Window object out of the CPlatformWindow
+        static JNF_MEMBER_CACHE(jf_target, jc_CPlatformWindow, "target", "Ljava/awt/Window;");
+        jobject awtWindow = JNFGetObjectField(env, platformWindow, jf_target);
+        if (awtWindow != NULL) {
+            // translate the point into Java coordinates
+            NSPoint loc = [event locationInWindow];
+            loc.y = [self frame].size.height - loc.y;
+
+            // send up to the GestureHandler to recursively dispatch on the AWT event thread
+            static JNF_CLASS_CACHE(jc_GestureHandler, "com/apple/eawt/event/GestureHandler");
+            static JNF_STATIC_MEMBER_CACHE(sjm_handleGestureFromNative, jc_GestureHandler, "handleGestureFromNative", "(Ljava/awt/Window;IDDDD)V");
+            JNFCallStaticVoidMethod(env, sjm_handleGestureFromNative, awtWindow, type, (jdouble)loc.x, (jdouble)loc.y, (jdouble)a, (jdouble)b);
+            (*env)->DeleteLocalRef(env, awtWindow);
+        }
+        (*env)->DeleteLocalRef(env, platformWindow);
+    }
+}
+
+- (void)beginGestureWithEvent:(NSEvent *)event {
+    [self postGesture:event
+                   as:com_apple_eawt_event_GestureHandler_PHASE
+                    a:-1.0
+                    b:0.0];
+}
+
+- (void)endGestureWithEvent:(NSEvent *)event {
+    [self postGesture:event
+                   as:com_apple_eawt_event_GestureHandler_PHASE
+                    a:1.0
+                    b:0.0];
+}
+
+- (void)magnifyWithEvent:(NSEvent *)event {
+    [self postGesture:event
+                   as:com_apple_eawt_event_GestureHandler_MAGNIFY
+                    a:[event magnification]
+                    b:0.0];
+}
+
+- (void)rotateWithEvent:(NSEvent *)event {
+    [self postGesture:event
+                   as:com_apple_eawt_event_GestureHandler_ROTATE
+                    a:[event rotation]
+                    b:0.0];
+}
+
+- (void)swipeWithEvent:(NSEvent *)event {
+    [self postGesture:event
+                   as:com_apple_eawt_event_GestureHandler_SWIPE
+                    a:[event deltaX]
+                    b:[event deltaY]];
+}
+
 @end
 @implementation AWTWindow_Panel
 AWT_NS_WINDOW_IMPLEMENTATION
@@ -399,67 +460,6 @@
 }
 
 
-// Gesture support
-- (void)postGesture:(NSEvent *)event as:(jint)type a:(jdouble)a b:(jdouble)b {
-AWT_ASSERT_APPKIT_THREAD;
-
-    JNIEnv *env = [ThreadUtilities getJNIEnv];
-    jobject platformWindow = [self.javaPlatformWindow jObjectWithEnv:env];
-    if (platformWindow != NULL) {
-        // extract the target AWT Window object out of the CPlatformWindow
-        static JNF_MEMBER_CACHE(jf_target, jc_CPlatformWindow, "target", "Ljava/awt/Window;");
-        jobject awtWindow = JNFGetObjectField(env, platformWindow, jf_target);
-        if (awtWindow != NULL) {
-            // translate the point into Java coordinates
-            NSPoint loc = [event locationInWindow];
-            loc.y = [self.nsWindow frame].size.height - loc.y;
-
-            // send up to the GestureHandler to recursively dispatch on the AWT event thread
-            static JNF_CLASS_CACHE(jc_GestureHandler, "com/apple/eawt/event/GestureHandler");
-            static JNF_STATIC_MEMBER_CACHE(sjm_handleGestureFromNative, jc_GestureHandler, "handleGestureFromNative", "(Ljava/awt/Window;IDDDD)V");
-            JNFCallStaticVoidMethod(env, sjm_handleGestureFromNative, awtWindow, type, (jdouble)loc.x, (jdouble)loc.y, (jdouble)a, (jdouble)b);
-            (*env)->DeleteLocalRef(env, awtWindow);
-        }
-        (*env)->DeleteLocalRef(env, platformWindow);
-    }
-}
-
-- (void)beginGestureWithEvent:(NSEvent *)event {
-    [self postGesture:event
-                   as:com_apple_eawt_event_GestureHandler_PHASE
-                    a:-1.0
-                    b:0.0];
-}
-
-- (void)endGestureWithEvent:(NSEvent *)event {
-    [self postGesture:event
-                   as:com_apple_eawt_event_GestureHandler_PHASE
-                    a:1.0
-                    b:0.0];
-}
-
-- (void)magnifyWithEvent:(NSEvent *)event {
-    [self postGesture:event
-                   as:com_apple_eawt_event_GestureHandler_MAGNIFY
-                    a:[event magnification]
-                    b:0.0];
-}
-
-- (void)rotateWithEvent:(NSEvent *)event {
-    [self postGesture:event
-                   as:com_apple_eawt_event_GestureHandler_ROTATE
-                    a:[event rotation]
-                    b:0.0];
-}
-
-- (void)swipeWithEvent:(NSEvent *)event {
-    [self postGesture:event
-                   as:com_apple_eawt_event_GestureHandler_SWIPE
-                    a:[event deltaX]
-                    b:[event deltaY]];
-}
-
-
 // NSWindowDelegate methods
 
 - (void) _deliverMoveResizeEvent {
--- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java	Thu Dec 11 11:41:44 2014 -0800
@@ -1285,7 +1285,7 @@
     /**
      * Render different filters
      */
-    public class FilterComboBoxRenderer extends DefaultListCellRenderer implements UIResource {
+    public class FilterComboBoxRenderer extends DefaultListCellRenderer {
         public String getName() {
             // As SynthComboBoxRenderer's are asked for a size BEFORE they
             // are parented getName is overriden to force the name to be
--- a/src/share/classes/com/sun/jndi/ldap/Connection.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/src/share/classes/com/sun/jndi/ldap/Connection.java	Thu Dec 11 11:41:44 2014 -0800
@@ -111,7 +111,6 @@
 
     private static final boolean debug = false;
     private static final int dump = 0; // > 0 r, > 1 rw
-    public static final long DEFAULT_READ_TIMEOUT_MILLIS = 15 * 1000; // 15 second timeout;
 
 
     final private Thread worker;    // Initialized in constructor
@@ -460,10 +459,13 @@
                             // will be woken up before readTimeout only if reply is
                             // available
                             ldr.wait(readTimeout);
+                            waited = true;
                         } else {
-                            ldr.wait(DEFAULT_READ_TIMEOUT_MILLIS);
+                            // no timeout is set so we wait infinitely until
+                            // a response is received
+                            // http://docs.oracle.com/javase/8/docs/technotes/guides/jndi/jndi-ldap.html#PROP
+                            ldr.wait();
                         }
-                        waited = true;
                     } else {
                         break;
                     }
--- a/src/share/classes/java/awt/event/KeyListener.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/src/share/classes/java/awt/event/KeyListener.java	Thu Dec 11 11:41:44 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,7 +44,7 @@
  *
  * @see KeyAdapter
  * @see KeyEvent
- * @see <a href="http://java.sun.com/docs/books/tutorial/post1.0/ui/keylistener.html">Tutorial: Writing a Key Listener</a>
+ * @see <a href="https://docs.oracle.com/javase/tutorial/uiswing/events/keylistener.html">Tutorial: Writing a Key Listener</a>
  *
  * @since 1.1
  */
--- a/src/share/classes/java/lang/System.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/src/share/classes/java/lang/System.java	Thu Dec 11 11:41:44 2014 -0800
@@ -584,7 +584,10 @@
      * <tr><td><code>java.compiler</code></td>
      *     <td>Name of JIT compiler to use</td></tr>
      * <tr><td><code>java.ext.dirs</code></td>
-     *     <td>Path of extension directory or directories</td></tr>
+     *     <td>Path of extension directory or directories
+     *         <b>Deprecated.</b> <i>This property, and the mechanism
+     *            which implements it, may be removed in a future
+     *            release.</i> </td></tr>
      * <tr><td><code>os.name</code></td>
      *     <td>Operating system name</td></tr>
      * <tr><td><code>os.arch</code></td>
--- a/src/share/classes/java/lang/invoke/LambdaForm.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/src/share/classes/java/lang/invoke/LambdaForm.java	Thu Dec 11 11:41:44 2014 -0800
@@ -125,7 +125,7 @@
     MemberName vmentry;   // low-level behavior, or null if not yet prepared
     private boolean isCompiled;
 
-    Object transformCache;  // managed by LambdaFormEditor
+    volatile Object transformCache;  // managed by LambdaFormEditor
 
     public static final int VOID_RESULT = -1, LAST_RESULT = -2;
 
--- a/src/share/classes/java/lang/invoke/LambdaFormBuffer.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/src/share/classes/java/lang/invoke/LambdaFormBuffer.java	Thu Dec 11 11:41:44 2014 -0800
@@ -46,19 +46,16 @@
     private static final int F_TRANS = 0x10, F_OWNED = 0x03;
 
     LambdaFormBuffer(LambdaForm lf) {
-        this(lf.arity, lf.names, lf.result);
+        this.arity = lf.arity;
+        setNames(lf.names);
+        int result = lf.result;
+        if (result == LAST_RESULT)  result = length - 1;
+        if (result >= 0 && lf.names[result].type != V_TYPE)
+            resultName = lf.names[result];
         debugName = lf.debugName;
         assert(lf.nameRefsAreLegal());
     }
 
-    private LambdaFormBuffer(int arity, Name[] names, int result) {
-        this.arity = arity;
-        setNames(names);
-        if (result == LAST_RESULT)  result = length - 1;
-        if (result >= 0 && names[result].type != V_TYPE)
-            resultName = names[result];
-    }
-
     private LambdaForm lambdaForm() {
         assert(!inTrans());  // need endEdit call to tidy things up
         return new LambdaForm(debugName, arity, nameArray(), resultIndex());
--- a/src/share/classes/java/lang/invoke/LambdaFormEditor.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/src/share/classes/java/lang/invoke/LambdaFormEditor.java	Thu Dec 11 11:41:44 2014 -0800
@@ -25,6 +25,7 @@
 
 package java.lang.invoke;
 
+import java.lang.ref.SoftReference;
 import java.util.Arrays;
 import static java.lang.invoke.LambdaForm.*;
 import static java.lang.invoke.LambdaForm.BasicType.*;
@@ -58,10 +59,9 @@
      *  The sequence is unterminated, ending with an indefinite number of zero bytes.
      *  Sequences that are simple (short enough and with small enough values) pack into a 64-bit long.
      */
-    private static final class Transform {
+    private static final class Transform extends SoftReference<LambdaForm> {
         final long packedBytes;
         final byte[] fullBytes;
-        final LambdaForm result;  // result of transform, or null, if there is none available
 
         private enum Kind {
             NO_KIND,  // necessary because ordinal must be greater than zero
@@ -140,9 +140,9 @@
         Kind kind() { return Kind.values()[byteAt(0)]; }
 
         private Transform(long packedBytes, byte[] fullBytes, LambdaForm result) {
+            super(result);
             this.packedBytes = packedBytes;
             this.fullBytes = fullBytes;
-            this.result = result;
         }
         private Transform(long packedBytes) {
             this(packedBytes, null, null);
@@ -243,6 +243,7 @@
                 buf.append("unpacked");
                 buf.append(Arrays.toString(fullBytes));
             }
+            LambdaForm result = get();
             if (result != null) {
                 buf.append(" result=");
                 buf.append(result);
@@ -253,7 +254,7 @@
 
     /** Find a previously cached transform equivalent to the given one, and return its result. */
     private LambdaForm getInCache(Transform key) {
-        assert(key.result == null);
+        assert(key.get() == null);
         // The transformCache is one of null, Transform, Transform[], or ConcurrentHashMap.
         Object c = lambdaForm.transformCache;
         Transform k = null;
@@ -276,7 +277,7 @@
             }
         }
         assert(k == null || key.equals(k));
-        return k == null ? null : k.result;
+        return (k != null) ? k.get() : null;
     }
 
     /** Arbitrary but reasonable limits on Transform[] size for cache. */
@@ -293,7 +294,17 @@
                 @SuppressWarnings("unchecked")
                 ConcurrentHashMap<Transform,Transform> m = (ConcurrentHashMap<Transform,Transform>) c;
                 Transform k = m.putIfAbsent(key, key);
-                return k != null ? k.result : form;
+                if (k == null) return form;
+                LambdaForm result = k.get();
+                if (result != null) {
+                    return result;
+                } else {
+                    if (m.replace(key, k, key)) {
+                        return form;
+                    } else {
+                        continue;
+                    }
+                }
             }
             assert(pass == 0);
             synchronized (lambdaForm) {
@@ -308,17 +319,27 @@
                 if (c instanceof Transform) {
                     Transform k = (Transform)c;
                     if (k.equals(key)) {
-                        return k.result;
+                        LambdaForm result = k.get();
+                        if (result == null) {
+                            lambdaForm.transformCache = key;
+                            return form;
+                        } else {
+                            return result;
+                        }
+                    } else if (k.get() == null) { // overwrite stale entry
+                        lambdaForm.transformCache = key;
+                        return form;
                     }
                     // expand one-element cache to small array
                     ta = new Transform[MIN_CACHE_ARRAY_SIZE];
                     ta[0] = k;
-                    lambdaForm.transformCache = c = ta;
+                    lambdaForm.transformCache = ta;
                 } else {
                     // it is already expanded
                     ta = (Transform[])c;
                 }
                 int len = ta.length;
+                int stale = -1;
                 int i;
                 for (i = 0; i < len; i++) {
                     Transform k = ta[i];
@@ -326,10 +347,18 @@
                         break;
                     }
                     if (k.equals(key)) {
-                        return k.result;
+                        LambdaForm result = k.get();
+                        if (result == null) {
+                            ta[i] = key;
+                            return form;
+                        } else {
+                            return result;
+                        }
+                    } else if (stale < 0 && k.get() == null) {
+                        stale = i; // remember 1st stale entry index
                     }
                 }
-                if (i < len) {
+                if (i < len || stale >= 0) {
                     // just fall through to cache update
                 } else if (len < MAX_CACHE_ARRAY_SIZE) {
                     len = Math.min(len * 2, MAX_CACHE_ARRAY_SIZE);
@@ -344,7 +373,8 @@
                     // The second iteration will update for this query, concurrently.
                     continue;
                 }
-                ta[i] = key;
+                int idx = (stale >= 0) ? stale : i;
+                ta[idx] = key;
                 return form;
             }
         }
--- a/src/share/classes/java/lang/invoke/MethodHandles.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/src/share/classes/java/lang/invoke/MethodHandles.java	Thu Dec 11 11:41:44 2014 -0800
@@ -2029,7 +2029,7 @@
         MethodType oldType = target.type();
         if (oldType == newType)  return target;
         if (oldType.explicitCastEquivalentToAsType(newType)) {
-            return target.asType(newType);
+            return target.asFixedArity().asType(newType);
         }
         return MethodHandleImpl.makePairwiseConvert(target, newType, false);
     }
--- a/src/share/classes/java/lang/invoke/MethodTypeForm.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/src/share/classes/java/lang/invoke/MethodTypeForm.java	Thu Dec 11 11:41:44 2014 -0800
@@ -26,9 +26,8 @@
 package java.lang.invoke;
 
 import sun.invoke.util.Wrapper;
+import java.lang.ref.SoftReference;
 import static java.lang.invoke.MethodHandleStatics.*;
-import static java.lang.invoke.MethodHandleNatives.Constants.*;
- import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
 
 /**
  * Shared information for a group of method types, which differ
@@ -51,7 +50,7 @@
     final MethodType basicType;         // the canonical erasure, with primitives simplified
 
     // Cached adapter information:
-    @Stable final MethodHandle[] methodHandles;
+    @Stable final SoftReference<MethodHandle>[] methodHandles;
     // Indexes into methodHandles:
     static final int
             MH_BASIC_INV      =  0,  // cached instance of MH.invokeBasic
@@ -60,7 +59,7 @@
             MH_LIMIT          =  3;
 
     // Cached lambda form information, for basic types only:
-    final @Stable LambdaForm[] lambdaForms;
+    final @Stable SoftReference<LambdaForm>[] lambdaForms;
     // Indexes into lambdaForms:
     static final int
             LF_INVVIRTUAL              =  0,  // DMH invokeVirtual
@@ -108,26 +107,40 @@
 
     public MethodHandle cachedMethodHandle(int which) {
         assert(assertIsBasicType());
-        return methodHandles[which];
+        SoftReference<MethodHandle> entry = methodHandles[which];
+        return (entry != null) ? entry.get() : null;
     }
 
     synchronized public MethodHandle setCachedMethodHandle(int which, MethodHandle mh) {
         // Simulate a CAS, to avoid racy duplication of results.
-        MethodHandle prev = methodHandles[which];
-        if (prev != null)  return prev;
-        return methodHandles[which] = mh;
+        SoftReference<MethodHandle> entry = methodHandles[which];
+        if (entry != null) {
+            MethodHandle prev = entry.get();
+            if (prev != null) {
+                return prev;
+            }
+        }
+        methodHandles[which] = new SoftReference<>(mh);
+        return mh;
     }
 
     public LambdaForm cachedLambdaForm(int which) {
         assert(assertIsBasicType());
-        return lambdaForms[which];
+        SoftReference<LambdaForm> entry = lambdaForms[which];
+        return (entry != null) ? entry.get() : null;
     }
 
     synchronized public LambdaForm setCachedLambdaForm(int which, LambdaForm form) {
         // Simulate a CAS, to avoid racy duplication of results.
-        LambdaForm prev = lambdaForms[which];
-        if (prev != null) return prev;
-        return lambdaForms[which] = form;
+        SoftReference<LambdaForm> entry = lambdaForms[which];
+        if (entry != null) {
+            LambdaForm prev = entry.get();
+            if (prev != null) {
+                return prev;
+            }
+        }
+        lambdaForms[which] = new SoftReference<>(form);
+        return form;
     }
 
     /**
@@ -135,6 +148,7 @@
      * This MTF will stand for that type and all un-erased variations.
      * Eagerly compute some basic properties of the type, common to all variations.
      */
+    @SuppressWarnings({"rawtypes", "unchecked"})
     protected MethodTypeForm(MethodType erasedType) {
         this.erasedType = erasedType;
 
@@ -234,8 +248,8 @@
 
         // Initialize caches, but only for basic types
         assert(basicType == erasedType);
-        this.lambdaForms = new LambdaForm[LF_LIMIT];
-        this.methodHandles = new MethodHandle[MH_LIMIT];
+        this.lambdaForms   = new SoftReference[LF_LIMIT];
+        this.methodHandles = new SoftReference[MH_LIMIT];
     }
 
     private static long pack(int a, int b, int c, int d) {
@@ -409,5 +423,4 @@
     public String toString() {
         return "Form"+erasedType;
     }
-
 }
--- a/src/share/classes/java/util/SplittableRandom.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/src/share/classes/java/util/SplittableRandom.java	Thu Dec 11 11:41:44 2014 -0800
@@ -25,7 +25,6 @@
 
 package java.util;
 
-import java.net.NetworkInterface;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.function.IntConsumer;
 import java.util.function.LongConsumer;
@@ -140,11 +139,10 @@
      * other cases, this split must be performed in a thread-safe
      * manner, so we use an AtomicLong to represent the seed rather
      * than use an explicit SplittableRandom. To bootstrap the
-     * defaultGen, we start off using a seed based on current time and
-     * network interface address unless the java.util.secureRandomSeed
-     * property is set. This serves as a slimmed-down (and insecure)
-     * variant of SecureRandom that also avoids stalls that may occur
-     * when using /dev/random.
+     * defaultGen, we start off using a seed based on current time
+     * unless the java.util.secureRandomSeed property is set. This
+     * serves as a slimmed-down (and insecure) variant of SecureRandom
+     * that also avoids stalls that may occur when using /dev/random.
      *
      * It is a relatively simple matter to apply the basic design here
      * to use 128 bit seeds. However, emulating 128bit arithmetic and
@@ -237,34 +235,7 @@
                 s = (s << 8) | ((long)(seedBytes[i]) & 0xffL);
             return s;
         }
-        long h = 0L;
-        try {
-            Enumeration<NetworkInterface> ifcs =
-                    NetworkInterface.getNetworkInterfaces();
-            boolean retry = false; // retry once if getHardwareAddress is null
-            while (ifcs.hasMoreElements()) {
-                NetworkInterface ifc = ifcs.nextElement();
-                if (!ifc.isVirtual()) { // skip fake addresses
-                    byte[] bs = ifc.getHardwareAddress();
-                    if (bs != null) {
-                        int n = bs.length;
-                        int m = Math.min(n >>> 1, 4);
-                        for (int i = 0; i < m; ++i)
-                            h = (h << 16) ^ (bs[i] << 8) ^ bs[n-1-i];
-                        if (m < 4)
-                            h = (h << 8) ^ bs[n-1-m];
-                        h = mix64(h);
-                        break;
-                    }
-                    else if (!retry)
-                        retry = true;
-                    else
-                        break;
-                }
-            }
-        } catch (Exception ignore) {
-        }
-        return (h ^ mix64(System.currentTimeMillis()) ^
+        return (mix64(System.currentTimeMillis()) ^
                 mix64(System.nanoTime()));
     }
 
--- a/src/share/classes/java/util/concurrent/ThreadLocalRandom.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/src/share/classes/java/util/concurrent/ThreadLocalRandom.java	Thu Dec 11 11:41:44 2014 -0800
@@ -36,8 +36,6 @@
 package java.util.concurrent;
 
 import java.io.ObjectStreamField;
-import java.net.NetworkInterface;
-import java.util.Enumeration;
 import java.util.Random;
 import java.util.Spliterator;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -147,34 +145,7 @@
                 s = (s << 8) | ((long)(seedBytes[i]) & 0xffL);
             return s;
         }
-        long h = 0L;
-        try {
-            Enumeration<NetworkInterface> ifcs =
-                    NetworkInterface.getNetworkInterfaces();
-            boolean retry = false; // retry once if getHardwareAddress is null
-            while (ifcs.hasMoreElements()) {
-                NetworkInterface ifc = ifcs.nextElement();
-                if (!ifc.isVirtual()) { // skip fake addresses
-                    byte[] bs = ifc.getHardwareAddress();
-                    if (bs != null) {
-                        int n = bs.length;
-                        int m = Math.min(n >>> 1, 4);
-                        for (int i = 0; i < m; ++i)
-                            h = (h << 16) ^ (bs[i] << 8) ^ bs[n-1-i];
-                        if (m < 4)
-                            h = (h << 8) ^ bs[n-1-m];
-                        h = mix64(h);
-                        break;
-                    }
-                    else if (!retry)
-                        retry = true;
-                    else
-                        break;
-                }
-            }
-        } catch (Exception ignore) {
-        }
-        return (h ^ mix64(System.currentTimeMillis()) ^
+        return (mix64(System.currentTimeMillis()) ^
                 mix64(System.nanoTime()));
     }
 
--- a/src/share/classes/java/util/jar/Attributes.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/src/share/classes/java/util/jar/Attributes.java	Thu Dec 11 11:41:44 2014 -0800
@@ -550,8 +550,8 @@
          * <code>Name</code> object for <code>Class-Path</code>
          * manifest attribute. Bundled extensions can use this attribute
          * to find other JAR files containing needed classes.
-         * @see <a href="../../../../technotes/guides/extensions/spec.html#bundled">
-         *      Extensions Specification</a>
+         * @see <a href="../../../../technotes/guides/jar/jar.html#classpath">
+         *      JAR file specification</a>
          */
         public static final Name CLASS_PATH = new Name("Class-Path");
 
@@ -567,8 +567,8 @@
         /**
          * <code>Name</code> object for <code>Sealed</code> manifest attribute
          * used for sealing.
-         * @see <a href="../../../../technotes/guides/extensions/spec.html#sealing">
-         *      Extension Sealing</a>
+         * @see <a href="../../../../technotes/guides/jar/jar.html#sealing">
+         *      Package Sealing</a>
          */
         public static final Name SEALED = new Name("Sealed");
 
@@ -591,9 +591,12 @@
         /**
          * <code>Name</code> object for <code>Extension-Name</code> manifest attribute
          * used for declaring dependencies on installed extensions.
+         * @deprecated Extension mechanism will be removed in a future release.
+         *             Use class path instead.
          * @see <a href="../../../../technotes/guides/extensions/spec.html#dependency">
          *      Installed extension dependency</a>
          */
+        @Deprecated
         public static final Name EXTENSION_INSTALLATION = new Name("Extension-Installation");
 
         /**
@@ -623,17 +626,23 @@
         /**
          * <code>Name</code> object for <code>Implementation-Vendor-Id</code>
          * manifest attribute used for package versioning.
-         * @see <a href="../../../../technotes/guides/versioning/spec/versioning2.html#wp90779">
-         *      Java Product Versioning Specification</a>
+         * @deprecated Extension mechanism will be removed in a future release.
+         *             Use class path instead.
+         * @see <a href="../../../../technotes/guides/extensions/versioning.html#applet">
+         *      Optional Package Versioning</a>
          */
+        @Deprecated
         public static final Name IMPLEMENTATION_VENDOR_ID = new Name("Implementation-Vendor-Id");
 
        /**
          * <code>Name</code> object for <code>Implementation-URL</code>
          * manifest attribute used for package versioning.
-         * @see <a href="../../../../technotes/guides/versioning/spec/versioning2.html#wp90779">
-         *      Java Product Versioning Specification</a>
+         * @deprecated Extension mechanism will be removed in a future release.
+         *             Use class path instead.
+         * @see <a href="../../../../technotes/guides/extensions/versioning.html#applet">
+         *      Optional Package Versioning</a>
          */
+        @Deprecated
         public static final Name IMPLEMENTATION_URL = new Name("Implementation-URL");
 
         /**
--- a/src/share/classes/java/util/logging/LogManager.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/src/share/classes/java/util/logging/LogManager.java	Thu Dec 11 11:41:44 2014 -0800
@@ -502,11 +502,11 @@
         JavaAWTAccess javaAwtAccess = SharedSecrets.getJavaAWTAccess();
         if (sm != null && javaAwtAccess != null) {
             // for each applet, it has its own LoggerContext isolated from others
-            synchronized (javaAwtAccess) {
-                // find the AppContext of the applet code
-                // will be null if we are in the main app context.
-                final Object ecx = javaAwtAccess.getAppletContext();
-                if (ecx != null) {
+            final Object ecx = javaAwtAccess.getAppletContext();
+            if (ecx != null) {
+                synchronized (javaAwtAccess) {
+                    // find the AppContext of the applet code
+                    // will be null if we are in the main app context.
                     if (contextsMap == null) {
                         contextsMap = new WeakHashMap<>();
                     }
--- a/src/share/classes/sun/awt/datatransfer/DataTransferer.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/src/share/classes/sun/awt/datatransfer/DataTransferer.java	Thu Dec 11 11:41:44 2014 -0800
@@ -274,7 +274,7 @@
      * instead, null will be returned.
      */
     public static synchronized DataTransferer getInstance() {
-        return ((SunToolkit) Toolkit.getDefaultToolkit()).getDataTransferer();
+        return ((ComponentFactory) Toolkit.getDefaultToolkit()).getDataTransferer();
     }
 
     /**
--- a/src/share/classes/sun/awt/image/MultiResolutionToolkitImage.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/src/share/classes/sun/awt/image/MultiResolutionToolkitImage.java	Thu Dec 11 11:41:44 2014 -0800
@@ -80,7 +80,7 @@
         }
 
         synchronized (ObserverCache.INSTANCE) {
-            ImageObserver o = (ImageObserver) ObserverCache.INSTANCE.get(image);
+            ImageObserver o = (ImageObserver) ObserverCache.INSTANCE.get(observer);
 
             if (o == null) {
 
@@ -109,7 +109,7 @@
                                     image, flags, x, y, width, height);
                         };
 
-                ObserverCache.INSTANCE.put(image, o);
+                ObserverCache.INSTANCE.put(observer, o);
             }
             return o;
         }
--- a/src/solaris/classes/sun/awt/X11/XToolkit.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/src/solaris/classes/sun/awt/X11/XToolkit.java	Thu Dec 11 11:41:44 2014 -0800
@@ -102,11 +102,11 @@
     static TreeMap winMap = new TreeMap();
     static HashMap specialPeerMap = new HashMap();
     static HashMap winToDispatcher = new HashMap();
-    private static long _display;
     static UIDefaults uidefaults;
-    static X11GraphicsEnvironment localEnv;
-    static X11GraphicsDevice device;
-    static final X11GraphicsConfig config;
+    static final X11GraphicsEnvironment localEnv;
+    private static final X11GraphicsDevice device;
+    private static final X11GraphicsConfig config;
+    private static final long display;
     static int awt_multiclick_time;
     static boolean securityWarningEnabled;
 
@@ -117,15 +117,16 @@
     static {
         initSecurityWarning();
         if (GraphicsEnvironment.isHeadless()) {
+            localEnv = null;
+            device = null;
             config = null;
+            display = 0;
         } else {
             localEnv = (X11GraphicsEnvironment) GraphicsEnvironment
                 .getLocalGraphicsEnvironment();
             device = (X11GraphicsDevice) localEnv.getDefaultScreenDevice();
-            config = (X11GraphicsConfig) (device.getDefaultConfiguration());
-            if (device != null) {
-                _display = device.getDisplay();
-            }
+            config = (X11GraphicsConfig) device.getDefaultConfiguration();
+            display = device.getDisplay();
             setupModifierMap();
             initIDs();
             setBackingStoreType();
@@ -196,10 +197,18 @@
         }
     }
 
-    static Object displayLock = new Object();
-
+    /**
+     * Returns the X11 Display of the default screen device.
+     *
+     * @return X11 Display
+     * @throws AWTError thrown if local GraphicsEnvironment is null, which
+     *         means we are in the headless environment
+     */
     public static long getDisplay() {
-        return _display;
+        if (localEnv == null) {
+            throw new AWTError("Local GraphicsEnvironment must not be null");
+        }
+        return display;
     }
 
     public static long getDefaultRootWindow() {
--- a/test/com/sun/jndi/ldap/LdapTimeoutTest.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/test/com/sun/jndi/ldap/LdapTimeoutTest.java	Thu Dec 11 11:41:44 2014 -0800
@@ -28,144 +28,59 @@
  * @summary Timeout tests for ldap
  */
 
-import com.sun.jndi.ldap.Connection;
-
 import java.net.Socket;
 import java.net.ServerSocket;
 import java.net.SocketTimeoutException;
 import java.io.*;
 import javax.naming.*;
 import javax.naming.directory.*;
+import java.util.List;
 import java.util.Hashtable;
+import java.util.ArrayList;
 import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Executors;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeoutException;
+import java.util.concurrent.TimeUnit;
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
 import static java.util.concurrent.TimeUnit.NANOSECONDS;
 
-public class LdapTimeoutTest {
 
-    static volatile int passed = 0, failed = 0;
-    static void pass() {passed++;}
-    static void fail() {failed++; Thread.dumpStack();}
+abstract class LdapTest implements Callable {
 
-    public static void main(String[] args) throws Exception {
-        ServerSocket serverSock = new ServerSocket(0);
-        Server s = new Server(serverSock);
-        s.start();
-        Thread.sleep(200);
+    Hashtable env;
+    TestServer server;
+    ScheduledExecutorService killSwitchPool;
+    boolean passed = false;
+    private int HANGING_TEST_TIMEOUT = 20_000;
 
-        Hashtable env = new Hashtable(11);
-        env.put(Context.INITIAL_CONTEXT_FACTORY,
-            "com.sun.jndi.ldap.LdapCtxFactory");
-        env.put(Context.PROVIDER_URL, "ldap://localhost:" +
-            serverSock.getLocalPort());
-
-        env.put(Context.SECURITY_AUTHENTICATION,"simple");
-
-        env.put(Context.SECURITY_PRINCIPAL, "user");
-        env.put(Context.SECURITY_CREDENTIALS, "password");
-
-        InitialContext ctx = null;
-        try {
-            new LdapTimeoutTest().deadServerNoTimeout(env);
-
-            env.put("com.sun.jndi.ldap.connect.timeout", "10");
-            env.put("com.sun.jndi.ldap.read.timeout", "3000");
-            new LdapTimeoutTest().ldapReadTimeoutTest(env, false);
-            new LdapTimeoutTest().ldapReadTimeoutTest(env, true);
-            new LdapTimeoutTest().simpleAuthConnectTest(env);
-        } finally {
-            s.interrupt();
-        }
-
-        System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
-        if (failed > 0) throw new AssertionError("Some tests failed");
+    public LdapTest (TestServer server, Hashtable env) {
+        this.server = server;
+        this.env = env;
     }
 
-    void ldapReadTimeoutTest(Hashtable env, boolean ssl) {
-        InitialContext ctx = null;
-        if (ssl) env.put(Context.SECURITY_PROTOCOL, "ssl");
-        long start = System.nanoTime();
-        try {
-            ctx = new InitialDirContext(env);
-            SearchControls scl = new SearchControls();
-            scl.setSearchScope(SearchControls.SUBTREE_SCOPE);
-            NamingEnumeration<SearchResult> answer = ((InitialDirContext)ctx)
-                .search("ou=People,o=JNDITutorial", "(objectClass=*)", scl);
-            // shouldn't reach here
-            fail();
-        } catch (NamingException e) {
-            if (ssl) {
-                if (e.getCause() instanceof SocketTimeoutException) {
-                    pass();
-                } else if (e.getCause() instanceof InterruptedIOException) {
-                    Thread.interrupted();
-                    fail();
-                }
-            } else {
-                pass();
-            }
-        } finally {
-            if (!shutItDown(ctx)) fail();
-        }
+    public LdapTest(TestServer server, Hashtable env,
+            ScheduledExecutorService killSwitchPool)
+    {
+        this(server, env);
+        this.killSwitchPool = killSwitchPool;
     }
 
-    void simpleAuthConnectTest(Hashtable env) {
-        InitialContext ctx = null;
-        long start = System.nanoTime();
-        try {
-            ctx = new InitialDirContext(env);
-            // shouldn't reach here
-            System.err.println("Fail: InitialDirContext succeeded");
-            fail();
-        } catch (NamingException e) {
-            long end = System.nanoTime();
-            if (e.getCause() instanceof SocketTimeoutException) {
-                if (NANOSECONDS.toMillis(end - start) < 2_900) {
-                    pass();
-                } else {
-                    System.err.println("Fail: Waited too long");
-                    fail();
-                }
-            } else if (e.getCause() instanceof InterruptedIOException) {
-                Thread.interrupted();
-                fail();
-            } else {
-                fail();
-            }
-        } finally {
-            if (!shutItDown(ctx)) fail();
-        }
+    public abstract void performOp(InitialContext ctx) throws NamingException;
+    public abstract void handleNamingException(
+        NamingException e, long start, long end);
+
+    public void pass() {
+        this.passed = true;
     }
 
-    void deadServerNoTimeout(Hashtable env) {
-        InitialContext ctx = null;
-        long start = System.currentTimeMillis();
-        try {
-            ctx = new InitialDirContext(env);
-            SearchControls scl = new SearchControls();
-            scl.setSearchScope(SearchControls.SUBTREE_SCOPE);
-            NamingEnumeration<SearchResult> answer = ((InitialDirContext)ctx)
-                .search("ou=People,o=JNDITutorial", "(objectClass=*)", scl);
-            // shouldn't reach here
-            fail();
-        } catch (NamingException e) {
-            long elapsed = System.currentTimeMillis() - start;
-            if (elapsed < Connection.DEFAULT_READ_TIMEOUT_MILLIS) {
-                System.err.printf("fail: timeout should be at least %s ms, " +
-                                "actual time is %s ms%n",
-                        Connection.DEFAULT_READ_TIMEOUT_MILLIS, elapsed);
-                e.printStackTrace();
-                fail();
-            } else {
-                pass();
-            }
-        } finally {
-            if (!shutItDown(ctx)) fail();
-        }
+    public void fail() {
+        throw new RuntimeException("Test failed");
     }
 
     boolean shutItDown(InitialContext ctx) {
@@ -177,18 +92,376 @@
         }
     }
 
-    static class Server extends Thread {
-        final ServerSocket serverSock;
+    public Boolean call() {
+        InitialContext ctx = null;
+        ScheduledFuture killer = null;
+        long start = System.nanoTime();
 
-        Server(ServerSocket serverSock) {
-            this.serverSock = serverSock;
-        }
+        try {
+            while(!server.accepting())
+                Thread.sleep(200); // allow the server to start up
+            Thread.sleep(200); // to be sure
 
-        public void run() {
+            // if this is a hanging test, scheduled a thread to
+            // interrupt after a certain time
+            if (killSwitchPool != null) {
+                final Thread current = Thread.currentThread();
+                killer = killSwitchPool.schedule(
+                    new Callable<Void>() {
+                        public Void call() throws Exception {
+                            current.interrupt();
+                            return null;
+                        }
+                    }, HANGING_TEST_TIMEOUT, MILLISECONDS);
+            }
+
+            env.put(Context.PROVIDER_URL, "ldap://localhost:" +
+                    server.getLocalPort());
+
             try {
-                Socket socket = serverSock.accept();
-            } catch (IOException e) {}
+                ctx = new InitialDirContext(env);
+                performOp(ctx);
+                fail();
+            } catch (NamingException e) {
+                long end = System.nanoTime();
+                System.out.println(this.getClass().toString() + " - elapsed: "
+                        + NANOSECONDS.toMillis(end - start));
+                handleNamingException(e, start, end);
+            } finally {
+                if (killer != null && !killer.isDone())
+                    killer.cancel(true);
+                shutItDown(ctx);
+                server.close();
+            }
+            return passed;
+        } catch (IOException|InterruptedException e) {
+            throw new RuntimeException(e);
         }
     }
 }
 
+abstract class ReadServerTest extends LdapTest {
+
+    public ReadServerTest(Hashtable env) throws IOException {
+        super(new BindableServer(), env);
+    }
+
+    public ReadServerTest(Hashtable env,
+                          ScheduledExecutorService killSwitchPool)
+            throws IOException
+    {
+        super(new BindableServer(), env, killSwitchPool);
+    }
+
+    public void performOp(InitialContext ctx) throws NamingException {
+        SearchControls scl = new SearchControls();
+        scl.setSearchScope(SearchControls.SUBTREE_SCOPE);
+        NamingEnumeration<SearchResult> answer = ((InitialDirContext)ctx)
+            .search("ou=People,o=JNDITutorial", "(objectClass=*)", scl);
+    }
+}
+
+abstract class DeadServerTest extends LdapTest {
+
+    public DeadServerTest(Hashtable env) throws IOException {
+        super(new DeadServer(), env);
+    }
+
+    public DeadServerTest(Hashtable env,
+                          ScheduledExecutorService killSwitchPool)
+            throws IOException
+    {
+        super(new DeadServer(), env, killSwitchPool);
+    }
+
+    public void performOp(InitialContext ctx) throws NamingException {}
+}
+
+class DeadServerNoTimeoutTest extends DeadServerTest {
+
+    public DeadServerNoTimeoutTest(Hashtable env,
+                                   ScheduledExecutorService killSwitchPool)
+            throws IOException
+    {
+        super(env, killSwitchPool);
+    }
+
+    public void handleNamingException(NamingException e, long start, long end) {
+        if (e instanceof InterruptedNamingException) Thread.interrupted();
+
+        if (NANOSECONDS.toMillis(end - start) < LdapTimeoutTest.MIN_TIMEOUT) {
+            System.err.printf("DeadServerNoTimeoutTest fail: timeout should be " +
+                              "at least %s ms, actual time is %s ms%n",
+                              LdapTimeoutTest.MIN_TIMEOUT,
+                              NANOSECONDS.toMillis(end - start));
+            fail();
+        } else {
+            pass();
+        }
+    }
+}
+
+class DeadServerTimeoutTest extends DeadServerTest {
+
+    public DeadServerTimeoutTest(Hashtable env) throws IOException {
+        super(env);
+    }
+
+    public void handleNamingException(NamingException e, long start, long end)
+    {
+        // non SSL connect will timeout via readReply using connectTimeout
+        if (NANOSECONDS.toMillis(end - start) < 2_900) {
+            pass();
+        } else {
+            System.err.println("Fail: Waited too long");
+            fail();
+        }
+    }
+}
+
+class DeadServerTimeoutSSLTest extends DeadServerTest {
+
+    public DeadServerTimeoutSSLTest(Hashtable env) throws IOException {
+        super(env);
+    }
+
+    public void handleNamingException(NamingException e, long start, long end) {
+        if (e.getCause() instanceof SocketTimeoutException) {
+            // SSL connect will timeout via readReply using
+            // SocketTimeoutException
+            pass();
+        } else {
+            fail();
+        }
+    }
+}
+
+
+class ReadServerNoTimeoutTest extends ReadServerTest {
+
+    public ReadServerNoTimeoutTest(Hashtable env,
+                                   ScheduledExecutorService killSwitchPool)
+            throws IOException
+    {
+        super(env, killSwitchPool);
+    }
+
+    public void handleNamingException(NamingException e, long start, long end) {
+        if (e instanceof InterruptedNamingException) Thread.interrupted();
+
+        if (NANOSECONDS.toMillis(end - start) < LdapTimeoutTest.MIN_TIMEOUT) {
+            System.err.printf("ReadServerNoTimeoutTest fail: timeout should be " +
+                              "at least %s ms, actual time is %s ms%n",
+                              LdapTimeoutTest.MIN_TIMEOUT,
+                              NANOSECONDS.toMillis(end - start));
+            fail();
+        } else {
+            pass();
+        }
+    }
+}
+
+class ReadServerTimeoutTest extends ReadServerTest {
+
+    public ReadServerTimeoutTest(Hashtable env) throws IOException {
+        super(env);
+    }
+
+    public void handleNamingException(NamingException e, long start, long end) {
+        if (NANOSECONDS.toMillis(end - start) < 2_900) {
+            fail();
+        } else {
+            pass();
+        }
+    }
+}
+
+class TestServer extends Thread {
+    ServerSocket serverSock;
+    boolean accepting = false;
+
+    public TestServer() throws IOException {
+        this.serverSock = new ServerSocket(0);
+        start();
+    }
+
+    public int getLocalPort() {
+        return serverSock.getLocalPort();
+    }
+
+    public boolean accepting() {
+        return accepting;
+    }
+
+    public void close() throws IOException {
+        serverSock.close();
+    }
+}
+
+class BindableServer extends TestServer {
+
+    public BindableServer() throws IOException {
+        super();
+    }
+
+    private byte[] bindResponse = {
+        0x30, 0x0C, 0x02, 0x01, 0x01, 0x61, 0x07, 0x0A,
+        0x01, 0x00, 0x04, 0x00, 0x04, 0x00
+    };
+
+    public void run() {
+        try {
+            accepting = true;
+            Socket socket = serverSock.accept();
+            InputStream in = socket.getInputStream();
+            OutputStream out = socket.getOutputStream();
+
+            // Read the LDAP BindRequest
+            while (in.read() != -1) {
+                in.skip(in.available());
+                break;
+            }
+
+            // Write an LDAP BindResponse
+            out.write(bindResponse);
+            out.flush();
+        } catch (IOException e) {
+            // ignore
+        }
+    }
+}
+
+class DeadServer extends TestServer {
+
+    public DeadServer() throws IOException {
+        super();
+    }
+
+    public void run() {
+        while(true) {
+            try {
+                accepting = true;
+                Socket socket = serverSock.accept();
+            } catch (Exception e) {
+                break;
+            }
+        }
+    }
+}
+
+public class LdapTimeoutTest {
+
+    private static final ExecutorService testPool =
+        Executors.newFixedThreadPool(3);
+    private static final ScheduledExecutorService killSwitchPool =
+        Executors.newScheduledThreadPool(3);
+    public static int MIN_TIMEOUT = 18_000;
+
+    static Hashtable createEnv() {
+        Hashtable env = new Hashtable(11);
+        env.put(Context.INITIAL_CONTEXT_FACTORY,
+            "com.sun.jndi.ldap.LdapCtxFactory");
+        return env;
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        InitialContext ctx = null;
+        List<Future> results = new ArrayList<>();
+
+        try {
+            // run the DeadServerTest with no timeouts set
+            // this should get stuck indefinitely, so we need to kill
+            // it after a timeout
+            System.out.println("Running connect timeout test with 20s kill switch");
+            Hashtable env = createEnv();
+            results.add(
+                    testPool.submit(new DeadServerNoTimeoutTest(env, killSwitchPool)));
+
+            // run the ReadServerTest with connect timeout set
+            // this should get stuck indefinitely so we need to kill
+            // it after a timeout
+            System.out.println("Running read timeout test with 10ms connect timeout & 20s kill switch");
+            Hashtable env1 = createEnv();
+            env1.put("com.sun.jndi.ldap.connect.timeout", "10");
+            results.add(testPool.submit(
+                    new ReadServerNoTimeoutTest(env1, killSwitchPool)));
+
+            // run the ReadServerTest with no timeouts set
+            // this should get stuck indefinitely, so we need to kill
+            // it after a timeout
+            System.out.println("Running read timeout test with 20s kill switch");
+            Hashtable env2 = createEnv();
+            results.add(testPool.submit(
+                    new ReadServerNoTimeoutTest(env2, killSwitchPool)));
+
+            // run the DeadServerTest with connect / read timeouts set
+            // this should exit after the connect timeout expires
+            System.out.println("Running connect timeout test with 10ms connect timeout, 3000ms read timeout");
+            Hashtable env3 = createEnv();
+            env3.put("com.sun.jndi.ldap.connect.timeout", "10");
+            env3.put("com.sun.jndi.ldap.read.timeout", "3000");
+            results.add(testPool.submit(new DeadServerTimeoutTest(env3)));
+
+
+            // run the ReadServerTest with connect / read timeouts set
+            // this should exit after the connect timeout expires
+            System.out.println("Running read timeout test with 10ms connect timeout, 3000ms read timeout");
+            Hashtable env4 = createEnv();
+            env4.put("com.sun.jndi.ldap.connect.timeout", "10");
+            env4.put("com.sun.jndi.ldap.read.timeout", "3000");
+            results.add(testPool.submit(new ReadServerTimeoutTest(env4)));
+
+            // run the DeadServerTest with connect timeout set
+            // this should exit after the connect timeout expires
+            System.out.println("Running connect timeout test with 10ms connect timeout");
+            Hashtable env5 = createEnv();
+            env5.put("com.sun.jndi.ldap.connect.timeout", "10");
+            results.add(testPool.submit(new DeadServerTimeoutTest(env5)));
+
+            // 8000487: Java JNDI connection library on ldap conn is
+            // not honoring configured timeout
+            System.out.println("Running simple auth connection test");
+            Hashtable env6 = createEnv();
+            env6.put("com.sun.jndi.ldap.connect.timeout", "10");
+            env6.put("com.sun.jndi.ldap.read.timeout", "3000");
+            env6.put(Context.SECURITY_AUTHENTICATION, "simple");
+            env6.put(Context.SECURITY_PRINCIPAL, "user");
+            env6.put(Context.SECURITY_CREDENTIALS, "password");
+            results.add(testPool.submit(new DeadServerTimeoutTest(env6)));
+
+            boolean testFailed = false;
+            for (Future test : results) {
+                while (!test.isDone()) {
+                    if ((Boolean) test.get() == false)
+                        testFailed = true;
+                }
+            }
+
+            //
+            // Running this test serially as it seems to tickle a problem
+            // on older kernels
+            //
+            // run the DeadServerTest with connect / read timeouts set
+            // and ssl enabled
+            // this should exit with a SocketTimeoutException as the root cause
+            // it should also use the connect timeout instead of the read timeout
+            System.out.println("Running connect timeout test with 10ms connect timeout, 3000ms read timeout & SSL");
+            Hashtable sslenv = createEnv();
+            sslenv.put("com.sun.jndi.ldap.connect.timeout", "10");
+            sslenv.put("com.sun.jndi.ldap.read.timeout", "3000");
+            sslenv.put(Context.SECURITY_PROTOCOL, "ssl");
+            testFailed = (new DeadServerTimeoutSSLTest(sslenv).call()) ? false : true;
+
+            if (testFailed) {
+                throw new AssertionError("some tests failed");
+            }
+
+        } finally {
+            LdapTimeoutTest.killSwitchPool.shutdown();
+            LdapTimeoutTest.testPool.shutdown();
+        }
+    }
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/image/MultiResolutionImage/MultiResolutionImageObserverTest.java	Thu Dec 11 11:41:44 2014 -0800
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.Toolkit;
+import java.awt.image.BufferedImage;
+import java.awt.image.ImageObserver;
+import static java.awt.image.ImageObserver.*;
+import java.io.File;
+import javax.imageio.ImageIO;
+/*
+ * @test
+ * @bug 8065627
+ * @summary Animated GIFs fail to display on a HiDPI display
+ * @author Alexander Scherbatiy
+ * @run main MultiResolutionImageObserverTest
+ */
+
+public class MultiResolutionImageObserverTest {
+
+    private static final int TIMEOUT = 500;
+
+    public static void main(String[] args) throws Exception {
+
+        generateImages();
+        Toolkit toolkit = Toolkit.getDefaultToolkit();
+        Image image = Toolkit.getDefaultToolkit().getImage(IMAGE_NAME_1X);
+
+        LoadImageObserver sizeObserver
+                = new LoadImageObserver(WIDTH | HEIGHT);
+        toolkit.prepareImage(image, -1, -1, sizeObserver);
+        waitForImageLoading(sizeObserver, "The first observer is not called");
+
+        LoadImageObserver bitsObserver
+                = new LoadImageObserver(SOMEBITS | FRAMEBITS | ALLBITS);
+
+        BufferedImage buffImage = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
+        Graphics2D g2d = (Graphics2D) buffImage.createGraphics();
+        g2d.scale(2, 2);
+        g2d.drawImage(image, 0, 0, bitsObserver);
+        waitForImageLoading(bitsObserver, "The second observer is not called!");
+        g2d.dispose();
+    }
+
+    private static void waitForImageLoading(LoadImageObserver observer,
+            String errorMessage) throws Exception {
+
+        long endTime = System.currentTimeMillis() + TIMEOUT;
+
+        while (!observer.loaded && System.currentTimeMillis() < endTime) {
+            Thread.sleep(TIMEOUT / 10);
+        }
+
+        if (!observer.loaded) {
+            throw new RuntimeException(errorMessage);
+        }
+    }
+
+    private static final String IMAGE_NAME_1X = "image.png";
+    private static final String IMAGE_NAME_2X = "image@2x.png";
+
+    private static void generateImages() throws Exception {
+        generateImage(1);
+        generateImage(2);
+    }
+
+    private static void generateImage(int scale) throws Exception {
+        BufferedImage image = new BufferedImage(
+                scale * 200, scale * 300,
+                BufferedImage.TYPE_INT_RGB);
+        Graphics g = image.createGraphics();
+        g.setColor(scale == 1 ? Color.GREEN : Color.BLUE);
+        g.fillRect(0, 0, scale * 200, scale * 300);
+        File file = new File(scale == 1 ? IMAGE_NAME_1X : IMAGE_NAME_2X);
+        ImageIO.write(image, "png", file);
+        g.dispose();
+    }
+
+    private static class LoadImageObserver implements ImageObserver {
+
+        private final int infoflags;
+        private boolean loaded;
+
+        public LoadImageObserver(int flags) {
+            this.infoflags = flags;
+        }
+
+        @Override
+        public boolean imageUpdate(Image img, int flags, int x, int y, int width, int height) {
+
+            if ((flags & infoflags) != 0) {
+                loaded = true;
+            }
+
+            return !loaded;
+        }
+    }
+}
--- a/test/java/lang/invoke/ExplicitCastArgumentsTest.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/test/java/lang/invoke/ExplicitCastArgumentsTest.java	Thu Dec 11 11:41:44 2014 -0800
@@ -32,21 +32,36 @@
  */
 public class ExplicitCastArgumentsTest {
     private static final boolean VERBOSE = Boolean.getBoolean("verbose");
+    private static final Class<?> THIS_CLASS = ExplicitCastArgumentsTest.class;
 
     public static void main(String[] args) throws Throwable {
+        testVarargsCollector();
+        testRef2Prim();
+        System.out.println("TEST PASSED");
+    }
+
+    public static String[] f(String... args) { return args; }
+
+    public static void testVarargsCollector() throws Throwable {
+        MethodType mt = MethodType.methodType(String[].class, String[].class);
+        MethodHandle mh = MethodHandles.publicLookup().findStatic(THIS_CLASS, "f", mt);
+        mh = MethodHandles.explicitCastArguments(mh, MethodType.methodType(Object.class, Object.class));
+        mh.invokeWithArguments((Object)(new String[] {"str1", "str2"}));
+    }
+
+    public static void testRef2Prim() throws Throwable {
         for (Wrapper from : Wrapper.values()) {
             for (Wrapper to : Wrapper.values()) {
                 if (from == Wrapper.VOID || to == Wrapper.VOID) continue;
-                testRef2Prim (from, to);
+                testRef2Prim(from, to);
             }
         }
-        System.out.println("TEST PASSED");
     }
 
     public static void testRef2Prim(Wrapper from, Wrapper to) throws Throwable {
         // MHs.eCA javadoc:
         //    If T0 is a reference and T1 a primitive, and if the reference is null at runtime, a zero value is introduced.
-        test(from.wrapperType(), to.primitiveType(),        null, false);
+        test(from.wrapperType(), to.primitiveType(), null, false);
     }
 
     public static void test(Class<?> from, Class<?> to, Object param, boolean failureExpected) throws Throwable {
--- a/test/java/lang/invoke/LFCaching/LFCachingTestCase.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/test/java/lang/invoke/LFCaching/LFCachingTestCase.java	Thu Dec 11 11:41:44 2014 -0800
@@ -63,12 +63,17 @@
             }
 
             if (lambdaForm0 != lambdaForm1) {
-                System.err.println("Lambda form 0 toString is:");
-                System.err.println(lambdaForm0);
-                System.err.println("Lambda form 1 toString is:");
-                System.err.println(lambdaForm1);
-                throw new AssertionError("Error: Lambda forms of the two method handles"
-                        + " are not the same. LF cahing does not work");
+                // Since LambdaForm caches are based on SoftReferences, GC can cause element eviction.
+                if (noGCHappened()) {
+                    System.err.println("Lambda form 0 toString is:");
+                    System.err.println(lambdaForm0);
+                    System.err.println("Lambda form 1 toString is:");
+                    System.err.println(lambdaForm1);
+                    throw new AssertionError("Error: Lambda forms of the two method handles"
+                            + " are not the same. LF cahing does not work");
+                } else {
+                    System.err.println("LambdaForms differ, but there was a GC in between. Ignore the failure.");
+                }
             }
         } catch (IllegalAccessException | IllegalArgumentException |
                 SecurityException | InvocationTargetException ex) {
--- a/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java	Thu Dec 11 11:41:44 2014 -0800
@@ -26,12 +26,12 @@
  * @bug 8046703
  * @summary Test verifies that lambda forms are garbage collected
  * @author kshefov
+ * @library /lib/testlibrary/jsr292 /lib/testlibrary
  * @ignore 8057020
- * @library /lib/testlibrary/jsr292 /lib/testlibrary
  * @build TestMethods
  * @build LambdaFormTestCase
  * @build LFGarbageCollectedTest
- * @run main/othervm/timeout=600 -DtestLimit=150 LFGarbageCollectedTest
+ * @run main/othervm LFGarbageCollectedTest
  */
 
 import java.lang.invoke.MethodHandle;
--- a/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java	Thu Dec 11 11:41:44 2014 -0800
@@ -31,7 +31,7 @@
  * @build LambdaFormTestCase
  * @build LFCachingTestCase
  * @build LFMultiThreadCachingTest
- * @run main/othervm/timeout=300 LFMultiThreadCachingTest
+ * @run main/othervm LFMultiThreadCachingTest
  */
 
 import java.lang.invoke.MethodHandle;
--- a/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java	Thu Dec 11 11:41:44 2014 -0800
@@ -31,7 +31,7 @@
  * @build LambdaFormTestCase
  * @build LFCachingTestCase
  * @build LFSingleThreadCachingTest
- * @run main/othervm/timeout=300 LFSingleThreadCachingTest
+ * @run main/othervm LFSingleThreadCachingTest
  */
 
 import java.lang.invoke.MethodHandle;
--- a/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java	Thu Dec 11 11:41:44 2014 -0800
@@ -23,10 +23,15 @@
 
 import com.oracle.testlibrary.jsr292.Helper;
 import com.sun.management.HotSpotDiagnosticMXBean;
+
+import java.lang.management.GarbageCollectorMXBean;
 import java.lang.management.ManagementFactory;
 import java.lang.reflect.Method;
 import java.util.Collection;
+import java.util.List;
 import java.util.function.Function;
+import jdk.testlibrary.Utils;
+import jdk.testlibrary.TimeLimitedRunner;
 
 /**
  * Lambda forms caching test case class. Contains all necessary test routines to
@@ -41,12 +46,18 @@
     private final static String INTERNAL_FORM_METHOD_NAME = "internalForm";
     private static final double ITERATIONS_TO_CODE_CACHE_SIZE_RATIO
             = 45 / (128.0 * 1024 * 1024);
+    private static final long TIMEOUT = Helper.IS_THOROUGH ? 0L : (long) (Utils.adjustTimeout(Utils.DEFAULT_TEST_TIMEOUT) * 0.9);
 
     /**
      * Reflection link to {@code j.l.i.MethodHandle.internalForm} method. It is
      * used to get a lambda form from a method handle.
      */
     protected final static Method INTERNAL_FORM;
+    private static final List<GarbageCollectorMXBean> gcInfo;
+
+    private static long gcCount() {
+        return gcInfo.stream().mapToLong(GarbageCollectorMXBean::getCollectionCount).sum();
+    }
 
     static {
         try {
@@ -56,9 +67,20 @@
         } catch (Exception ex) {
             throw new Error("Unexpected exception: ", ex);
         }
+
+        gcInfo = ManagementFactory.getGarbageCollectorMXBeans();
+        if (gcInfo.size() == 0)  {
+            throw new Error("No GarbageCollectorMXBeans found.");
+        }
     }
 
     private final TestMethods testMethod;
+    private static long totalIterations = 0L;
+    private static long doneIterations = 0L;
+    private static boolean passed = true;
+    private static int testCounter = 0;
+    private static int failCounter = 0;
+    private long gcCountAtStart;
 
     /**
      * Test case constructor. Generates test cases with random method types for
@@ -69,12 +91,17 @@
      */
     protected LambdaFormTestCase(TestMethods testMethod) {
         this.testMethod = testMethod;
+        this.gcCountAtStart = gcCount();
     }
 
     public TestMethods getTestMethod() {
         return testMethod;
     }
 
+    protected boolean noGCHappened() {
+        return gcCount() == gcCountAtStart;
+    }
+
     /**
      * Routine that executes a test case.
      */
@@ -88,13 +115,10 @@
      * @param testMethods list of test methods
      */
     public static void runTests(Function<TestMethods, LambdaFormTestCase> ctor, Collection<TestMethods> testMethods) {
-        boolean passed = true;
-        int testCounter = 0;
-        int failCounter = 0;
         long testCaseNum = testMethods.size();
-        long iterations = Math.max(1, Helper.TEST_LIMIT / testCaseNum);
+        totalIterations = Math.max(1, Helper.TEST_LIMIT / testCaseNum);
         System.out.printf("Number of iterations according to -DtestLimit is %d (%d cases)%n",
-                iterations, iterations * testCaseNum);
+                totalIterations, totalIterations * testCaseNum);
         HotSpotDiagnosticMXBean hsDiagBean = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
         long codeCacheSize = Long.parseLong(
                 hsDiagBean.getVMOption("ReservedCodeCacheSize").getValue());
@@ -103,29 +127,42 @@
                 * ITERATIONS_TO_CODE_CACHE_SIZE_RATIO);
         System.out.printf("Number of iterations limited by code cache size is %d (%d cases)%n",
                 iterationsByCodeCacheSize, iterationsByCodeCacheSize * testCaseNum);
-        if (iterations > iterationsByCodeCacheSize) {
-            iterations = iterationsByCodeCacheSize;
+        if (totalIterations > iterationsByCodeCacheSize) {
+            totalIterations = iterationsByCodeCacheSize;
         }
         System.out.printf("Number of iterations is set to %d (%d cases)%n",
-                iterations, iterations * testCaseNum);
+                totalIterations, totalIterations * testCaseNum);
         System.out.flush();
-        for (long i = 0; i < iterations; i++) {
-            System.err.println(String.format("Iteration %d:", i));
-            for (TestMethods testMethod : testMethods) {
-                LambdaFormTestCase testCase = ctor.apply(testMethod);
-                try {
-                    System.err.printf("Tested LF caching feature with MethodHandles.%s method.%n",
-                            testCase.getTestMethod().name);
-                    testCase.doTest();
-                    System.err.println("PASSED");
-                } catch (Throwable t) {
-                    t.printStackTrace();
-                    System.err.println("FAILED");
-                    passed = false;
-                    failCounter++;
-                }
-                testCounter++;
-            }
+        TimeLimitedRunner runner = new TimeLimitedRunner(TIMEOUT, 4.0d,
+                () -> {
+                    if (doneIterations >= totalIterations) {
+                        return false;
+                    }
+                    System.err.println(String.format("Iteration %d:", doneIterations));
+                    for (TestMethods testMethod : testMethods) {
+                        LambdaFormTestCase testCase = ctor.apply(testMethod);
+                        try {
+                            System.err.printf("Tested LF caching feature with MethodHandles.%s method.%n",
+                                    testCase.getTestMethod().name);
+                            testCase.doTest();
+                            System.err.println("PASSED");
+                        } catch (Throwable t) {
+                            t.printStackTrace();
+                            System.err.println("FAILED");
+                            passed = false;
+                            failCounter++;
+                        }
+                        testCounter++;
+                    }
+                    doneIterations++;
+                    return true;
+                });
+        try {
+            runner.call();
+        } catch (Throwable t) {
+            t.printStackTrace();
+            System.err.println("FAILED");
+            throw new Error("Unexpected error!");
         }
         if (!passed) {
             throw new Error(String.format("%d of %d test cases FAILED! %n"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/logging/LogManagerAppContextDeadlock.java	Thu Dec 11 11:41:44 2014 -0800
@@ -0,0 +1,370 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.ThreadInfo;
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.util.Enumeration;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+
+/**
+ * @test
+ * @bug 8065991
+ * @summary check that when LogManager is initialized, a deadlock similar
+ *          to that described in 8065709 will not occur.
+ * @run main/othervm LogManagerAppContextDeadlock UNSECURE
+ * @run main/othervm LogManagerAppContextDeadlock SECURE
+ *
+ * @author danielfuchs
+ */
+public class LogManagerAppContextDeadlock {
+
+    public static final Semaphore sem = new Semaphore(0);
+    public static final Semaphore sem2 = new Semaphore(0);
+    public static final Semaphore sem3 = new Semaphore(-2);
+    public static volatile boolean goOn = true;
+    public static volatile Exception thrown;
+
+    // Emulate EventQueue
+    static class FakeEventQueue {
+        static final Logger logger = Logger.getLogger("foo");
+    }
+
+    // Emulate AppContext
+    static class FakeAppContext {
+
+        final static AtomicInteger numAppContexts = new AtomicInteger(0);
+        static final class FakeAppContextLock {}
+        static final FakeAppContextLock lock = new FakeAppContextLock();
+        static volatile FakeAppContext appContext;
+
+        final FakeEventQueue queue;
+        FakeAppContext() {
+            appContext = this;
+            numAppContexts.incrementAndGet();
+            // release sem2 to let Thread t2 call Logger.getLogger().
+            sem2.release();
+            try {
+                // Wait until we JavaAWTAccess is called by LogManager.
+                // Thread 2 will call Logger.getLogger() which will
+                // trigger a call to JavaAWTAccess - which will release
+                // sem, thus ensuring that Thread #2 is where we want it.
+                sem.acquire();
+                System.out.println("Sem acquired: Thread #2 has called JavaAWTAccess");
+            } catch(InterruptedException x) {
+                Thread.interrupted();
+            }
+            queue = new FakeEventQueue();
+        }
+
+        static FakeAppContext getAppContext() {
+            synchronized (lock) {
+                if (numAppContexts.get() == 0) {
+                    return new FakeAppContext();
+                }
+                return appContext;
+            }
+        }
+
+        static {
+            sun.misc.SharedSecrets.setJavaAWTAccess(new sun.misc.JavaAWTAccess() {
+                @Override
+                public Object getAppletContext() {
+                    if (numAppContexts.get() == 0) return null;
+                    // We are in JavaAWTAccess, we can release sem and let
+                    // FakeAppContext constructor proceeed.
+                    System.out.println("Releasing Sem");
+                    sem.release();
+                    return getAppContext();
+                }
+
+            });
+        }
+
+    }
+
+
+    // Test with or without a security manager
+    public static enum TestCase {
+        UNSECURE, SECURE;
+        public void run() throws Exception {
+            System.out.println("Running test case: " + name());
+            Configure.setUp(this);
+            test(this);
+        }
+    }
+
+    public static void test(TestCase test) throws Exception {
+        Thread t1 = new Thread() {
+            @Override
+            public void run() {
+                sem3.release();
+                System.out.println("FakeAppContext.getAppContext()");
+                FakeAppContext.getAppContext();
+                System.out.println("Done: FakeAppContext.getAppContext()");
+            }
+        };
+        t1.setDaemon(true);
+        t1.start();
+        Thread t2 = new Thread() {
+            public void run() {
+                sem3.release();
+                try {
+                    // Wait until Thread1 is in FakeAppContext constructor
+                    sem2.acquire();
+                    System.out.println("Sem2 acquired: Thread #1 will be waiting to acquire Sem");
+                } catch (InterruptedException ie) {
+                    Thread.interrupted();
+                }
+                System.out.println("Logger.getLogger(name).info(name)");
+                Logger.getLogger(test.name());//.info(name);
+                System.out.println("Done: Logger.getLogger(name).info(name)");
+            }
+        };
+        t2.setDaemon(true);
+        t2.start();
+        System.out.println("Should exit now...");
+        Thread detector = new DeadlockDetector();
+        detector.start();
+
+        // Wait for the 3 threads to start
+        sem3.acquire();
+
+        // Now wait for t1 & t2 to finish, or for a deadlock to be detected.
+        while (goOn && (t1.isAlive() || t2.isAlive())) {
+            if (t2.isAlive()) t2.join(1000);
+            if (test == TestCase.UNSECURE && System.getSecurityManager() == null) {
+                // if there's no security manager, AppContext.getAppContext() is
+                // not called -  so Thread t2 will not end up calling
+                // sem.release(). In that case we must release the semaphore here
+                // so that t1 can proceed.
+                if (LogManager.getLogManager().getLogger(TestCase.UNSECURE.name()) != null) {
+                    // means Thread t2 has created the logger
+                    sem.release();
+                }
+            }
+            if (t1.isAlive()) t1.join(1000);
+        }
+        if (thrown != null) {
+            throw thrown;
+        }
+    }
+
+    // Thrown by the deadlock detector
+    static final class DeadlockException extends RuntimeException {
+        public DeadlockException(String message) {
+            super(message);
+        }
+        @Override
+        public void printStackTrace() {
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        if (args.length == 0) {
+            args = new String[] { "SECURE" };
+        }
+
+        // If we don't initialize LogManager here, there will be
+        // a deadlock.
+        // See <https://bugs.openjdk.java.net/browse/JDK-8065709?focusedCommentId=13582038&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13582038>
+        // for more details.
+        Logger.getLogger("main").info("starting...");
+        try {
+            TestCase.valueOf(args[0]).run();
+            System.out.println("Test "+args[0]+" Passed");
+        } catch(Throwable t) {
+            System.err.println("Test " + args[0] +" failed: " + t);
+            t.printStackTrace();
+        }
+    }
+
+    // Called by the deadlock detector when a deadlock is found.
+    static void fail(Exception x) {
+        x.printStackTrace();
+        if (thrown == null) {
+            thrown = x;
+        }
+        goOn = false;
+    }
+
+    // A thread that detect deadlocks.
+    final static class DeadlockDetector extends Thread {
+
+        public DeadlockDetector() {
+            this.setDaemon(true);
+        }
+
+        @Override
+        public void run() {
+            sem3.release();
+            Configure.doPrivileged(this::loop);
+        }
+        public void loop() {
+            while(goOn) {
+                try {
+                    long[] ids = ManagementFactory.getThreadMXBean().findDeadlockedThreads();
+                    ids = ids == null ? new long[0] : ids;
+                    if (ids.length == 1) {
+                        throw new RuntimeException("Found 1 deadlocked thread: "+ids[0]);
+                    } else if (ids.length > 0) {
+                        ThreadInfo[] infos = ManagementFactory.getThreadMXBean().getThreadInfo(ids, Integer.MAX_VALUE);
+                        System.err.println("Found "+ids.length+" deadlocked threads: ");
+                        for (ThreadInfo inf : infos) {
+                            System.err.println(inf);
+                        }
+                        throw new DeadlockException("Found "+ids.length+" deadlocked threads");
+                    }
+                    Thread.sleep(100);
+                } catch(InterruptedException | RuntimeException x) {
+                    fail(x);
+                }
+            }
+        }
+
+    }
+
+    // A helper class to configure the security manager for the test,
+    // and bypass it when needed.
+    static class Configure {
+        static Policy policy = null;
+        static final ThreadLocal<AtomicBoolean> allowAll = new ThreadLocal<AtomicBoolean>() {
+            @Override
+            protected AtomicBoolean initialValue() {
+                return  new AtomicBoolean(false);
+            }
+        };
+        static void setUp(TestCase test) {
+            switch (test) {
+                case SECURE:
+                    if (policy == null && System.getSecurityManager() != null) {
+                        throw new IllegalStateException("SecurityManager already set");
+                    } else if (policy == null) {
+                        policy = new SimplePolicy(TestCase.SECURE, allowAll);
+                        Policy.setPolicy(policy);
+                        System.setSecurityManager(new SecurityManager());
+                    }
+                    if (System.getSecurityManager() == null) {
+                        throw new IllegalStateException("No SecurityManager.");
+                    }
+                    if (policy == null) {
+                        throw new IllegalStateException("policy not configured");
+                    }
+                    break;
+                case UNSECURE:
+                    if (System.getSecurityManager() != null) {
+                        throw new IllegalStateException("SecurityManager already set");
+                    }
+                    break;
+                default:
+                    new InternalError("No such testcase: " + test);
+            }
+        }
+        static void doPrivileged(Runnable run) {
+            allowAll.get().set(true);
+            try {
+                run.run();
+            } finally {
+                allowAll.get().set(false);
+            }
+        }
+    }
+
+    // A Helper class to build a set of permissions.
+    final static class PermissionsBuilder {
+        final Permissions perms;
+        public PermissionsBuilder() {
+            this(new Permissions());
+        }
+        public PermissionsBuilder(Permissions perms) {
+            this.perms = perms;
+        }
+        public PermissionsBuilder add(Permission p) {
+            perms.add(p);
+            return this;
+        }
+        public PermissionsBuilder addAll(PermissionCollection col) {
+            if (col != null) {
+                for (Enumeration<Permission> e = col.elements(); e.hasMoreElements(); ) {
+                    perms.add(e.nextElement());
+                }
+            }
+            return this;
+        }
+        public Permissions toPermissions() {
+            final PermissionsBuilder builder = new PermissionsBuilder();
+            builder.addAll(perms);
+            return builder.perms;
+        }
+    }
+
+    // Policy for the test...
+    public static class SimplePolicy extends Policy {
+
+        final Permissions permissions;
+        final Permissions allPermissions;
+        final ThreadLocal<AtomicBoolean> allowAll; // actually: this should be in a thread locale
+        public SimplePolicy(TestCase test, ThreadLocal<AtomicBoolean> allowAll) {
+            this.allowAll = allowAll;
+            // we don't actually need any permission to create our
+            // FileHandlers because we're passing invalid parameters
+            // which will make the creation fail...
+            permissions = new Permissions();
+            permissions.add(new RuntimePermission("accessClassInPackage.sun.misc"));
+
+            // these are used for configuring the test itself...
+            allPermissions = new Permissions();
+            allPermissions.add(new java.security.AllPermission());
+
+        }
+
+        @Override
+        public boolean implies(ProtectionDomain domain, Permission permission) {
+            if (allowAll.get().get()) return allPermissions.implies(permission);
+            return permissions.implies(permission);
+        }
+
+        @Override
+        public PermissionCollection getPermissions(CodeSource codesource) {
+            return new PermissionsBuilder().addAll(allowAll.get().get()
+                    ? allPermissions : permissions).toPermissions();
+        }
+
+        @Override
+        public PermissionCollection getPermissions(ProtectionDomain domain) {
+            return new PermissionsBuilder().addAll(allowAll.get().get()
+                    ? allPermissions : permissions).toPermissions();
+        }
+    }
+
+}
--- a/test/javax/management/monitor/CounterMonitorTest.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/test/javax/management/monitor/CounterMonitorTest.java	Thu Dec 11 11:41:44 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
  * @bug 4981829
  * @summary Test that the counter monitor, when running in difference mode,
  *          emits a notification every time the threshold is exceeded.
- * @author Luis-Miguel Alventosa
+ * @author Luis-Miguel Alventosa, Shanliang JIANG
  * @run clean CounterMonitorTest
  * @run build CounterMonitorTest
  * @run main CounterMonitorTest
@@ -50,23 +50,31 @@
     private boolean notifyFlag = true;
 
     // granularity period
-    private int granularityperiod = 500;
+    private int granularityperiod = 10;
 
-    // counter values
-    private int[] values = new int[] {4, 6, 9, 11};
+    // derived gauge
+    private volatile int derivedGauge = 2;
 
     // flag to notify that a message has been received
     private volatile boolean messageReceived = false;
 
+    private volatile Object observedValue = null;
+
     // MBean class
     public class StdObservedObject implements StdObservedObjectMBean {
         public Object getNbObjects() {
+            echo(">>> StdObservedObject.getNbObjects: " + count);
+            synchronized(CounterMonitorTest.class) {
+                observedValue = count;
+                CounterMonitorTest.class.notifyAll();
+            }
             return count;
         }
         public void setNbObjects(Object n) {
+            echo(">>> StdObservedObject.setNbObjects: " + n);
             count = n;
         }
-        private Object count= null;
+        private volatile Object count= null;
     }
 
     // MBean interface
@@ -166,18 +174,18 @@
             Attribute attrib = new Attribute("NbObjects", data);
             server.setAttribute(stdObsObjName, attrib);
 
-            // Wait for granularity period (multiplied by 2 for sure)
-            //
-            Thread.sleep(granularityperiod * 2);
+            waitObservation(data);
 
             // Loop through the values
             //
-            for (int i = 0; i < values.length; i++) {
-                data = new Integer(values[i]);
-                echo(">>> Set data = " + data.intValue());
+            while (derivedGauge++ < 10) {
+                System.out.print(">>> Set data from " + data.intValue());
+                data = new Integer(data.intValue() + derivedGauge);
+                echo(" to " + data.intValue());
 
                 attrib = new Attribute("NbObjects", data);
                 server.setAttribute(stdObsObjName, attrib);
+                waitObservation(data);
 
                 echo("\tdoWait in Counter Monitor");
                 doWait();
@@ -214,6 +222,20 @@
         }
     }
 
+    private void waitObservation(Object value) {
+        synchronized (CounterMonitorTest.class) {
+            while (value != observedValue) {
+                try {
+                    CounterMonitorTest.class.wait();
+                } catch (InterruptedException e) {
+                    System.err.println("Got unexpected exception: " + e);
+                    e.printStackTrace();
+                    break;
+                }
+            }
+        }
+    }
+
     /*
      * Print message
      */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/JFileChooser/FileFilterDescription/FileFilterDescription.html	Thu Dec 11 11:41:44 2014 -0800
@@ -0,0 +1,40 @@
+<html>
+<!--
+ Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<!--
+ @test
+ @bug 8029536
+ @author Sergey Bylokhov
+ @run applet/manual=yesno FileFilterDescription.html
+-->
+
+<body>
+<applet  code="FileFilterDescription.class" width=200 height=200></applet>
+Follow the instructions below.
+1) Check that current filter in the opened JFileChooser is a "CustomFileFilter".
+2) Close the JFileChooser.
+3) Test will repeat steps 1 - 2 for all supported look and feels.
+4) If it's true for all look and feels then the test passed, otherwise it failed.
+</body>
+</html> 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/JFileChooser/FileFilterDescription/FileFilterDescription.java	Thu Dec 11 11:41:44 2014 -0800
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.applet.Applet;
+import java.io.File;
+
+import javax.swing.JFileChooser;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+import javax.swing.filechooser.FileFilter;
+
+public final class FileFilterDescription extends Applet {
+
+    @Override
+    public void init() {
+    }
+
+    @Override
+    public void start() {
+        try {
+            test();
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+
+    public static void test() throws Exception {
+        final UIManager.LookAndFeelInfo[] infos = UIManager
+                .getInstalledLookAndFeels();
+        for (final UIManager.LookAndFeelInfo info : infos) {
+            SwingUtilities.invokeAndWait(() -> {
+                final JFileChooser chooser = new JFileChooser();
+                setLookAndFeel(info);
+                chooser.setAcceptAllFileFilterUsed(false);
+                chooser.setFileFilter(new CustomFileFilter());
+                SwingUtilities.updateComponentTreeUI(chooser);
+                chooser.showDialog(null, "Open");
+            });
+        }
+    }
+
+    private static void setLookAndFeel(final UIManager.LookAndFeelInfo info) {
+        try {
+            UIManager.setLookAndFeel(info.getClassName());
+        } catch (ClassNotFoundException | InstantiationException |
+                UnsupportedLookAndFeelException | IllegalAccessException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private static class CustomFileFilter extends FileFilter {
+
+        @Override
+        public boolean accept(final File f) {
+            return false;
+        }
+
+        @Override
+        public String getDescription() {
+            return "CustomFileFilter";
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/testlibrary/jdk/testlibrary/TimeLimitedRunner.java	Thu Dec 11 11:41:44 2014 -0800
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.testlibrary;
+
+import java.util.Objects;
+import java.util.concurrent.Callable;
+
+/**
+ * Auxiliary class to run target w/ given timeout.
+ */
+public class TimeLimitedRunner implements Callable<Void> {
+    private final long              stoptime;
+    private final long              timeout;
+    private final double            factor;
+    private final Callable<Boolean> target;
+
+    /**
+     * @param timeout   a timeout. zero means no time limitation
+     * @param factor    a multiplier used to estimate next iteration time
+     * @param target    a target to run
+     * @throws NullPointerException     if target is null
+     * @throws IllegalArgumentException if timeout is negative or
+                                        factor isn't positive
+     */
+    public TimeLimitedRunner(long timeout, double factor,
+            Callable<Boolean> target) {
+        Objects.requireNonNull(target, "target must not be null");
+        if (timeout < 0) {
+            throw new IllegalArgumentException("timeout[" + timeout + "] < 0");
+        }
+        if (factor <= 0d) {
+            throw new IllegalArgumentException("factor[" + factor + "] <= 0");
+        }
+        this.stoptime = System.currentTimeMillis() + timeout;
+        this.timeout = timeout;
+        this.factor = factor;
+        this.target = target;
+    }
+
+    /**
+     * Runs @{linkplan target} while it returns true and timeout isn't exceeded
+     */
+    @Override
+    public Void call() throws Exception {
+        long maxDuration = 0L;
+        long iterStart = System.currentTimeMillis();
+        if (timeout != 0 && iterStart > stoptime) {
+            return null;
+        }
+        while (target.call()) {
+            if (timeout != 0) {
+                long iterDuration = System.currentTimeMillis() - iterStart;
+                maxDuration = Math.max(maxDuration, iterDuration);
+                iterStart = System.currentTimeMillis();
+                if (iterStart + (maxDuration * factor) > stoptime) {
+                    System.out.println("Not enough time to continue execution. "
+                            + "Interrupted.");
+                    break;
+                }
+            }
+        }
+        return null;
+    }
+
+}
--- a/test/lib/testlibrary/jdk/testlibrary/Utils.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/test/lib/testlibrary/jdk/testlibrary/Utils.java	Thu Dec 11 11:41:44 2014 -0800
@@ -35,6 +35,7 @@
 import java.util.Collections;
 import java.util.regex.Pattern;
 import java.util.regex.Matcher;
+import java.util.concurrent.TimeUnit;
 
 /**
  * Common library for various test helper functions.
@@ -67,6 +68,12 @@
        TIMEOUT_FACTOR = Double.parseDouble(toFactor);
     }
 
+    /**
+    * Returns the value of JTREG default test timeout in milliseconds
+    * converted to {@code long}.
+    */
+    public static final long DEFAULT_TEST_TIMEOUT = TimeUnit.SECONDS.toMillis(120);
+
     private Utils() {
         // Private constructor to prevent class instantiation
     }
@@ -259,4 +266,14 @@
             throw t;
         }
     }
+
+    /**
+     * Adjusts the provided timeout value for the TIMEOUT_FACTOR
+     * @param tOut the timeout value to be adjusted
+     * @return The timeout value adjusted for the value of "test.timeout.factor"
+     *         system property
+     */
+    public static long adjustTimeout(long tOut) {
+        return Math.round(tOut * Utils.TIMEOUT_FACTOR);
+    }
 }
--- a/test/sun/awt/dnd/8024061/bug8024061.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/test/sun/awt/dnd/8024061/bug8024061.java	Thu Dec 11 11:41:44 2014 -0800
@@ -277,9 +277,6 @@
                     try {
                         Transferable t = dtde.getTransferable();
                         Object data = t.getTransferData(DropObjectFlavor);
-                        if (data != null) {
-                            throw new Exception("getTransferData returned non-null");
-                        }
                     } catch (Exception e) {
                         dragEnterException = e;
                         e.printStackTrace();
--- a/test/sun/net/www/http/HttpClient/StreamingRetry.java	Wed Dec 10 13:54:12 2014 -0800
+++ b/test/sun/net/www/http/HttpClient/StreamingRetry.java	Thu Dec 11 11:41:44 2014 -0800
@@ -37,13 +37,13 @@
 
 public class StreamingRetry implements Runnable {
     static final int ACCEPT_TIMEOUT = 20 * 1000; // 20 seconds
-    ServerSocket ss;
+    volatile ServerSocket ss;
 
-    public static void main(String[] args) throws IOException {
+    public static void main(String[] args) throws Exception {
         (new StreamingRetry()).instanceMain();
     }
 
-    void instanceMain() throws IOException {
+    void instanceMain() throws Exception {
         out.println("Test with default method");
         test(null);
         out.println("Test with POST method");
@@ -54,12 +54,13 @@
         if (failed > 0) throw new RuntimeException("Some tests failed");
     }
 
-    void test(String method) throws IOException {
+    void test(String method) throws Exception {
         ss = new ServerSocket(0);
         ss.setSoTimeout(ACCEPT_TIMEOUT);
         int port = ss.getLocalPort();
 
-        (new Thread(this)).start();
+        Thread otherThread = new Thread(this);
+        otherThread.start();
 
         try {
             URL url = new URL("http://localhost:" + port + "/");
@@ -77,6 +78,7 @@
             //expected.printStackTrace();
         } finally {
             ss.close();
+            otherThread.join();
         }
     }