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

x33g5p2x  于2022-01-15 转载在 其他  
字(11.9k)|赞(0)|评价(0)|浏览(104)

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

AbstractFuture.complete介绍

[英]Unblocks all threads and runs all listeners.
[中]取消阻止所有线程并运行所有侦听器。

代码示例

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

/**
 * Sets the failed result of this {@code Future} unless this {@code Future} has already been
 * cancelled or set (including {@linkplain #setFuture set asynchronously}). When a call to this
 * method returns, the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b>
 * the call was accepted (in which case it returns {@code true}). If it returns {@code false}, the
 * {@code Future} may have previously been set asynchronously, in which case its result may not be
 * known yet. That result, though not yet known, cannot be overridden by a call to a {@code set*}
 * method, only by a call to {@link #cancel}.
 *
 * @param throwable the exception to be used as the failed result
 * @return true if the attempt was accepted, completing the {@code Future}
 */
@CanIgnoreReturnValue
protected boolean setException(Throwable throwable) {
 Object valueToSet = new Failure(checkNotNull(throwable));
 if (ATOMIC_HELPER.casValue(this, null, valueToSet)) {
  complete(this);
  return true;
 }
 return false;
}

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

/**
 * Sets the result of this {@code Future} unless this {@code Future} has already been cancelled or
 * set (including {@linkplain #setFuture set asynchronously}). When a call to this method returns,
 * the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b> the call was
 * accepted (in which case it returns {@code true}). If it returns {@code false}, the {@code
 * Future} may have previously been set asynchronously, in which case its result may not be known
 * yet. That result, though not yet known, cannot be overridden by a call to a {@code set*}
 * method, only by a call to {@link #cancel}.
 *
 * @param value the value to be used as the result
 * @return true if the attempt was accepted, completing the {@code Future}
 */
@CanIgnoreReturnValue
protected boolean set(@Nullable V value) {
 Object valueToSet = value == null ? NULL : value;
 if (ATOMIC_HELPER.casValue(this, null, valueToSet)) {
  complete(this);
  return true;
 }
 return false;
}

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

/**
 * Sets the failed result of this {@code Future} unless this {@code Future} has already been
 * cancelled or set (including {@linkplain #setFuture set asynchronously}). When a call to this
 * method returns, the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b>
 * the call was accepted (in which case it returns {@code true}). If it returns {@code false}, the
 * {@code Future} may have previously been set asynchronously, in which case its result may not be
 * known yet. That result, though not yet known, cannot be overridden by a call to a {@code set*}
 * method, only by a call to {@link #cancel}.
 *
 * @param throwable the exception to be used as the failed result
 * @return true if the attempt was accepted, completing the {@code Future}
 */
@CanIgnoreReturnValue
protected boolean setException(Throwable throwable) {
 Object valueToSet = new Failure(checkNotNull(throwable));
 if (ATOMIC_HELPER.casValue(this, null, valueToSet)) {
  complete(this);
  return true;
 }
 return false;
}

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

