R
- the type of result returned by this taskpublic abstract class CancelableReaderTask<R> extends Object implements CancelableTask<R>
Reader
and passes cancelation requests on to it in a thread-safe manner.
The actual reading must be performed by subclasses implementing the template method(s).Constructor and Description |
---|
CancelableReaderTask() |
Modifier and Type | Method and Description |
---|---|
R |
call() |
void |
cancel() |
protected Reader |
createReader()
Creates the
Reader to be used by this task. |
protected R |
createReturnValue(Reader reader)
Creates the result to be returned by this task.
|
protected void |
didCancel()
Invoked after cancelation has happened to give subclasses a chance to perform clean-up tasks.
|
protected abstract void |
performRead(Reader reader)
Template method to perform this task's workload.
|
protected void |
willCancel()
Invoked before cancelation happens to give subclasses a chance to perform clean-up tasks.
|
protected Reader createReader()
Reader
to be used by this task.protected abstract void performRead(Reader reader) throws Exception
Reader
.reader
- the Reader used by this taskException
protected R createReturnValue(Reader reader) throws Exception
reader
- the Reader used by this tasknull
.Exception
public final void cancel()
cancel
in interface CancelableTask<R>
protected void willCancel()
protected void didCancel()
Copyright © 2024 levigo holding gmbh. All rights reserved.