Class WebsocketTxSync
- java.lang.Object
-
- ch.colabproject.colab.api.controller.WebsocketTxSync
-
- All Implemented Interfaces:
javax.transaction.Synchronization
public class WebsocketTxSync extends Object implements javax.transaction.Synchronization
To synchronize websockets with JTA session- Author:
- maxence
-
-
Constructor Summary
Constructors Constructor Description WebsocketTxSync(EntityGatheringBagForPropagation context)
New Synchronizer to link to the current transaction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterCompletion(int status)
At this point, the final state of the transaction in known.void
beforeCompletion()
This is called before just before the commit occurs.void
flush()
Force sending websocket messages now
-
-
-
Constructor Detail
-
WebsocketTxSync
public WebsocketTxSync(EntityGatheringBagForPropagation context)
New Synchronizer to link to the current transaction.- Parameters:
context
- TranssactionManager which is in charge for the current transaction
-
-
Method Detail
-
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:
afterCompletion
in interfacejavax.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:
beforeCompletion
in interfacejavax.transaction.Synchronization
-
flush
public void flush()
Force sending websocket messages now
-
-