Skip to content

Commit

Permalink
Merge pull request #860 from akka/wip-2688-switch-to-s.c.u.unsafe-det…
Browse files Browse the repository at this point in the history
…ection-√

#2688 - Switching to s.c.u.Unsafe.instance for akka.util.Unsafe.instance
  • Loading branch information
viktorklang committed Nov 8, 2012
2 parents 8c2bfb5 + 275d1a2 commit 9e3f659
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions akka-actor/src/main/scala/akka/util/Unsafe.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,9 @@

package akka.util;

import java.lang.reflect.Field;

/**
* INTERNAL API
*/
public final class Unsafe {
public final static sun.misc.Unsafe instance;
static {
try {
sun.misc.Unsafe found = null;
for(Field field : sun.misc.Unsafe.class.getDeclaredFields()) {
if (field.getType() == sun.misc.Unsafe.class) {
field.setAccessible(true);
found = (sun.misc.Unsafe) field.get(null);
break;
}
}
if (found == null) throw new IllegalStateException("Can't find instance of sun.misc.Unsafe");
else instance = found;
} catch(Throwable t) {
throw new ExceptionInInitializerError(t);
}
}
public final static sun.misc.Unsafe instance = scala.concurrent.util.Unsafe.instance;
}

0 comments on commit 9e3f659

Please sign in to comment.