V - return type of the asynchronous callD - type of the IO handlepublic abstract class AbstractAsyncIOCallable<V,D extends Closeable> extends Object implements StoppableCallbackCallable<V>
| Constructor and Description |
|---|
AbstractAsyncIOCallable() |
| Modifier and Type | Method and Description |
|---|---|
V |
call()
This method implements the strategy for the actual IO operation:
1) Open the IO handle
2) Perform IO operation
3) Close IO handle
|
void |
done(boolean canceled)
Optional callback that subclasses can implement.
|
protected D |
getIoHandle()
Returns the IO handle.
|
IOException |
getStopException()
Returns Exception that might happen on stop.
|
boolean |
isStopped()
Check if the IO operation is stopped
|
protected abstract D |
openIOHandle()
Open the IO Handle (e.g.
|
protected abstract V |
performOperation()
Implements the actual IO operation on the opened IO handle.
|
void |
stop()
Stops the I/O operation by closing the I/O handle.
|
public V call() throws Exception
protected abstract D openIOHandle() throws Exception
Exceptionprotected abstract V performOperation() throws Exception
Exceptionpublic void stop()
stop in interface AsyncStoppableprotected D getIoHandle()
public void done(boolean canceled)
done in interface AsyncDoneCallbackcanceled - true if the callback is done, but was canceledpublic boolean isStopped()
isStopped in interface AsyncStoppablepublic IOException getStopException()
getStopException in interface AsyncStoppableCopyright © 2014–2017 The Apache Software Foundation. All rights reserved.