Ejemplo n.º 1
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);
    }
  }
Ejemplo n.º 2
0
 public static boolean setExceptionalThreadWithReadAccessFlag(boolean flag) {
   boolean old = isExceptionalThreadWithReadAccess();
   if (flag) {
     exceptionalThreadWithReadAccessFlag.set(Boolean.TRUE);
   } else {
     exceptionalThreadWithReadAccessFlag.remove();
   }
   return old;
 }