public interface TransactionListener
Interface to be implemented in order to handle the Transaction Lifecycle.
This interface is bound to transactions created by
Context.makeTransaction()
.
It may be retrieved by CommunicationLifeCycle.getListener()
.
Method Summary | |
---|---|
void |
onTransactionQuery(TransactionQueryEvent event)
Called when the server-answer to the Transaction.query() is available. |
void |
onTransactionSend(TransactionSendEvent event)
Called when the server-answer to the Transaction.send()
is available. |
Method Detail |
---|
void onTransactionSend(TransactionSendEvent event)
Transaction.send()
is available.
Depending on the server result (that cannot
never be equal to Event.RESULT_OK
) the
transaction status changes
to:
TransactionEvent.RESULT_FLYING
→
Transaction.STATUS_FLYING
TransactionEvent.RESULT_COMMITTED
→
Transaction.STATUS_COMMITTED
TransactionEvent.RESULT_ABORTED
→
Transaction.STATUS_ABORTED
TransactionEvent.RESULT_INVALID_TRANSACTION_ID
→
Transaction.STATUS_ABORTED
Event.RESULT_GENERIC_ERROR
→
Transaction.STATUS_ABORTED
If the current transaction status is
TransactionEvent.RESULT_FLYING
then the server can accept
calls to Transaction.query()
otherwise it is a good
practice to release
the
transaction associated
to the event parameter.
event
- the server-answer to the Transaction.send()
void onTransactionQuery(TransactionQueryEvent event)
Transaction.query()
is available.
Depending on the server result (that cannot
never be equal to Event.RESULT_OK
) the
transaction status changes
to:
TransactionEvent.RESULT_FLYING
→
Transaction.STATUS_FLYING
TransactionEvent.RESULT_COMMITTED
→
Transaction.STATUS_COMMITTED
TransactionEvent.RESULT_ABORTED
→
Transaction.STATUS_ABORTED
TransactionEvent.RESULT_INVALID_TRANSACTION_ID
→
Transaction.STATUS_ABORTED
Event.RESULT_GENERIC_ERROR
→
Transaction.STATUS_ABORTED
If the current transaction status is
TransactionEvent.RESULT_FLYING
then the server can accept
other calls to Transaction.query()
otherwise it is a
good practice to release
the
transaction associated
to the event parameter.
event
- the server-answer to the Transaction.query()