public class Task extends Object implements Serializable
| 构造器和说明 |
|---|
Task() |
Task(ByteBuffer data,
Closure done)
Creates a task with data/done.
|
Task(ByteBuffer data,
Closure done,
long expectedTerm)
Creates a task with data/done/expectedTerm.
|
| 限定符和类型 | 方法和说明 |
|---|---|
ByteBuffer |
getData() |
Closure |
getDone() |
long |
getExpectedTerm() |
Closure |
join()
Waiting for the task to complete, to note that throughput may be reduced,
which is generally not recommended.
|
Closure |
join(long timeoutMillis)
Waiting for the task to complete with a timeout millis, to note that throughput
may be reduced, which is generally not recommended.
|
static List<Closure> |
joinAll(List<Task> tasks)
Waiting for all tasks to complete.
|
static List<Closure> |
joinAll(List<Task> tasks,
long timeoutMillis)
Waiting for all tasks to complete with a timeout millis.
|
void |
setData(ByteBuffer data) |
void |
setDone(Closure done) |
void |
setExpectedTerm(long expectedTerm) |
public Task()
public Task(ByteBuffer data, Closure done)
public Task(ByteBuffer data, Closure done, long expectedTerm)
public ByteBuffer getData()
public void setData(ByteBuffer data)
public Closure getDone()
public void setDone(Closure done)
public long getExpectedTerm()
public void setExpectedTerm(long expectedTerm)
public Closure join() throws InterruptedException
InterruptedException - if the current thread is interrupted while waitingpublic Closure join(long timeoutMillis) throws InterruptedException, TimeoutException
timeoutMillis - the maximum millis to waitInterruptedException - if the current thread is interrupted while waitingTimeoutException - if timeoutpublic static List<Closure> joinAll(List<Task> tasks) throws InterruptedException
tasks - task listInterruptedException - if the current thread is interrupted while waitingpublic static List<Closure> joinAll(List<Task> tasks, long timeoutMillis) throws InterruptedException, TimeoutException
tasks - task listtimeoutMillis - the maximum millis to waitInterruptedException - if the current thread is interrupted while waitingTimeoutException - if timeoutCopyright © 2021. All rights reserved.