abstractFuture.interruptTask();
complete(abstractFuture);
if (localValue instanceof SetFuture) {

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

/**
 * Sets the failed result of this {@code Future} unless this {@code Future} has already been
 * cancelled or set (including {@linkplain #setFuture set asynchronously}). When a call to this
 * method returns, the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b>
 * the call was accepted (in which case it returns {@code true}). If it returns {@code false}, the
 * {@code Future} may have previously been set asynchronously, in which case its result may not be
 * known yet. That result, though not yet known, cannot be overridden by a call to a {@code set*}
 * method, only by a call to {@link #cancel}.
 *
 * @param throwable the exception to be used as the failed result
 * @return true if the attempt was accepted, completing the {@code Future}
 */
@CanIgnoreReturnValue
protected boolean setException(Throwable throwable) {
 Object valueToSet = new Failure(checkNotNull(throwable));
 if (ATOMIC_HELPER.casValue(this, null, valueToSet)) {
  complete(this);
  return true;
 }
 return false;
}

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

/**
 * Sets the result of this {@code Future} unless this {@code Future} has already been cancelled or
 * set (including {@linkplain #setFuture set asynchronously}). When a call to this method returns,
 * the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b> the call was
 * accepted (in which case it returns {@code true}). If it returns {@code false}, the {@code
 * Future} may have previously been set asynchronously, in which case its result may not be known
 * yet. That result, though not yet known, cannot be overridden by a call to a {@code set*}
 * method, only by a call to {@link #cancel}.
 *
 * @param value the value to be used as the result
 * @return true if the attempt was accepted, completing the {@code Future}
 */
@CanIgnoreReturnValue
protected boolean set(@NullableDecl V value) {
 Object valueToSet = value == null ? NULL : value;
 if (ATOMIC_HELPER.casValue(this, null, valueToSet)) {
  complete(this);
  return true;
 }
 return false;
}

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

/**
 * Sets the result of this {@code Future} unless this {@code Future} has already been cancelled or
 * set (including {@linkplain #setFuture set asynchronously}). When a call to this method returns,
 * the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b> the call was
 * accepted (in which case it returns {@code true}). If it returns {@code false}, the {@code
 * Future} may have previously been set asynchronously, in which case its result may not be known
 * yet. That result, though not yet known, cannot be overridden by a call to a {@code set*}
 * method, only by a call to {@link #cancel}.
 *
 * @param value the value to be used as the result
 * @return true if the attempt was accepted, completing the {@code Future}
 */
@CanIgnoreReturnValue
protected boolean set(@NullableDecl V value) {
 Object valueToSet = value == null ? NULL : value;
 if (ATOMIC_HELPER.casValue(this, null, valueToSet)) {
  complete(this);
  return true;
 }
 return false;
}

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

abstractFuture.interruptTask();
complete(abstractFuture);
if (localValue instanceof SetFuture) {

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

Object value = getFutureValue(future);
if (ATOMIC_HELPER.casValue(this, null, value)) {
 complete(this);
 return true;

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

abstractFuture.interruptTask();
complete(abstractFuture);
if (localValue instanceof SetFuture) {

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

Object value = getFutureValue(future);
if (ATOMIC_HELPER.casValue(this, null, value)) {
 complete(this);
 return true;

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

Object value = getFutureValue(future);
if (ATOMIC_HELPER.casValue(this, null, value)) {
 complete(this);
 return true;

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

/**
 * Sets the result of this {@code Future} unless this {@code Future} has already been cancelled or
 * set (including {@linkplain #setFuture set asynchronously}). When a call to this method returns,
 * the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b> the call was
 * accepted (in which case it returns {@code true}). If it returns {@code false}, the {@code
 * Future} may have previously been set asynchronously, in which case its result may not be known
 * yet. That result, though not yet known, cannot by overridden by a call to a {@code set*}
 * method, only by a call to {@link #cancel}.
 *
 * @param value the value to be used as the result
 * @return true if the attempt was accepted, completing the {@code Future}
 */
protected boolean set(@Nullable V value) {
  Object valueToSet = value == null ? NULL : value;
  if (ATOMIC_HELPER.casValue(this, null, valueToSet)) {
    complete();
    return true;
  }
  return false;
}

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

/**
 * Sets the failed result of this {@code Future} unless this {@code Future} has already been
 * cancelled or set (including {@linkplain #setFuture set asynchronously}). When a call to this
 * method returns, the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b>
 * the call was accepted (in which case it returns {@code true}). If it returns {@code false}, the
 * {@code Future} may have previously been set asynchronously, in which case its result may not be
 * known yet. That result, though not yet known, cannot by overridden by a call to a {@code set*}
 * method, only by a call to {@link #cancel}.
 *
 * @param throwable the exception to be used as the failed result
 * @return true if the attempt was accepted, completing the {@code Future}
 */
protected boolean setException(Throwable throwable) {
  Object valueToSet = new Failure(checkNotNull(throwable));
  if (ATOMIC_HELPER.casValue(this, null, valueToSet)) {
    complete();
    return true;
  }
  return false;
}

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

/**
 * Sets the failed result of this {@code Future} unless this {@code Future} has already been
 * cancelled or set (including {@linkplain #setFuture set asynchronously}). When a call to this
 * method returns, the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b>
 * the call was accepted (in which case it returns {@code true}). If it returns {@code false}, the
 * {@code Future} may have previously been set asynchronously, in which case its result may not be
 * known yet. That result, though not yet known, cannot be overridden by a call to a {@code set*}
 * method, only by a call to {@link #cancel}.
 *
 * @param throwable the exception to be used as the failed result
 * @return true if the attempt was accepted, completing the {@code Future}
 */
@CanIgnoreReturnValue
protected boolean setException(Throwable throwable) {
 Object valueToSet = new Failure(checkNotNull(throwable));
 if (ATOMIC_HELPER.casValue(this, null, valueToSet)) {
  complete(this);
  return true;
 }
 return false;
}

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

/**
 * Sets the failed result of this {@code Future} unless this {@code Future} has already been
 * cancelled or set (including {@linkplain #setFuture set asynchronously}). When a call to this
 * method returns, the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b>
 * the call was accepted (in which case it returns {@code true}). If it returns {@code false}, the
 * {@code Future} may have previously been set asynchronously, in which case its result may not be
 * known yet. That result, though not yet known, cannot be overridden by a call to a {@code set*}
 * method, only by a call to {@link #cancel}.
 *
 * @param throwable the exception to be used as the failed result
 * @return true if the attempt was accepted, completing the {@code Future}
 */
@CanIgnoreReturnValue
protected boolean setException(Throwable throwable) {
 Object valueToSet = new Failure(checkNotNull(throwable));
 if (ATOMIC_HELPER.casValue(this, null, valueToSet)) {
  complete(this);
  return true;
 }
 return false;
}

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

/**
 * Sets the result of this {@code Future} unless this {@code Future} has already been cancelled or
 * set (including {@linkplain #setFuture set asynchronously}). When a call to this method returns,
 * the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b> the call was
 * accepted (in which case it returns {@code true}). If it returns {@code false}, the {@code
 * Future} may have previously been set asynchronously, in which case its result may not be known
 * yet. That result, though not yet known, cannot be overridden by a call to a {@code set*}
 * method, only by a call to {@link #cancel}.
 *
 * @param value the value to be used as the result
 * @return true if the attempt was accepted, completing the {@code Future}
 */
@CanIgnoreReturnValue
protected boolean set(@NullableDecl V value) {
 Object valueToSet = value == null ? NULL : value;
 if (ATOMIC_HELPER.casValue(this, null, valueToSet)) {
  complete(this);
  return true;
 }
 return false;
}

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

/**
 * Sets the result of this {@code Future} unless this {@code Future} has already been cancelled or
 * set (including {@linkplain #setFuture set asynchronously}). When a call to this method returns,
 * the {@code Future} is guaranteed to be {@linkplain #isDone done} <b>only if</b> the call was
 * accepted (in which case it returns {@code true}). If it returns {@code false}, the {@code
 * Future} may have previously been set asynchronously, in which case its result may not be known
 * yet. That result, though not yet known, cannot be overridden by a call to a {@code set*}
 * method, only by a call to {@link #cancel}.
 *
 * @param value the value to be used as the result
 * @return true if the attempt was accepted, completing the {@code Future}
 */
@CanIgnoreReturnValue
protected boolean set(@Nullable V value) {
 Object valueToSet = value == null ? NULL : value;
 if (ATOMIC_HELPER.casValue(this, null, valueToSet)) {
  complete(this);
  return true;
 }
 return false;
}

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

complete();
return true;

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

interruptTask();
complete();
if (localValue instanceof AbstractFuture.SetFuture) {

相关文章