Examples of Synchronization


Examples of javax.transaction.Synchronization

      }
      else if (mode == ConnectionMode.WITH_TRANSACTION_MANAGER)
      {
         try
         {
            transactionManager.getTransaction().registerSynchronization(new Synchronization()
            {

               public void beforeCompletion()
               {
               }
View Full Code Here

Examples of javax.transaction.Synchronization

         // Since between 2 TM implementations the afterCompletion can be called in the same
         // order as the synchronization order or in the reverse order, so we add a second synchronization
         // such that the afterCompletion method will be called in the second call
         try
         {
            tm.getTransaction().registerSynchronization(new Synchronization()
            {

               public void beforeCompletion()
               {
               }
View Full Code Here

Examples of javax.transaction.Synchronization

   * avoiding object loading during a flush. Not needed during transactions.
   */
  public void onFlush(FlushEvent event) {
    if ( used ) {
      Session session = event.getSession();
      Synchronization synchronization = flushSynch.get( session );
      if ( synchronization != null ) {
        //first cleanup
        flushSynch.remove( session );
        log.debug( "flush event causing index update out of transaction" );
        synchronization.beforeCompletion();
        synchronization.afterCompletion( Status.STATUS_COMMITTED );
      }
    }
  }
View Full Code Here

Examples of javax.transaction.Synchronization

    if ( !open ) {
      throw new IllegalStateException( "EntityManager is closed" );
    }
    if ( !discardOnClose && isTransactionInProgress() ) {
      //delay the closing till the end of the enlisted transaction
            getSession().getTransaction().registerSynchronization(new Synchronization() {
                public void beforeCompletion() {
                    // nothing to do
                }

        public void afterCompletion( int i ) {
View Full Code Here

Examples of javax.transaction.Synchronization

          }
          //flush before completion and
          //register clear on rollback
          log.trace( "Adding flush() and close() synchronization" );
          joinableCMTTransaction.registerSynchronization(
              new Synchronization() {
                public void beforeCompletion() {
                  boolean flush = false;
                  TransactionFactory.Context ctx = null;
                  try {
                    ctx = (TransactionFactory.Context) session;
View Full Code Here

Examples of javax.transaction.Synchronization

    if ( !open ) throw new IllegalStateException( "EntityManager is closed" );
    if ( !discardOnClose && isTransactionInProgress() ) {
      //delay the closing till the end of the enlisted transaction
      getSession().getTransaction().registerSynchronization(
          new Synchronization() {
            public void beforeCompletion() {
              //nothing to do
            }

            public void afterCompletion(int i) {
View Full Code Here

Examples of javax.transaction.Synchronization

  }

  private void notifyLocalSynchsBeforeTransactionCompletion() {
    if (synchronizations!=null) {
      for ( int i=0; i<synchronizations.size(); i++ ) {
        Synchronization sync = (Synchronization) synchronizations.get(i);
        try {
          sync.beforeCompletion();
        }
        catch (Throwable t) {
          log.error("exception calling user Synchronization", t);
        }
      }
View Full Code Here

Examples of javax.transaction.Synchronization

  private void notifyLocalSynchsAfterTransactionCompletion(int status) {
    begun = false;
    if (synchronizations!=null) {
      for ( int i=0; i<synchronizations.size(); i++ ) {
        Synchronization sync = (Synchronization) synchronizations.get(i);
        try {
          sync.afterCompletion(status);
        }
        catch (Throwable t) {
          log.error("exception calling user Synchronization", t);
        }
      }
View Full Code Here

Examples of javax.transaction.Synchronization

  }

  private void notifyLocalSynchsBeforeTransactionCompletion() {
    if (synchronizations!=null) {
      for ( int i=0; i<synchronizations.size(); i++ ) {
        Synchronization sync = (Synchronization) synchronizations.get(i);
        try {
          sync.beforeCompletion();
        }
        catch (Throwable t) {
          log.error("exception calling user Synchronization", t);
        }
      }
View Full Code Here

Examples of javax.transaction.Synchronization

  private void notifyLocalSynchsAfterTransactionCompletion(int status) {
    begun = false;
    if (synchronizations!=null) {
      for ( int i=0; i<synchronizations.size(); i++ ) {
        Synchronization sync = (Synchronization) synchronizations.get(i);
        try {
          sync.afterCompletion(status);
        }
        catch (Throwable t) {
          log.error("exception calling user Synchronization", t);
        }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.