Tabnine Logo
Driver.close
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: prestodb/presto

  @Override
  public void close()
  {
    driver.close();
    currentPage = null;
  }
}
origin: prestodb/presto

  @Override
  public void close()
  {
    Driver driver;
    synchronized (this) {
      closed = true;
      driver = this.driver;
    }
    if (driver != null) {
      driver.close();
    }
  }
}
origin: prestodb/presto

  @Override
  public Boolean call()
  {
    driver.close();
    return true;
  }
});
origin: prestodb/presto

@Test
public void testBrokenOperatorCloseWhileProcessing()
    throws Exception
{
  BrokenOperator brokenOperator = new BrokenOperator(driverContext.addOperatorContext(0, new PlanNodeId("test"), "source"), false);
  final Driver driver = Driver.createDriver(driverContext, brokenOperator, createSinkOperator(ImmutableList.of()));
  assertSame(driver.getDriverContext(), driverContext);
  // block thread in operator processing
  Future<Boolean> driverProcessFor = executor.submit(new Callable<Boolean>()
  {
    @Override
    public Boolean call()
    {
      return driver.processFor(new Duration(1, TimeUnit.MILLISECONDS)).isDone();
    }
  });
  brokenOperator.waitForLocked();
  driver.close();
  assertTrue(driver.isFinished());
  try {
    driverProcessFor.get(1, TimeUnit.SECONDS);
    fail("Expected InterruptedException");
  }
  catch (ExecutionException e) {
    assertDriverInterrupted(e.getCause());
  }
}
origin: prestodb/presto

@Test(invocationCount = 1_000, timeOut = 10_000)
public void testConcurrentClose()
{
  List<Type> types = ImmutableList.of(VARCHAR, BIGINT, BIGINT);
  OperatorContext operatorContext = driverContext.addOperatorContext(0, new PlanNodeId("test"), "values");
  ValuesOperator source = new ValuesOperator(operatorContext, rowPagesBuilder(types)
      .addSequencePage(10, 20, 30, 40)
      .build());
  Operator sink = createSinkOperator(types);
  Driver driver = Driver.createDriver(driverContext, source, sink);
  // let these threads race
  scheduledExecutor.submit(() -> driver.processFor(new Duration(1, TimeUnit.NANOSECONDS))); // don't want to call isFinishedInternal in processFor
  scheduledExecutor.submit(() -> driver.close());
  while (!driverContext.isDone()) {
    Uninterruptibles.sleepUninterruptibly(1, TimeUnit.MILLISECONDS);
  }
}
origin: prestodb/presto

@Test
public void testAbruptFinish()
{
  List<Type> types = ImmutableList.of(VARCHAR, BIGINT, BIGINT);
  ValuesOperator source = new ValuesOperator(driverContext.addOperatorContext(0, new PlanNodeId("test"), "values"), rowPagesBuilder(types)
      .addSequencePage(10, 20, 30, 40)
      .build());
  PageConsumerOperator sink = createSinkOperator(types);
  Driver driver = Driver.createDriver(driverContext, source, sink);
  assertSame(driver.getDriverContext(), driverContext);
  assertFalse(driver.isFinished());
  driver.close();
  assertTrue(driver.isFinished());
  // finish is only called in normal operations
  assertFalse(source.isFinished());
  assertFalse(sink.isFinished());
  // close is always called (values operator doesn't have a closed state)
  assertTrue(sink.isClosed());
}
origin: prestodb/presto

assertFalse(driver.isFinished());
driver.close();
assertTrue(driver.isFinished());
origin: uk.co.nichesolutions.presto/presto-main

  @Override
  public void close()
  {
    driver.close();
    currentPage = null;
  }
}
origin: uk.co.nichesolutions.presto/presto-main

  @Override
  public void close()
  {
    Driver driver;
    synchronized (this) {
      closed = true;
      driver = this.driver;
    }
    if (driver != null) {
      driver.close();
    }
  }
}
origin: uk.co.nichesolutions.presto/presto-main

  @Override
  public Boolean call()
      throws Exception
  {
    driver.close();
    return true;
  }
});
origin: uk.co.nichesolutions.presto/presto-main

@Test
public void testBrokenOperatorCloseWhileProcessing()
    throws Exception
{
  BrokenOperator brokenOperator = new BrokenOperator(driverContext.addOperatorContext(0, new PlanNodeId("test"), "source"), false);
  final Driver driver = new Driver(driverContext, brokenOperator, createSinkOperator(brokenOperator));
  assertSame(driver.getDriverContext(), driverContext);
  // block thread in operator processing
  Future<Boolean> driverProcessFor = executor.submit(new Callable<Boolean>()
  {
    @Override
    public Boolean call()
        throws Exception
    {
      return driver.processFor(new Duration(1, TimeUnit.MILLISECONDS)).isDone();
    }
  });
  brokenOperator.waitForLocked();
  driver.close();
  assertTrue(driver.isFinished());
  try {
    driverProcessFor.get(1, TimeUnit.SECONDS);
    fail("Expected InterruptedException");
  }
  catch (ExecutionException e) {
    checkArgument(getRootCause(e) instanceof InterruptedException, "Expected root cause exception to be an instance of InterruptedException");
  }
}
origin: uk.co.nichesolutions.presto/presto-main

@Test
public void testAbruptFinish()
{
  List<Type> types = ImmutableList.<Type>of(VARCHAR, BIGINT, BIGINT);
  ValuesOperator source = new ValuesOperator(driverContext.addOperatorContext(0, new PlanNodeId("test"), "values"), types, rowPagesBuilder(types)
      .addSequencePage(10, 20, 30, 40)
      .build());
  MaterializingOperator sink = createSinkOperator(source);
  Driver driver = new Driver(driverContext, source, sink);
  assertSame(driver.getDriverContext(), driverContext);
  assertFalse(driver.isFinished());
  driver.close();
  assertTrue(driver.isFinished());
  // finish is only called in normal operations
  assertFalse(source.isFinished());
  assertFalse(sink.isFinished());
  // close is always called (values operator doesn't have a closed state)
  assertTrue(sink.isClosed());
}
origin: uk.co.nichesolutions.presto/presto-main

assertFalse(driver.isFinished());
driver.close();
assertTrue(driver.isFinished());
com.facebook.presto.operatorDriverclose

Popular methods of Driver

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

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getApplicationContext (Context)
  • onCreateOptionsMenu (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Runner (org.openjdk.jmh.runner)
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now