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>.
358166
public boolean locked (@Nonnull final BooleanSupplier aSupplier)
  {
    ValueEnforcer.notNull (aSupplier, "Supplier");

    lock ();
    try
    {
      return aSupplier.getAsBoolean ();
    }
    finally
    {
      unlock ();
    }
  }
329872
private <R> CompletableFuture<R> execute(Callable<R> operation) {
        return CompletableFuture.supplyAsync(() -> {
            try {
                return operation.call();
            } catch (Exception ex) {
                throw new CompletionException(ex);
            }
        }, this.executor);
    }
1269305
@Pure
	public static org.arakhne.afc.vmutil.caller.Caller getCaller() {
		synchronized (Caller.class) {
			if (caller == null) {
				caller = new StackTraceCaller();
			}
			return caller;
		}
	}
533871
<T> T runInCompilerThread(Callable<T> callable) {
    return compilerExecutor.runInCompilerThread(
        callable, options != null && options.getTracerMode().isOn());
  }
1091120
private final Result lockForUpgradeInterruptibly_(L locker) throws InterruptedException {
        if (Thread.interrupted()) {
            throw new InterruptedException();
        }
        Result result;
        if ((result = tryLockForUpgrade_(locker)) == Result.FAILED) {
            result = lockForUpgradeQueuedInterruptibly(locker, addUpgradeWaiter());
        }
        return result;
    }
952584
@NotNull
	public static Promise<Void> sequence(@NotNull AsyncSupplier<Void> promise) {
		return promise.get().toVoid();
	}
393161
private final Result tryLockForUpgrade_(L locker, long timeout, TimeUnit unit)
        throws InterruptedException
    {
        if (Thread.interrupted()) {
            throw new InterruptedException();
        }
        Result result;
        if ((result = tryLockForUpgrade_(locker)) == Result.FAILED) {
            result = lockForUpgradeQueuedInterruptibly(locker, addUpgradeWaiter(),
                                                       unit.toNanos(timeout));
        }
        return result;
    }
1086295
public <T> T execute(Callable<T> callable) throws ProcessApplicationExecutionException {
    try {
      return callable.call();
    }
    catch (Exception e) {
      throw LOG.processApplicationExecutionException(e);
    }
  }
199016
public static <T> Callable<T> privilegedCallableUsingCurrentClassLoader(Callable<T> callable) {
        if (callable == null)
            throw new NullPointerException();
        return new PrivilegedCallableUsingCurrentClassLoader<T>(callable);
    }
781312
@Override
    <Result> String execute(final Callable<Result> callable,
                            final TaskCallback<Result> callback,
                            final Object caller) {
        checkArguments(callable, caller);
        return execute(TaskBuilder.create(callable).with(caller).
                callback(callback).on(this).done());
    }
1224039
public V getValue(long timeout, Callable<V> updater, boolean returnExpiredWhileUpdating, Object cacheRequestObject) {
        if (!isInitialized() || hasExpired(timeout, cacheRequestObject)) {
            boolean lockAcquired = false;
            try {
                long beforeLockingCreatedMillis = createdMillis;
                if(returnExpiredWhileUpdating) {
                    if(!writeLock.tryLock()) {
                        if(isInitialized()) {
                            return getValueWhileUpdating(cacheRequestObject);
                        } else {
                            if(LOG.isDebugEnabled()) {
                                LOG.debug("Locking cache for update");
                            }
                            writeLock.lock();
                        }
                    }
                } else {
                    LOG.debug("Locking cache for update");
                    writeLock.lock();
                }
                lockAcquired = true;
                V value;
                if (!isInitialized() || shouldUpdate(beforeLockingCreatedMillis, cacheRequestObject)) {
                    try {
                        value = updateValue(getValue(), updater, cacheRequestObject);
                        if(LOG.isDebugEnabled()) {
                            LOG.debug("Updating cache for value [{}]", value);
                        }
                        setValue(value);
                    }
                    catch (Exception e) {
                        throw new UpdateException(e);
                    }
                } else {
                    value = getValue();
                    resetTimestamp(false);
                }
                return value;
            } finally {
                if(lockAcquired) {
                    if(LOG.isDebugEnabled()) {
                        LOG.debug("Unlocking cache for update");
                    }
                    writeLock.unlock();
                }
            }
        } else {
            return getValue();
        }
    }
7481
@Nonnull
	public static LBoolSupplier boolSupplierFrom(Consumer<LBoolSupplierBuilder> buildingFunction) {
		LBoolSupplierBuilder builder = new LBoolSupplierBuilder();
		buildingFunction.accept(builder);
		return builder.build();
	}
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;
			}
		}
	}
649378
public double locked (@Nonnull final DoubleSupplier aSupplier)
  {
    ValueEnforcer.notNull (aSupplier, "Supplier");

    lock ();
    try
    {
      return aSupplier.getAsDouble ();
    }
    finally
    {
      unlock ();
    }
  }
1218033
@Override
    protected Iterator<?> getJavaIterator(Context cx, Scriptable scope, Object obj) {
        if (obj instanceof Wrapper) {
            Object unwrapped = ((Wrapper) obj).unwrap();
            Iterator<?> iterator = null;
            if (unwrapped instanceof Iterator)
                iterator = (Iterator<?>) unwrapped;
            if (unwrapped instanceof Iterable)
                iterator = ((Iterable<?>)unwrapped).iterator();
            return iterator;
        }
        return null;
    }
587474
public long readLocked (@Nonnull final LongSupplier aSupplier)
  {
    readLock ().lock ();
    try
    {
      return aSupplier.getAsLong ();
    }
    finally
    {
      readLock ().unlock ();
    }
  }
191194
@Nonnull
	public static BooleanSupplier boolSupplierFrom(Consumer<BooleanSupplierBuilder> buildingFunction) {
		BooleanSupplierBuilder builder = new BooleanSupplierBuilder();
		buildingFunction.accept(builder);
		return builder.build();
	}