Codota Logo
Driver.checkLockNotHeld
Code IndexAdd Codota to your IDE (free)

How to use
checkLockNotHeld
method
in
com.facebook.presto.operator.Driver

Best Java code snippets using com.facebook.presto.operator.Driver.checkLockNotHeld (Showing top 10 results out of 315)

  • Common ways to obtain Driver
private void myMethod () {
Driver d =
  • Codota IconDriverFactory driverFactory;DriverContext driverContext;driverFactory.createDriver(driverContext)
  • Smart code suggestions by Codota
}
origin: prestodb/presto

public boolean isFinished()
{
  checkLockNotHeld("Can not check finished status while holding the driver lock");
  // if we can get the lock, attempt a clean shutdown; otherwise someone else will shutdown
  Optional<Boolean> result = tryWithLock(this::isFinishedInternal);
  return result.orElseGet(() -> state.get() != State.ALIVE || driverContext.isDone());
}
origin: prestodb/presto

public void updateSource(TaskSource sourceUpdate)
{
  checkLockNotHeld("Can not update sources while holding the driver lock");
  checkArgument(
      sourceOperator.isPresent() && sourceOperator.get().getSourceId().equals(sourceUpdate.getPlanNodeId()),
      "sourceUpdate is for a plan node that is different from this Driver's source node");
  // stage the new updates
  pendingTaskSourceUpdates.updateAndGet(current -> current == null ? sourceUpdate : current.update(sourceUpdate));
  // attempt to get the lock and process the updates we staged above
  // updates will be processed in close if and only if we got the lock
  tryWithLock(() -> TRUE);
}
origin: prestodb/presto

public ListenableFuture<?> process()
{
  checkLockNotHeld("Can not process while holding the driver lock");
  // if the driver is blocked we don't need to continue
  SettableFuture<?> blockedFuture = driverBlockedFuture.get();
  if (!blockedFuture.isDone()) {
    return blockedFuture;
  }
  Optional<ListenableFuture<?>> result = tryWithLock(100, TimeUnit.MILLISECONDS, () -> {
    ListenableFuture<?> future = processInternal(createTimer());
    return updateDriverBlockedFuture(future);
  });
  return result.orElse(NOT_BLOCKED);
}
origin: prestodb/presto

private <T> Optional<T> tryWithLock(long timeout, TimeUnit unit, Supplier<T> task)
  checkLockNotHeld("Lock can not be reacquired");
origin: prestodb/presto

public ListenableFuture<?> processFor(Duration duration)
  checkLockNotHeld("Can not process for a duration while holding the driver lock");
origin: uk.co.nichesolutions.presto/presto-main

private DriverLockResult tryLockAndProcessPendingStateChanges(int timeout, TimeUnit unit)
{
  checkLockNotHeld("Can not acquire the driver lock while already holding the driver lock");
  return new DriverLockResult(timeout, unit);
}
origin: uk.co.nichesolutions.presto/presto-main

public ListenableFuture<?> process()
{
  checkLockNotHeld("Can not process while holding the driver lock");
  try (DriverLockResult lockResult = tryLockAndProcessPendingStateChanges(100, TimeUnit.MILLISECONDS)) {
    if (!lockResult.wasAcquired()) {
      // this is unlikely to happen unless the driver is being
      // destroyed and in that case the caller should notice notice
      // this state change by calling isFinished
      return NOT_BLOCKED;
    }
    return processInternal();
  }
}
origin: uk.co.nichesolutions.presto/presto-main

public boolean isFinished()
{
  checkLockNotHeld("Can not check finished status while holding the driver lock");
  // if we can get the lock, attempt a clean shutdown; otherwise someone else will shutdown
  try (DriverLockResult lockResult = tryLockAndProcessPendingStateChanges(0, TimeUnit.MILLISECONDS)) {
    if (lockResult.wasAcquired()) {
      return isFinishedInternal();
    }
    else {
      // did not get the lock, so we can't check operators, or destroy
      return state.get() != State.ALIVE || driverContext.isDone();
    }
  }
}
origin: uk.co.nichesolutions.presto/presto-main

public void updateSource(TaskSource source)
  checkLockNotHeld("Can not update sources while holding the driver lock");
origin: uk.co.nichesolutions.presto/presto-main

public ListenableFuture<?> processFor(Duration duration)
{
  checkLockNotHeld("Can not process for a duration while holding the driver lock");
  requireNonNull(duration, "duration is null");
  long maxRuntime = duration.roundTo(TimeUnit.NANOSECONDS);
  try (DriverLockResult lockResult = tryLockAndProcessPendingStateChanges(100, TimeUnit.MILLISECONDS)) {
    if (lockResult.wasAcquired()) {
      driverContext.startProcessTimer();
      try {
        long start = System.nanoTime();
        do {
          ListenableFuture<?> future = processInternal();
          if (!future.isDone()) {
            return future;
          }
        }
        while (System.nanoTime() - start < maxRuntime && !isFinishedInternal());
      }
      finally {
        driverContext.recordProcessed();
      }
    }
  }
  return NOT_BLOCKED;
}
com.facebook.presto.operatorDrivercheckLockNotHeld

Popular methods of Driver

  • isFinished
  • process
  • getDriverContext
  • close
  • processFor
  • updateSource
  • <init>
  • addSuppressedException
  • checkLockHeld
  • createDriver
  • firstFinishedFuture
  • isFinishedInternal
  • firstFinishedFuture,
  • isFinishedInternal,
  • processInternal,
  • processNewSources,
  • checkOperatorFinishedRevoking,
  • closeAndDestroyOperators,
  • createTimer,
  • destroyIfNecessary,
  • getBlockedFuture

Popular in Java

  • Start an intent from android
  • setScale (BigDecimal)
  • onCreateOptionsMenu (Activity)
  • findViewById (Activity)
  • ArrayList (java.util)
    Resizable-array implementation of the List interface. Implements all optional list operations, and p
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • JTextField (javax.swing)
  • Table (org.hibernate.mapping)
    A relational table
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now