com.google.common.util.concurrent.AbstractFuture.addListener()方法的使用及代码示例

x33g5p2x  于11个月前 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(32)

本文整理了Java中com.google.common.util.concurrent.AbstractFuture.addListener()方法的一些代码示例,展示了AbstractFuture.addListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractFuture.addListener()方法的具体详情如下:
包路径:com.google.common.util.concurrent.AbstractFuture
类名称:AbstractFuture
方法名:addListener

AbstractFuture.addListener介绍

暂无

代码示例

代码示例来源:origin: google/guava

@Override
public final void addListener(Runnable listener, Executor executor) {
 super.addListener(listener, executor);
}

代码示例来源:origin: google/j2objc

@Override
public final void addListener(Runnable listener, Executor executor) {
 super.addListener(listener, executor);
}

代码示例来源:origin: wildfly/wildfly

@Override
public final void addListener(Runnable listener, Executor executor) {
 super.addListener(listener, executor);
}

代码示例来源:origin: google/guava

@Override
 public void run() {
  currentFuture.get().addListener(listener, executor);
 }
});

代码示例来源:origin: google/guava

@Override
 public Void call() throws Exception {
  currentFuture.get().addListener(listener, executor);
  return null;
 }
});

代码示例来源:origin: google/guava

f.get();
final AtomicBoolean ranImmediately = new AtomicBoolean();
f.addListener(
  new Runnable() {
   @Override

代码示例来源:origin: google/guava

private static void assertDone(AbstractFuture<Integer> future) {
 CountingRunnable listener = new CountingRunnable();
 future.addListener(listener, directExecutor());
 listener.assertRun();
 assertThat(future.isDone()).isTrue();
 assertCannotSet(future);
 assertCannotCancel(future);
}

代码示例来源:origin: google/guava

private static void assertPending(AbstractFuture<Integer> future) {
 assertThat(future.isDone()).isFalse();
 assertThat(future.isCancelled()).isFalse();
 CountingRunnable listener = new CountingRunnable();
 future.addListener(listener, directExecutor());
 listener.assertNotRun();
 verifyGetOnPendingFuture(future);
 verifyTimedGetOnPendingFuture(future);
}

代码示例来源:origin: org.apache.twill/twill-zookeeper

@Override
public void addListener(final Runnable listener, final Executor exec) {
 super.addListener(new Runnable() {
  @Override
  public void run() {
   exec.execute(listener);
  }
 }, executor);
}

代码示例来源:origin: com.diffplug.guava/guava-concurrent

@Override
  public final void addListener(Runnable listener, Executor executor) {
    super.addListener(listener, executor);
  }
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

@Override
public final void addListener(Runnable listener, Executor executor) {
 super.addListener(listener, executor);
}

代码示例来源:origin: com.alibaba.edas/edas-sdk

@Override
public void addListener(final Runnable listener) {
  super.addListener(listener, executor);
}

代码示例来源:origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger

@Override
public final void addListener(Runnable listener, Executor executor) {
 super.addListener(listener, executor);
}

代码示例来源:origin: apache/twill

@Override
public void addListener(final Runnable listener, final Executor exec) {
 super.addListener(new Runnable() {
  @Override
  public void run() {
   exec.execute(listener);
  }
 }, executor);
}

代码示例来源:origin: org.apache.qpid/qpid-bdbstore

@Override
  public void addListener(final Runnable listener, final Executor exec)
  {
    super.addListener(listener, exec);
    _commitThread.explicitNotify();
  }
}

代码示例来源:origin: com.google.guava/guava-tests

@Override public Void call() throws Exception {
  currentFuture.get().addListener(listener, executor);
  return null;
 }
});

代码示例来源:origin: io.airlift.drift/drift-transport-netty

private InvocationResponseFuture(InvokeRequest request, ConnectionParameters connectionParameters, ConnectionManager connectionManager)
{
  this.request = requireNonNull(request, "request is null");
  this.connectionParameters = requireNonNull(connectionParameters, "connectionConfig is null");
  this.connectionManager = requireNonNull(connectionManager, "connectionManager is null");
  // if this invocation is canceled, cancel the tasks
  super.addListener(() -> {
    if (super.isCancelled()) {
      onCancel(wasInterrupted());
    }
  }, directExecutor());
}

代码示例来源:origin: airlift/drift

private InvocationResponseFuture(InvokeRequest request, ConnectionParameters connectionParameters, ConnectionManager connectionManager)
{
  this.request = requireNonNull(request, "request is null");
  this.connectionParameters = requireNonNull(connectionParameters, "connectionConfig is null");
  this.connectionManager = requireNonNull(connectionManager, "connectionManager is null");
  // if this invocation is canceled, cancel the tasks
  super.addListener(() -> {
    if (super.isCancelled()) {
      onCancel(wasInterrupted());
    }
  }, directExecutor());
}

代码示例来源:origin: com.google.guava/guava-tests

private static void assertDone(AbstractFuture<Integer> future) {
 CountingRunnable listener = new CountingRunnable();
 future.addListener(listener, directExecutor());
 listener.assertRun();
 assertThat(future.isDone()).isTrue();
 assertCannotSet(future);
 assertCannotCancel(future);
}

代码示例来源:origin: com.google.guava/guava-tests

private static void assertPending(AbstractFuture<Integer> future) {
 assertThat(future.isDone()).isFalse();
 assertThat(future.isCancelled()).isFalse();
 CountingRunnable listener = new CountingRunnable();
 future.addListener(listener, directExecutor());
 listener.assertNotRun();
 verifyGetOnPendingFuture(future);
 verifyTimedGetOnPendingFuture(future);
}

相关文章