code: private int tryAcquireExclusiveTransaction(@NotNull final Thread thread, final int timeout) {
          long nanos = TimeUnit.MILLISECONDS.toNanos(timeout);
          try (CriticalSection ignored = criticalSection.enter()) {
              if (getThreadPermits(thread) > 0) {
                  throw new ExodusException("Exclusive transaction can't be nested");
              }
              final Condition condition = criticalSection.newCondition();
              final long currentOrder = acquireOrder++;
              regularQueue.put(currentOrder, condition);
              while (acquiredPermits > 0 || regularQueue.firstKey() != currentOrder) {
                  try {
                      nanos = condition.awaitNanos(nanos);
                      if (nanos < 0) {
                          break;
                      }
                  } catch (InterruptedException e) {
                      Thread.currentThread().interrupt();
                      break;
                  }
              }
              if (acquiredPermits == 0 && regularQueue.firstKey() == currentOrder) {
                  regularQueue.pollFirstEntry();
                  acquiredPermits = availablePermits;
                  threadPermits.put(thread, availablePermits);
                  return availablePermits;
              }
              regularQueue.remove(currentOrder);
              notifyNextWaiters();
          }
          return 0;
      }
docs: Wait for exclusive permit during a timeout in milliseconds.
  
  @return number of acquired permits if > 0