Execute the provided callable in a read lock.

@param aSupplier
Callable to be executed. May not be <code>null</code>.
@return The return value of the callable. May be <code>null</code>.
197101
public boolean readLocked (@Nonnull final BooleanSupplier aSupplier)
  {
    readLock ().lock ();
    try
    {
      return aSupplier.getAsBoolean ();
    }
    finally
    {
      readLock ().unlock ();
    }
  }
686648
public static <R> R runAndReturn(Runnable runnable,
            Supplier<R> returnSupplier) {
        runnable.run();
        return returnSupplier.get();
    }
78640
public int locked (@Nonnull final IntSupplier aSupplier)
  {
    ValueEnforcer.notNull (aSupplier, "Supplier");

    lock ();
    try
    {
      return aSupplier.getAsInt ();
    }
    finally
    {
      unlock ();
    }
  }
913789
public static LongIterator of(final Supplier<? extends LongIterator> iteratorSupplier) {
        N.checkArgNotNull(iteratorSupplier, "iteratorSupplier");

        return new LongIterator() {
            private LongIterator iter = null;
            private boolean isInitialized = false;

            @Override
            public boolean hasNext() {
                if (isInitialized == false) {
                    init();
                }

                return iter.hasNext();
            }

            @Override
            public long nextLong() {
                if (isInitialized == false) {
                    init();
                }

                return iter.nextLong();
            }

            private void init() {
                if (isInitialized == false) {
                    isInitialized = true;
                    iter = iteratorSupplier.get();
                }
            }
        };
    }
533871
<T> T runInCompilerThread(Callable<T> callable) {
    return compilerExecutor.runInCompilerThread(
        callable, options != null && options.getTracerMode().isOn());
  }
387811
public static <T> Callable<T> privilegedCallable(Callable<T> callable) {
        if (callable == null)
            throw new NullPointerException();
        return callable;
    }
7481
@Nonnull
	public static LBoolSupplier boolSupplierFrom(Consumer<LBoolSupplierBuilder> buildingFunction) {
		LBoolSupplierBuilder builder = new LBoolSupplierBuilder();
		buildingFunction.accept(builder);
		return builder.build();
	}
1090302
public static <T> ObjIteratorEx<T> oF(final Supplier<T[]> arraySupplier) {
        N.checkArgNotNull(arraySupplier, "arraySupplier");

        return new ObjIteratorEx<T>() {
            private ObjIteratorEx<T> iterEx = null;
            private boolean isInitialized = false;

            @Override
            public boolean hasNext() {
                if (isInitialized == false) {
                    init();
                }

                return iterEx.hasNext();
            }

            @Override
            public T next() {
                if (isInitialized == false) {
                    init();
                }

                return iterEx.next();
            }

            @Override
            public void skip(long n) {
                N.checkArgNotNegative(n, "n");

                if (isInitialized == false) {
                    init();
                }

                iterEx.skip(n);
            }

            @Override
            public long count() {
                if (isInitialized == false) {
                    init();
                }

                return iterEx.count();
            }

            private void init() {
                if (isInitialized == false) {
                    isInitialized = true;
                    iterEx = ObjIteratorEx.of(arraySupplier.get());
                }
            }
        };
    }
649378
public double locked (@Nonnull final DoubleSupplier aSupplier)
  {
    ValueEnforcer.notNull (aSupplier, "Supplier");

    lock ();
    try
    {
      return aSupplier.getAsDouble ();
    }
    finally
    {
      unlock ();
    }
  }
255041
public static <TResult> Task<TResult> call(final Callable<TResult> callable) {
    return call(callable, IMMEDIATE_EXECUTOR, null);
  }
587474
public long readLocked (@Nonnull final LongSupplier aSupplier)
  {
    readLock ().lock ();
    try
    {
      return aSupplier.getAsLong ();
    }
    finally
    {
      readLock ().unlock ();
    }
  }
1186290
private final Result lockForUpgrade_(L locker) {
        Result result;
        if ((result = tryLockForUpgrade_(locker)) == Result.FAILED) {
            result = lockForUpgradeQueued(locker, addUpgradeWaiter());
        }
        return result;
    }
787627
public static LongIteratorEx oF(final Supplier<long[]> arraySupplier) {
        N.checkArgNotNull(arraySupplier, "arraySupplier");

        return new LongIteratorEx() {
            private LongIteratorEx iterEx = null;
            private boolean isInitialized = false;

            @Override
            public boolean hasNext() {
                if (isInitialized == false) {
                    init();
                }

                return iterEx.hasNext();
            }

            @Override
            public long nextLong() {
                if (isInitialized == false) {
                    init();
                }

                return iterEx.nextLong();
            }

            @Override
            public void skip(long n) {
                N.checkArgNotNegative(n, "n");

                if (isInitialized == false) {
                    init();
                }

                iterEx.skip(n);
            }

            @Override
            public long count() {
                if (isInitialized == false) {
                    init();
                }

                return iterEx.count();
            }

            private void init() {
                if (isInitialized == false) {
                    isInitialized = true;
                    long[] aar = arraySupplier.get();
                    iterEx = LongIteratorEx.of(aar);
                }
            }
        };
    }
391732
public <T> T act(final FileCallable<T> callable) throws IOException, InterruptedException {
        return act(callable,callable.getClass().getClassLoader());
    }
383015
private final Result tryLockForUpgrade_(L locker) {
        int state = mState;
        if ((state & LOCK_STATE_MASK) == 0) { // no write or upgrade lock is held
            if (isUpgradeFirst()) {
                do {
                    if (setUpgradeLock(state)) {
                        mOwner = locker;
                        incrementUpgradeCount();
                        return Result.ACQUIRED;
                    }
                    // keep looping on CAS failure if a reader mucked with the state
                } while (((state = mState) & LOCK_STATE_MASK) == 0);
            }
        } else if (mOwner == locker) {
            incrementUpgradeCount();
            return Result.OWNED;
        }
        return Result.FAILED;
    }
91954
@Override
	public MutableObjectIterator<E> getIterator() throws InterruptedException {
		synchronized (this.iteratorLock) {
			// wait while both the iterator and the exception are not set
			while (this.iterator == null && this.iteratorException == null) {
				this.iteratorLock.wait();
			}
			
			if (this.iteratorException != null) {
				throw new RuntimeException("Error obtaining the sorted input: " + this.iteratorException.getMessage(),
					this.iteratorException);
			}
			else {
				return this.iterator;
			}
		}
	}
1342952
@Override
    public Object get(ExecutionContext context, String name) {
        // 15.3.5.4
        if (name.equals("caller") && this.strict) {
            throw new ThrowException(context, context.createTypeError("may not reference 'caller'"));
        }
        return super.get(context, name);
    }