ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/jsr166e/ConcurrentHashMapV8.java
(Generate patch)

Comparing jsr166/src/jsr166e/ConcurrentHashMapV8.java (file contents):
Revision 1.84 by dl, Sat Dec 15 20:21:25 2012 UTC vs.
Revision 1.88 by jsr166, Fri Jan 18 04:23:27 2013 UTC

# Line 567 | Line 567 | public class ConcurrentHashMapV8<K, V>
567      static final int SEED_INCREMENT = 0x61c88647;
568  
569      /**
570 <     * Per-thread counter hash codes. Shared across all instances
570 >     * Per-thread counter hash codes. Shared across all instances.
571       */
572      static final ThreadLocal<CounterHashCode> threadCounterHashCode =
573          new ThreadLocal<CounterHashCode>();
# Line 3730 | Line 3730 | public class ConcurrentHashMapV8<K, V>
3730       * result on success, else null
3731       * @return a non-null result from applying the given search
3732       * function on each value, or null if none
3733     *
3733       */
3734      public <U> U searchValuesSequentially
3735          (Fun<? super V, ? extends U> searchFunction) {
# Line 4337 | Line 4336 | public class ConcurrentHashMapV8<K, V>
4336       * result on success, else null
4337       * @return a non-null result from applying the given search
4338       * function on each value, or null if none
4340     *
4339       */
4340      public <U> U searchValuesInParallel
4341          (Fun<? super V, ? extends U> searchFunction) {
# Line 4579 | Line 4577 | public class ConcurrentHashMapV8<K, V>
4577      /**
4578       * Base class for views.
4579       */
4580 <    static abstract class CHMView<K, V> {
4580 >    abstract static class CHMView<K, V> {
4581          final ConcurrentHashMapV8<K, V> map;
4582          CHMView(ConcurrentHashMapV8<K, V> map)  { this.map = map; }
4583  
# Line 4595 | Line 4593 | public class ConcurrentHashMapV8<K, V>
4593          public final void clear()               { map.clear(); }
4594  
4595          // implementations below rely on concrete classes supplying these
4596 <        abstract public Iterator<?> iterator();
4597 <        abstract public boolean contains(Object o);
4598 <        abstract public boolean remove(Object o);
4596 >        public abstract Iterator<?> iterator();
4597 >        public abstract boolean contains(Object o);
4598 >        public abstract boolean remove(Object o);
4599  
4600          private static final String oomeMsg = "Required array size too large";
4601  
# Line 6844 | Line 6842 | public class ConcurrentHashMapV8<K, V>
6842      private static sun.misc.Unsafe getUnsafe() {
6843          try {
6844              return sun.misc.Unsafe.getUnsafe();
6845 <        } catch (SecurityException se) {
6846 <            try {
6847 <                return java.security.AccessController.doPrivileged
6848 <                    (new java.security
6849 <                     .PrivilegedExceptionAction<sun.misc.Unsafe>() {
6850 <                        public sun.misc.Unsafe run() throws Exception {
6851 <                            java.lang.reflect.Field f = sun.misc
6852 <                                .Unsafe.class.getDeclaredField("theUnsafe");
6853 <                            f.setAccessible(true);
6854 <                            return (sun.misc.Unsafe) f.get(null);
6855 <                        }});
6856 <            } catch (java.security.PrivilegedActionException e) {
6857 <                throw new RuntimeException("Could not initialize intrinsics",
6858 <                                           e.getCause());
6859 <            }
6845 >        } catch (SecurityException tryReflectionInstead) {}
6846 >        try {
6847 >            return java.security.AccessController.doPrivileged
6848 >            (new java.security.PrivilegedExceptionAction<sun.misc.Unsafe>() {
6849 >                public sun.misc.Unsafe run() throws Exception {
6850 >                    Class<sun.misc.Unsafe> k = sun.misc.Unsafe.class;
6851 >                    for (java.lang.reflect.Field f : k.getDeclaredFields()) {
6852 >                        f.setAccessible(true);
6853 >                        Object x = f.get(null);
6854 >                        if (k.isInstance(x))
6855 >                            return k.cast(x);
6856 >                    }
6857 >                    throw new NoSuchFieldError("the Unsafe");
6858 >                }});
6859 >        } catch (java.security.PrivilegedActionException e) {
6860 >            throw new RuntimeException("Could not initialize intrinsics",
6861 >                                       e.getCause());
6862          }
6863      }
6864   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines