本文整理了Java中com.google.common.util.concurrent.AbstractFuture.wasInterrupted()
方法的一些代码示例,展示了AbstractFuture.wasInterrupted()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractFuture.wasInterrupted()
方法的具体详情如下:
包路径:com.google.common.util.concurrent.AbstractFuture
类名称:AbstractFuture
方法名:wasInterrupted
[英]Returns true if this future was cancelled with mayInterruptIfRunning set to true.
[中]如果在MayInterruptFrunning设置为true的情况下取消此未来,则返回true。
代码示例来源:origin: google/guava
/**
* If this future has been cancelled (and possibly interrupted), cancels (and possibly interrupts)
* the given future (if available).
*/
final void maybePropagateCancellationTo(@Nullable Future<?> related) {
if (related != null & isCancelled()) {
related.cancel(wasInterrupted());
}
}
代码示例来源:origin: google/j2objc
/**
* If this future has been cancelled (and possibly interrupted), cancels (and possibly interrupts)
* the given future (if available).
*/
final void maybePropagateCancellationTo(@NullableDecl Future<?> related) {
if (related != null & isCancelled()) {
related.cancel(wasInterrupted());
}
}
代码示例来源:origin: wildfly/wildfly
/**
* If this future has been cancelled (and possibly interrupted), cancels (and possibly interrupts)
* the given future (if available).
*/
final void maybePropagateCancellationTo(@NullableDecl Future<?> related) {
if (related != null & isCancelled()) {
related.cancel(wasInterrupted());
}
}
代码示例来源:origin: google/guava
public void testTransformAsync_inputCancelButNotInterruptPropagatesToOutput() throws Exception {
SettableFuture<Foo> f1 = SettableFuture.create();
final SettableFuture<Bar> secondary = SettableFuture.create();
AsyncFunction<Foo, Bar> function =
new AsyncFunction<Foo, Bar>() {
@Override
public ListenableFuture<Bar> apply(Foo unused) {
return secondary;
}
};
ListenableFuture<Bar> f2 = transformAsync(f1, function, directExecutor());
f1.cancel(true);
assertTrue(f2.isCancelled());
/*
* We might like to propagate interruption, too, but it's not clear that it matters. For now, we
* test for the behavior that we have today.
*/
assertFalse(((AbstractFuture<?>) f2).wasInterrupted());
}
代码示例来源:origin: google/guava
assertTrue(setFuture.wasInterrupted()); // we only call cancel(true)
代码示例来源:origin: google/guava
private static void assertCancelled(AbstractFuture<Integer> future, boolean expectWasInterrupted)
throws InterruptedException, TimeoutException, ExecutionException {
assertDone(future);
assertThat(future.isCancelled()).isTrue();
assertThat(future.wasInterrupted()).isEqualTo(expectWasInterrupted);
try {
getDone(future);
fail();
} catch (CancellationException expected) {
}
try {
getDoneFromTimeoutOverload(future);
fail();
} catch (CancellationException expected) {
}
}
代码示例来源:origin: google/guava
if (result == CancellationException.class) {
assertTrue(future.isCancelled());
if (future.wasInterrupted()) {
代码示例来源:origin: com.google.dagger/dagger-producers
public boolean interrupted() {
return super.wasInterrupted();
}
}
代码示例来源:origin: airlift/airlift
/**
* @return true if the Future was interrupted when cancelled.
*/
@VisibleForTesting
boolean checkWasInterrupted()
{
return super.wasInterrupted();
}
}
代码示例来源:origin: io.airlift/concurrent
/**
* @return true if the Future was interrupted when cancelled.
*/
@VisibleForTesting
boolean checkWasInterrupted()
{
return super.wasInterrupted();
}
}
代码示例来源:origin: com.proofpoint.platform/concurrent
/**
* @return true if the Future was interrupted when cancelled.
*/
@VisibleForTesting
boolean checkWasInterrupted()
{
return super.wasInterrupted();
}
}
代码示例来源:origin: com.diffplug.guava/guava-concurrent
/**
* If this future has been cancelled (and possibly interrupted), cancels (and possibly interrupts)
* the given future (if available).
*
* <p>This method should be used only when this future is completed. It is designed to be called
* from {@code done}.
*/
final void maybePropagateCancellation(@Nullable Future<?> related) {
if (related != null & isCancelled()) {
related.cancel(wasInterrupted());
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger
/**
* If this future has been cancelled (and possibly interrupted), cancels (and possibly interrupts)
* the given future (if available).
*/
final void maybePropagateCancellationTo(@Nullable Future<?> related) {
if (related != null & isCancelled()) {
related.cancel(wasInterrupted());
}
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
/**
* If this future has been cancelled (and possibly interrupted), cancels (and possibly interrupts)
* the given future (if available).
*/
final void maybePropagateCancellationTo(@NullableDecl Future<?> related) {
if (related != null & isCancelled()) {
related.cancel(wasInterrupted());
}
}
代码示例来源:origin: airlift/airlift
delegate.cancel(super.wasInterrupted());
代码示例来源:origin: io.airlift/concurrent
delegate.cancel(super.wasInterrupted());
代码示例来源:origin: com.proofpoint.platform/concurrent
delegate.cancel(super.wasInterrupted());
代码示例来源:origin: com.google.guava/guava-tests
public void testTransformAsync_inputCancelButNotInterruptPropagatesToOutput() throws Exception {
SettableFuture<Foo> f1 = SettableFuture.create();
final SettableFuture<Bar> secondary = SettableFuture.create();
AsyncFunction<Foo, Bar> function =
new AsyncFunction<Foo, Bar>() {
@Override
public ListenableFuture<Bar> apply(Foo unused) {
return secondary;
}
};
ListenableFuture<Bar> f2 = transformAsync(f1, function, directExecutor());
f1.cancel(true);
assertTrue(f2.isCancelled());
/*
* We might like to propagate interruption, too, but it's not clear that it matters. For now, we
* test for the behavior that we have today.
*/
assertFalse(((AbstractFuture<?>) f2).wasInterrupted());
}
代码示例来源:origin: com.google.guava/guava-tests
private static void assertCancelled(AbstractFuture<Integer> future, boolean expectWasInterrupted)
throws InterruptedException, TimeoutException, ExecutionException {
assertDone(future);
assertThat(future.isCancelled()).isTrue();
assertThat(future.wasInterrupted()).isEqualTo(expectWasInterrupted);
try {
getDone(future);
fail();
} catch (CancellationException expected) {
}
try {
getDoneFromTimeoutOverload(future);
fail();
} catch (CancellationException expected) {
}
}
代码示例来源:origin: com.google.guava/guava-tests
assertTrue(setFuture.wasInterrupted()); // we only call cancel(true)
内容来源于网络,如有侵权,请联系作者删除!