private static class SynchronousExecutors.Task<T> extends Object implements java.util.concurrent.Callable<T>, java.util.concurrent.Future<T>, Comparable<SynchronousExecutors.Task>
Modifier and Type | Field and Description |
---|---|
private int |
attempt |
(package private) boolean |
cancelled |
private boolean |
comparable |
(package private) boolean |
complete |
private static long[] |
delays
Default delay backoff times.
|
(package private) Exception |
exception |
private java.util.concurrent.locks.Lock |
executorLock |
(package private) Thread |
executorThread |
private SynchronousExecutors.QueueWrapper |
queue |
(package private) T |
result |
private java.util.concurrent.locks.Condition |
resultAwait |
private long |
retryTime |
private java.util.concurrent.Callable<T> |
task |
private java.util.concurrent.locks.Condition |
waiting |
Constructor and Description |
---|
Task(java.util.concurrent.Callable<T> c,
SynchronousExecutors.QueueWrapper wrapper,
java.util.concurrent.locks.Lock executorLock,
java.util.concurrent.locks.Condition distributorWaiting) |
Modifier and Type | Method and Description |
---|---|
T |
call() |
boolean |
cancel(boolean mayInterruptIfRunning) |
int |
compareTo(SynchronousExecutors.Task o) |
(package private) long |
delay()
Return the next time at which we should make another attempt.
|
T |
get() |
T |
get(long timeout,
java.util.concurrent.TimeUnit unit) |
boolean |
isCancelled() |
boolean |
isDone() |
private static final long[] delays
retryTime
volatile boolean complete
volatile boolean cancelled
volatile T result
volatile Exception exception
volatile Thread executorThread
private final java.util.concurrent.Callable<T> task
private final SynchronousExecutors.QueueWrapper queue
private final java.util.concurrent.locks.Lock executorLock
private final java.util.concurrent.locks.Condition waiting
private final java.util.concurrent.locks.Condition resultAwait
private final boolean comparable
private int attempt
private volatile long retryTime
Task(java.util.concurrent.Callable<T> c, SynchronousExecutors.QueueWrapper wrapper, java.util.concurrent.locks.Lock executorLock, java.util.concurrent.locks.Condition distributorWaiting)
long delay()
The implementation is free to do as it pleases with the policy here. The default implementation is to delay using intervals of 1 second, 5 seconds, 10 seconds, and 1 minute between attempts, and then retrying every five minutes forever.
The default implementation assumes it is being called from
the default run
method and that the current thread
holds the lock on this object. If the caller does
not own the lock the result is undefined and could result in an
exception.
public T call() throws Exception
call
in interface java.util.concurrent.Callable<T>
Exception
public boolean cancel(boolean mayInterruptIfRunning)
cancel
in interface java.util.concurrent.Future<T>
public boolean isCancelled()
isCancelled
in interface java.util.concurrent.Future<T>
public boolean isDone()
isDone
in interface java.util.concurrent.Future<T>
public T get() throws InterruptedException, java.util.concurrent.ExecutionException
get
in interface java.util.concurrent.Future<T>
InterruptedException
java.util.concurrent.ExecutionException
public T get(long timeout, java.util.concurrent.TimeUnit unit) throws InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
get
in interface java.util.concurrent.Future<T>
InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
public int compareTo(SynchronousExecutors.Task o)
compareTo
in interface Comparable<SynchronousExecutors.Task>
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.