public class TransCallbackProxy extends Object implements DpTransCallback
DpTransCallback
interface and delegates calls to the registered callback POJO with annotated
methodsM_ABORT, M_ALL, M_COMMIT, M_FINISH, M_INIT, M_PREPARE, M_TRANS_LOCK, M_TRANS_UNLOCK, M_WRITE_START
Constructor and Description |
---|
TransCallbackProxy(Object backupObject)
Constructor for Callback proxys.
|
Modifier and Type | Method and Description |
---|---|
void |
abort(DpTrans trans)
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 server
|
void |
addActionMethod(String name,
Method method)
Add callback action method to proxy
|
void |
commit(DpTrans trans)
This callback is responsible for
undoing whatever was done in the prepare() phase.
|
void |
finish(DpTrans trans)
This callback is responsible for
releasing resources allocated in the init() phase.
|
Object |
getBackupObject()
Retrieve the callback POJO
|
static TransCallbackProxy[] |
getTransCallbackProxys(Object obj)
Get array of proxy objects from registered POJO callback.
|
void |
init(DpTrans trans)
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 |
prepare(DpTrans trans)
If we have multiple sources of data it is highly recommended
that the callback is implemented.
|
void |
transLock(DpTrans trans)
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.
|
public TransCallbackProxy(Object backupObject)
backupObject
- registered callback POJOpublic Object getBackupObject()
public void addActionMethod(String name, Method method)
name
- canonical action namemethod
- registered callback methodpublic void addActionCapability(TransCBType transCBType)
transCBType
- action typepublic void abort(DpTrans trans) throws DpCallbackException
DpTransCallback
abort
in interface DpTransCallback
trans
- TransactionDpCallbackException
- Callback method failed.public void commit(DpTrans trans) throws DpCallbackException
DpTransCallback
commit
in interface DpTransCallback
trans
- TransactionDpCallbackException
- Callback method failed.public void finish(DpTrans trans) throws DpCallbackException
DpTransCallback
finish
in interface DpTransCallback
trans
- TransactionDpCallbackException
- Callback method failed.public void init(DpTrans trans) throws DpCallbackException
DpTransCallback
init
in interface DpTransCallback
trans
- TransactionDpCallbackException
- Callback method failed.public int mask()
DpTransCallback
mask
in interface DpTransCallback
public void prepare(DpTrans trans) throws DpCallbackException
DpTransCallback
prepare
in interface DpTransCallback
trans
- TransactionDpCallbackException
- Callback method failed.public void transLock(DpTrans trans) throws DpCallbackException
DpTransCallback
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.
transLock
in interface DpTransCallback
trans
- TransactionDpCallbackException
- Callback method failed.public void transUnlock(DpTrans trans) throws DpCallbackException
DpTransCallback
The transaction re-enters READ state.
transUnlock
in interface DpTransCallback
trans
- TransactionDpCallbackException
- Callback method failed.public void writeStart(DpTrans trans) throws DpCallbackException
DpTransCallback
The transaction enters the WRITE state. No more read() operations will be performed by the system.
writeStart
in interface DpTransCallback
trans
- TransactionDpCallbackException
- Callback method failed.public static TransCallbackProxy[] getTransCallbackProxys(Object obj) throws DpCallbackException
obj
- registered Callback POJODpCallbackException