Package com.arcadedb.database.async
Interface AsyncResultsetCallback
-
- All Known Implementing Classes:
AbstractAsyncResultsetCallback
public interface AsyncResultsetCallback
Callback interface for asynchronous commands. If the command returns an exception, theonError(Exception)
method is invoked. OtherwiseonStart(ResultSet)
is called at first. The user can fetch the Resultset in this method. After the return fromonStart(ResultSet)
, the result set is fetched and foreach result the methodonNext(Result)
is invoked by passing the current Result object. When the fetching of the result set is complete, theonComplete()
method is called.It's suggested to extend the @
AbstractAsyncResultsetCallback
abstract class and implementonStart(ResultSet)
to fetch the result set all in one call, otherwise implementonNext(com.arcadedb.query.sql.executor.Result)
method to be invoked foreach record in the result set. In case bothonStart(ResultSet)
andonNext(Result)
are implemented, whatever is remained left from fetching in the result set is invoked in multipleonNext(Result)
calls.- Author:
- Luca Garulli ([email protected])
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
onComplete()
Invoked when the fetching of the entire result set has been completed.void
onError(Exception exception)
Invoked in case of an error in the execution or fetching of the result set.boolean
onNext(Result result)
Invoked per single result in the result set.void
onStart(ResultSet resultset)
Invoked as soon as the command has been executed.
-
-
-
Method Detail
-
onStart
void onStart(ResultSet resultset)
Invoked as soon as the command has been executed.- Parameters:
resultset
- result set to fetch
-
onNext
boolean onNext(Result result)
Invoked per single result in the result set.- Returns:
- true to continue fetching otherwise false. If false is returned, the fetching stops and the
onComplete()
method is never invoked.
-
onComplete
void onComplete()
Invoked when the fetching of the entire result set has been completed.
-
onError
void onError(Exception exception)
Invoked in case of an error in the execution or fetching of the result set.- Parameters:
exception
- The exception caught
-
-