Package javax.transaction

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


    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

          }
          //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

    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

  }

  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

  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

  }

  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

  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

          }
          //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

      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

TOP

Related Classes of javax.transaction.Synchronization

Copyright © 2018 www.massapicom. 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.