Java 类com.intellij.util.concurrency.AtomicFieldUpdater 实例源码

项目:consulo    文件:PreJava9IOUtil.java   
Java9Cleaner() {
  // code replace
  // AtomicFieldUpdater.getUnsafe().invokeCleaner(buffer);

  // in JDK9 the "official" dispose method is sun.misc.Unsafe#invokeCleaner
  // since we have to target both jdk 8 and 9 we have to use reflection
  myUnsafe = AtomicFieldUpdater.getUnsafe();
  try {
    myInvokeCleanerMethod = myUnsafe.getClass().getMethod("invokeCleaner", ByteBuffer.class);
    myInvokeCleanerMethod.setAccessible(true);
  }
  catch (Exception e) {
    // something serious, needs to be logged
    LOGGER.error(e);
    throw new RuntimeException(e);
  }
}
项目:intellij-ce-playground    文件:PromiseManager.java   
@SuppressWarnings("UnusedDeclaration")
public PromiseManager(@NotNull AtomicFieldUpdater<HOST, Promise<VALUE>> fieldUpdater) {
  this.fieldUpdater = fieldUpdater;
}
项目:intellij-ce-playground    文件:PromiseManager.java   
public PromiseManager(@NotNull Class<HOST> ownerClass) {
  //noinspection unchecked
  fieldUpdater = ((AtomicFieldUpdater)AtomicFieldUpdater.forFieldOfType(ownerClass, Promise.class));
}
项目:intellij-ce-playground    文件:AsyncValueLoaderManager.java   
@SuppressWarnings("UnusedDeclaration")
public AsyncValueLoaderManager(@NotNull AtomicFieldUpdater<HOST, AsyncResult<VALUE>> fieldUpdater) {
  this.fieldUpdater = fieldUpdater;
}
项目:intellij-ce-playground    文件:AsyncValueLoaderManager.java   
public AsyncValueLoaderManager(@NotNull Class<HOST> ownerClass) {
  //noinspection unchecked
  fieldUpdater = ((AtomicFieldUpdater)AtomicFieldUpdater.forFieldOfType(ownerClass, AsyncResult.class));
}
项目:consulo    文件:ThrowableInterner.java   
private static Object[] getBacktrace(@Nonnull Throwable throwable) {
  // the JVM blocks access to Throwable.backtrace via reflection
  Object backtrace = BACKTRACE_FIELD_OFFSET == -1 ? null : AtomicFieldUpdater.getUnsafe().getObject(throwable, BACKTRACE_FIELD_OFFSET);
  // obsolete jdk
  return backtrace instanceof Object[] && ((Object[])backtrace).length == 5 ? (Object[])backtrace : null;
}
项目:intellij-ce-playground    文件:ConcurrentLongObjectHashMap.java   
/**
 * Returns a sun.misc.Unsafe.  Suitable for use in a 3rd party package.
 * Replace with a simple call to Unsafe.getUnsafe when integrating
 * into a jdk.
 *
 * @return a sun.misc.Unsafe
 */
private static Unsafe getUnsafe() {
  return AtomicFieldUpdater.getUnsafe();
}
项目:intellij-ce-playground    文件:ConcurrentIntObjectHashMap.java   
/**
 * Returns a sun.misc.Unsafe.  Suitable for use in a 3rd party package.
 * Replace with a simple call to Unsafe.getUnsafe when integrating
 * into a jdk.
 *
 * @return a sun.misc.Unsafe
 */
private static Unsafe getUnsafe() {
  return AtomicFieldUpdater.getUnsafe();
}
项目:consulo    文件:ConcurrentLongObjectHashMap.java   
/**
 * Returns a sun.misc.Unsafe.  Suitable for use in a 3rd party package.
 * Replace with a simple call to Unsafe.getUnsafe when integrating
 * into a jdk.
 *
 * @return a sun.misc.Unsafe
 */
private static Unsafe getUnsafe() {
  return AtomicFieldUpdater.getUnsafe();
}
项目:consulo    文件:ConcurrentIntObjectHashMap.java   
/**
 * Returns a sun.misc.Unsafe.  Suitable for use in a 3rd party package.
 * Replace with a simple call to Unsafe.getUnsafe when integrating
 * into a jdk.
 *
 * @return a sun.misc.Unsafe
 */
private static Unsafe getUnsafe() {
  return AtomicFieldUpdater.getUnsafe();
}