Package com.tailf.dp.annotations
Class TransCallbackProxy
Object
com.tailf.dp.annotations.TransCallbackProxy
- All Implemented Interfaces:
DpTransCallback
Callback proxy for Trans Callbacks. Implements the
DpTransCallback
interface and delegates calls to the registered callback POJO with annotated
methods- Since:
- 3.2.0
-
Field Summary
Fields inherited from interface com.tailf.dp.DpTransCallback
M_ABORT, M_ALL, M_COMMIT, M_FINISH, M_INIT, M_PREPARE, M_TRANS_LOCK, M_TRANS_UNLOCK, M_WRITE_START
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
This callback is responsible for undoing whatever was done in the prepare() phase.void
addActionCapability
(TransCBType transCBType) Add action capability from annotated callType used to register capabilities on the servervoid
addActionMethod
(String name, Method method) Add callback action method to proxyvoid
This callback is responsible for undoing whatever was done in the prepare() phase.void
This callback is responsible for releasing resources allocated in the init() phase.Retrieve the callback POJOstatic TransCallbackProxy[]
Get array of proxy objects from registered POJO callback.void
The callback must indicate which WORKER_SOCKET should be used for future communications in this transaction.int
mask()
Mask of flags for each method that is supported by this callback:DpTransCallback.M_INIT
DpTransCallback.M_TRANS_LOCK
DpTransCallback.M_TRANS_UNLOCK
DpTransCallback.M_WRITE_START
DpTransCallback.M_PREPARE
DpTransCallback.M_ABORT
DpTransCallback.M_COMMIT
DpTransCallback.M_FINISH
void
If we have multiple sources of data it is highly recommended that the callback is implemented.void
This callback is invoked when the validation phase of the transaction starts.void
transUnlock
(DpTrans trans) This callback is called when the validation of the transaction failed, or the validation is triggered explicitly (i.e.void
writeStart
(DpTrans trans) This callback is invoked when the validation succeeded and the write phase of the transaction starts.
-
Constructor Details
-
TransCallbackProxy
Constructor for Callback proxys. Used internally.- Parameters:
backupObject
- registered callback POJO
-
-
Method Details
-
getBackupObject
Retrieve the callback POJO- Returns:
- Object registered callback object
-
addActionMethod
Add callback action method to proxy- Parameters:
name
- canonical action namemethod
- registered callback method
-
addActionCapability
Add action capability from annotated callType used to register capabilities on the server- Parameters:
transCBType
- action type
-
abort
Description copied from interface:DpTransCallback
This callback is responsible for undoing whatever was done in the prepare() phase.- Specified by:
abort
in interfaceDpTransCallback
- Parameters:
trans
- Transaction- Throws:
DpCallbackException
- Callback method failed.
-
commit
Description copied from interface:DpTransCallback
This callback is responsible for undoing whatever was done in the prepare() phase.- Specified by:
commit
in interfaceDpTransCallback
- Parameters:
trans
- Transaction- Throws:
DpCallbackException
- Callback method failed.
-
finish
Description copied from interface:DpTransCallback
This callback is responsible for releasing resources allocated in the init() phase.- Specified by:
finish
in interfaceDpTransCallback
- Parameters:
trans
- Transaction- Throws:
DpCallbackException
- Callback method failed.
-
init
Description copied from interface:DpTransCallback
The callback must indicate which WORKER_SOCKET should be used for future communications in this transaction. This is the mechanism which is used by Conf to distribute work among multiple worker threads in the database application.- Specified by:
init
in interfaceDpTransCallback
- Parameters:
trans
- Transaction- Throws:
DpCallbackException
- Callback method failed.
-
mask
public int mask()Description copied from interface:DpTransCallback
Mask of flags for each method that is supported by this callback:- Specified by:
mask
in interfaceDpTransCallback
-
prepare
Description copied from interface:DpTransCallback
If we have multiple sources of data it is highly recommended that the callback is implemented. The callback is called at the end of the transaction, when all read and write operations for the transaction have been performed and the transaction should prepare to commit.- Specified by:
prepare
in interfaceDpTransCallback
- Parameters:
trans
- Transaction- Throws:
DpCallbackException
- Callback method failed.
-
transLock
Description copied from interface:DpTransCallback
This callback is invoked when the validation phase of the transaction starts. If the underlying database supports real transactions, it is usually appropriate to start such a native transaction here.The transaction enters VALIDATE state, where the system will perform a series of read() operations.
The trans lock is set until either transUnlock() or finish() is called. the system ensures that a transLock is set on a single transaction only.
- Specified by:
transLock
in interfaceDpTransCallback
- Parameters:
trans
- Transaction- Throws:
DpCallbackException
- Callback method failed.
-
transUnlock
Description copied from interface:DpTransCallback
This callback is called when the validation of the transaction failed, or the validation is triggered explicitly (i.e. not part of a user can enter invalid data. Transactions that originate from NETCONF will never trigger this callback. If the underlying database supports real transactions and they are used, the transaction should be aborted here.The transaction re-enters READ state.
- Specified by:
transUnlock
in interfaceDpTransCallback
- Parameters:
trans
- Transaction- Throws:
DpCallbackException
- Callback method failed.
-
writeStart
Description copied from interface:DpTransCallback
This callback is invoked when the validation succeeded and the write phase of the transaction starts. If the underlying database supports real transactions, it is usually appropriate to start such a native transaction here.The transaction enters the WRITE state. No more read() operations will be performed by the system.
- Specified by:
writeStart
in interfaceDpTransCallback
- Parameters:
trans
- Transaction- Throws:
DpCallbackException
- Callback method failed.
-
getTransCallbackProxys
Get array of proxy objects from registered POJO callback. Used internally at callback registration- Parameters:
obj
- registered Callback POJO- Returns:
- array of TransCallbackProxy
- Throws:
DpCallbackException
-