コード例 #1
0
 public static boolean setExceptionalThreadWithReadAccessFlag(boolean flag) {
   boolean old = isExceptionalThreadWithReadAccess();
   if (flag) {
     exceptionalThreadWithReadAccessFlag.set(Boolean.TRUE);
   } else {
     exceptionalThreadWithReadAccessFlag.remove();
   }
   return old;
 }
コード例 #2
0
  public void runEdtSafeAction(@NotNull Runnable runnable) {
    Integer value = ourEdtSafe.get();
    if (value == null) {
      value = Integer.valueOf(0);
    }

    ourEdtSafe.set(value + 1);

    try {
      runnable.run();
    } finally {
      int newValue = ourEdtSafe.get() - 1;
      ourEdtSafe.set(newValue >= 1 ? newValue : null);
    }
  }
コード例 #3
0
  private static void assertIsDispatchThread(String message) {
    if (ShutDownTracker.isShutdownHookRunning()) return;
    final Thread currentThread = Thread.currentThread();
    if (ourDispatchThread == currentThread) return;

    if (EventQueue.isDispatchThread()) {
      ourDispatchThread = currentThread;
    }
    if (ourDispatchThread == currentThread) return;

    Integer safeCounter = ourEdtSafe.get();
    if (safeCounter != null && safeCounter > 0) return;

    LOG.error(
        message,
        "Current thread: " + describe(Thread.currentThread()),
        "Our dispatch thread:" + describe(ourDispatchThread),
        "SystemEventQueueThread: " + describe(getEventQueueThread()));
  }
コード例 #4
0
 private static boolean isExceptionalThreadWithReadAccess() {
   Boolean flag = exceptionalThreadWithReadAccessFlag.get();
   return flag == Boolean.TRUE;
 }