Class WebsocketTxSync

java.lang.Object
ch.colabproject.colab.api.controller.WebsocketTxSync
All Implemented Interfaces:
jakarta.transaction.Synchronization

public class WebsocketTxSync extends Object implements jakarta.transaction.Synchronization
To synchronize websockets with JTA session
Author:
maxence
  • Constructor Details

    • 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 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:
      afterCompletion in interface jakarta.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 jakarta.transaction.Synchronization
    • flush

      public void flush()
      Force sending websocket messages now