Class WebsocketTxSync
java.lang.Object
ch.colabproject.colab.api.controller.WebsocketTxSync
- All Implemented Interfaces:
jakarta.transaction.Synchronization
To synchronize websockets with JTA session
- Author:
- maxence
-
Constructor Summary
ConstructorsConstructorDescriptionNew Synchronizer to link to the current transaction. -
Method Summary
Modifier and TypeMethodDescriptionvoidafterCompletion(int status) At this point, the final state of the transaction in known.voidThis is called before just before the commit occurs.voidflush()Force sending websocket messages now
-
Constructor Details
-
WebsocketTxSync
New Synchronizer to link to the current transaction.- Parameters:
context- TranssactionManager which is in charge for the current transaction
-
-
Method Details
-
afterCompletion
public void afterCompletion(int status) At this point, the final state of the transaction in known.From this point, any committed changes will be available to other transactions, and any rolled back changes will be definitely loosed.
- Specified by:
afterCompletionin interfacejakarta.transaction.Synchronization- Parameters:
status- status of the current transaction, either STATUS_COMMITTED or STATUS_ROLLEDBACK
-
beforeCompletion
public void beforeCompletion()This is called before just before the commit occurs.A RuntimeException may be thrown if there is any problem with the underling Xapi repository. If so, the transaction will be rolled back
- Specified by:
beforeCompletionin interfacejakarta.transaction.Synchronization
-
flush
public void flush()Force sending websocket messages now
-