Package org.jtrim2.concurrent.query
Interface AsyncStateReporter<DataType>
- Type Parameters:
DataType- the type of the data which is being retrieved by theAsyncDataLinkreporting its state.
public interface AsyncStateReporter<DataType>
Defines the listener which will be notified periodically by the
AsyncDataLink created by the
AsyncLinks.createStateReporterLink
method.
Thread safety
Implementations of this interface do not need to be safe to be called by multiple threads concurrently. TheAsyncDataLink notifying the method
of this interface does not call the method concurrently.
Synchronization transparency
Implementations of thereportState
method must be as quick as possible and it must not wait for external events
or for other threads. Implementations of this interface in general are not
required to be synchronization transparent.-
Method Summary
Modifier and TypeMethodDescriptionvoidreportState(AsyncDataLink<DataType> dataLink, AsyncDataListener<? super DataType> dataListener, AsyncDataController controller) The method to be called periodically to be notified of the state of the progress of the data retrieving process.
-
Method Details
-
reportState
void reportState(AsyncDataLink<DataType> dataLink, AsyncDataListener<? super DataType> dataListener, AsyncDataController controller) The method to be called periodically to be notified of the state of the progress of the data retrieving process.This method is invoked until the data retrieving is finished (either due to completion, cancellation or an error). Note however, that this method may be invoked after the data retrieving is finished but should be stopped to be called not much after the data retrieving is finished.
To actually query the state of progress of the data retrieving process, use the specified
AsyncDataController.- Parameters:
dataLink- theAsyncDataLinkwhich is providing the data whose state is being watched. This argument cannot benull.dataListener- theAsyncDataListenerto be notified of the retrieved data. This argument cannot benull.controller- theAsyncDataControllerwhich can be used to retrieve the state of the data retrieving process. This argument cannot benull.
-