コード例 #1
0
 public <T> T runWriteAction(@NotNull final Computable<T> computation) {
   final AccessToken token = acquireWriteActionLock(computation.getClass());
   try {
     return computation.compute();
   } finally {
     token.finish();
   }
 }
コード例 #2
0
 public void runWriteAction(@NotNull final Runnable action) {
   final AccessToken token = acquireWriteActionLock(action.getClass());
   try {
     action.run();
   } finally {
     token.finish();
   }
 }
コード例 #3
0
  public <T> T runReadAction(@NotNull final Computable<T> computation) {
    final AccessToken token = acquireReadActionLockImpl(false);

    try {
      return computation.compute();
    } finally {
      token.finish();
    }
  }
コード例 #4
0
  public void runReadAction(@NotNull final Runnable action) {
    final AccessToken token = acquireReadActionLockImpl(false);

    try {
      action.run();
    } finally {
      token.finish();
    }
  }