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

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

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

AbstractFuture.executeListener介绍

[英]Submits the given runnable to the given Executor catching and logging all RuntimeException thrown by the executor.
[中]将给定的runnable提交给给定的执行器捕获并记录执行器引发的所有RuntimeException。

代码示例

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

executeListener(listener, executor);

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

/**
 * {@inheritDoc}
 *
 * @since 10.0
 */
@Override
public void addListener(Runnable listener, Executor executor) {
 checkNotNull(listener, "Runnable was null.");
 checkNotNull(executor, "Executor was null.");
 Listener oldHead = listeners;
 if (oldHead != Listener.TOMBSTONE) {
  Listener newNode = new Listener(listener, executor);
  do {
   newNode.next = oldHead;
   if (ATOMIC_HELPER.casListeners(this, oldHead, newNode)) {
    return;
   }
   oldHead = listeners; // re-read
  } while (oldHead != Listener.TOMBSTONE);
 }
 // If we get here then the Listener TOMBSTONE was set, which means the future is done, call
 // the listener.
 executeListener(listener, executor);
}

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

/**
 * {@inheritDoc}
 *
 * @since 10.0
 */
@Override
public void addListener(Runnable listener, Executor executor) {
 checkNotNull(listener, "Runnable was null.");
 checkNotNull(executor, "Executor was null.");
 Listener oldHead = listeners;
 if (oldHead != Listener.TOMBSTONE) {
  Listener newNode = new Listener(listener, executor);
  do {
   newNode.next = oldHead;
   if (ATOMIC_HELPER.casListeners(this, oldHead, newNode)) {
    return;
   }
   oldHead = listeners; // re-read
  } while (oldHead != Listener.TOMBSTONE);
 }
 // If we get here then the Listener TOMBSTONE was set, which means the future is done, call
 // the listener.
 executeListener(listener, executor);
}

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

executeListener(task, curr.executor);

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

executeListener(task, curr.executor);

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

executeListener(task, curr.executor);

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

/**
 * {@inheritDoc}
 *
 * @since 10.0
 */
@Override
public void addListener(Runnable listener, Executor executor) {
  checkNotNull(listener, "Runnable was null.");
  checkNotNull(executor, "Executor was null.");
  Listener oldHead = listeners;
  if (oldHead != Listener.TOMBSTONE) {
    Listener newNode = new Listener(listener, executor);
    do {
      newNode.next = oldHead;
      if (ATOMIC_HELPER.casListeners(this, oldHead, newNode)) {
        return;
      }
      oldHead = listeners; // re-read
    } while (oldHead != Listener.TOMBSTONE);
  }
  // If we get here then the Listener TOMBSTONE was set, which means the future is done, call
  // the listener.
  executeListener(listener, executor);
}

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

/**
 * {@inheritDoc}
 *
 * @since 10.0
 */
@Override
public void addListener(Runnable listener, Executor executor) {
 checkNotNull(listener, "Runnable was null.");
 checkNotNull(executor, "Executor was null.");
 Listener oldHead = listeners;
 if (oldHead != Listener.TOMBSTONE) {
  Listener newNode = new Listener(listener, executor);
  do {
   newNode.next = oldHead;
   if (ATOMIC_HELPER.casListeners(this, oldHead, newNode)) {
    return;
   }
   oldHead = listeners; // re-read
  } while (oldHead != Listener.TOMBSTONE);
 }
 // If we get here then the Listener TOMBSTONE was set, which means the future is done, call
 // the listener.
 executeListener(listener, executor);
}

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

/**
 * {@inheritDoc}
 *
 * @since 10.0
 */
@Override
public void addListener(Runnable listener, Executor executor) {
 checkNotNull(listener, "Runnable was null.");
 checkNotNull(executor, "Executor was null.");
 Listener oldHead = listeners;
 if (oldHead != Listener.TOMBSTONE) {
  Listener newNode = new Listener(listener, executor);
  do {
   newNode.next = oldHead;
   if (ATOMIC_HELPER.casListeners(this, oldHead, newNode)) {
    return;
   }
   oldHead = listeners; // re-read
  } while (oldHead != Listener.TOMBSTONE);
 }
 // If we get here then the Listener TOMBSTONE was set, which means the future is done, call
 // the listener.
 executeListener(listener, executor);
}

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

/** Unblocks all threads and runs all listeners. */
private void complete() {
  for (Waiter currentWaiter = clearWaiters(); currentWaiter != null; currentWaiter = currentWaiter.next) {
    currentWaiter.unpark();
  }
  // We need to reverse the list to handle buggy listeners that depend on ordering.
  Listener currentListener = clearListeners();
  Listener reversedList = null;
  while (currentListener != null) {
    Listener tmp = currentListener;
    currentListener = currentListener.next;
    tmp.next = reversedList;
    reversedList = tmp;
  }
  for (; reversedList != null; reversedList = reversedList.next) {
    executeListener(reversedList.task, reversedList.executor);
  }
  // We call this after the listeners on the theory that done() will only be used for 'cleanup'
  // oriented tasks (e.g. clearing fields) and so can wait behind listeners which may be executing
  // more important work.  A counter argument would be that done() is trusted code and therefore
  // it would be safe to run before potentially slow or poorly behaved listeners.  Reevaluate this
  // once we have more examples of done() implementations.
  done();
}

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

executeListener(task, curr.executor);

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

executeListener(task, curr.executor);

相关文章