Class 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 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 interface javax.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 interface javax.transaction.Synchronization
      • flush

        public void flush()
        Force sending websocket messages now