T
- The type of the object to be returned by the task.public interface TxTask<T>
TxQueue
.
The MD-SAL transaction task may start some background tasks associated
with VTNFuture
instances.
TxQueue
Modifier and Type | Method and Description |
---|---|
void |
addBackgroundTask(VTNFuture<?> future)
Associate the given future with this task.
|
T |
execute(TxContext ctx,
int attempts)
Modify the MD-SAL datastore using the given transaction.
|
List<VTNFuture<?>> |
getBackgroundTasks()
Return an immutable list of
VTNFuture instances associated with
background tasks started by the MD-SAL transaction task. |
default boolean |
isAsync()
Determine whether this instance is associated with an asynchronous
task or not.
|
default boolean |
needErrorLog(Throwable t)
Determine whether the transaction queue should log the given error
or not.
|
void |
onFailure(VTNManagerProvider provider,
Throwable t)
Invoked when the task has failed.
|
void |
onSuccess(VTNManagerProvider provider,
T result)
Invoked when the task has completed successfully.
|
T execute(TxContext ctx, int attempts) throws VTNException
Note that this method may be called more than once when a MD-SAL datastore transaction is aborted due to data conflict.
ctx
- A runtime context for transaction task.attempts
- The number of calls of this method.
0 is passed for the first call.VTNException
- An error occurred.default boolean needErrorLog(Throwable t)
By default, this method returns true
.
t
- A Throwable
that is going to be thrown.true
if an error should be logged.
false
if an error log is not required.default boolean isAsync()
By default, this method returns false
.
true
if this instance is associated with an
asynchronous task. false
otherwise.void onSuccess(VTNManagerProvider provider, T result)
Note that this method must be called prior to
FutureCallback
.
provider
- VTN Manager provider service.result
- An object returned by execute(TxContext, int)
.void onFailure(VTNManagerProvider provider, Throwable t)
Note that this method must be called prior to
FutureCallback
.
provider
- VTN Manager provider service.t
- A Throwable
thrown by the task.List<VTNFuture<?>> getBackgroundTasks()
VTNFuture
instances associated with
background tasks started by the MD-SAL transaction task.VTNFuture
instances.
An empty list is returned if no background task has started or
this task does not complete yet.
Note that this method must not return null
.Copyright © 2018 OpenDaylight. All rights reserved.