Examples of JtaPlatform


Examples of org.hibernate.service.jta.platform.spi.JtaPlatform

    // IMPL NOTE : At this point the local callback is the "maybe" one.  The only time that needs to change is if
    // we are able to successfully register the transaction synchronization in which case the local callback would  become
    // non driving.  To that end, the following checks are simply opt outs where we are unable to register the
    // synchronization

    JtaPlatform jtaPlatform = getTransactionEnvironment().getJtaPlatform();
    if ( jtaPlatform == null ) {
      // if no jta platform was registered we wont be able to register a jta synchronization
      return;
    }

    // Can we resister a synchronization
    if ( !jtaPlatform.canRegisterSynchronization() ) {
      LOG.trace( "registered JTA platform says we cannot currently resister synchronization; skipping" );
      return;
    }

    // Should we resister a synchronization
    if ( ! transactionFactory().isJoinableJtaTransaction( this, currentHibernateTransaction ) ) {
      LOG.trace( "TransactionFactory reported no JTA transaction to join; skipping Synchronization registration" );
      return;
    }

    jtaPlatform.registerSynchronization( new RegisteredSynchronization( getSynchronizationCallbackCoordinator() ) );
    synchronizationRegistered = true;
    LOG.debug( "successfully registered Synchronization" );
  }
View Full Code Here

Examples of org.hibernate.service.jta.platform.spi.JtaPlatform

    // IMPL NOTE : At this point the local callback is the "maybe" one.  The only time that needs to change is if
    // we are able to successfully register the transaction synchronization in which case the local callback would  become
    // non driving.  To that end, the following checks are simply opt outs where we are unable to register the
    // synchronization

    JtaPlatform jtaPlatform = getTransactionEnvironment().getJtaPlatform();
    if ( jtaPlatform == null ) {
      // if no jta platform was registered we wont be able to register a jta synchronization
      return;
    }

    // Can we resister a synchronization
    if ( ! jtaPlatform.canRegisterSynchronization() ) {
                        if (LOG.isTraceEnabled()) {
         LOG.trace"registered JTA platform says we cannot currently resister synchronization; skipping" );
                        }
      return;
    }

    // Should we resister a synchronization
    if ( ! transactionFactory().isJoinableJtaTransaction( this, currentHibernateTransaction ) ) {
                        if (LOG.isTraceEnabled()) {
         LOG.trace( "TransactionFactory reported no JTA transaction to join; skipping Synchronization registration" );
                        }
      return;
    }

    jtaPlatform.registerSynchronization( new RegisteredSynchronization( getSynchronizationCallbackCoordinator() ) );
    synchronizationRegistered = true;
                if (LOG.isDebugEnabled()) {
       LOG.debug( "successfully registered Synchronization" );
                }
  }
View Full Code Here

Examples of org.hibernate.service.jta.platform.spi.JtaPlatform

    this.factory = factory;
  }

  @Override
  public Session currentSession() throws HibernateException {
    final JtaPlatform jtaPlatform = factory.getServiceRegistry().getService( JtaPlatform.class );
    final TransactionManager transactionManager = jtaPlatform.retrieveTransactionManager();
    if ( transactionManager == null ) {
      throw new HibernateException( "No TransactionManagerLookup specified" );
    }

    Transaction txn;
    try {
      txn = transactionManager.getTransaction();
      if ( txn == null ) {
        throw new HibernateException( "Unable to locate current JTA transaction" );
      }
      if ( !JtaStatusHelper.isActive( txn.getStatus() ) ) {
        // We could register the session against the transaction even though it is
        // not started, but we'd have no guarantee of ever getting the map
        // entries cleaned up (aside from spawning threads).
        throw new HibernateException( "Current transaction is not in progress" );
      }
    }
    catch ( HibernateException e ) {
      throw e;
    }
    catch ( Throwable t ) {
      throw new HibernateException( "Problem locating/validating JTA transaction", t );
    }

    final Object txnIdentifier = jtaPlatform.getTransactionIdentifier( txn );

    Session currentSession = ( Session ) currentSessionMap.get( txnIdentifier );

    if ( currentSession == null ) {
      currentSession = buildOrObtainSession();
View Full Code Here

Examples of org.hibernate.service.jta.platform.spi.JtaPlatform

    // IMPL NOTE : At this point the local callback is the "maybe" one.  The only time that needs to change is if
    // we are able to successfully register the transaction synchronization in which case the local callback would  become
    // non driving.  To that end, the following checks are simply opt outs where we are unable to register the
    // synchronization

    JtaPlatform jtaPlatform = getTransactionEnvironment().getJtaPlatform();
    if ( jtaPlatform == null ) {
      // if no jta platform was registered we wont be able to register a jta synchronization
      return;
    }

    // Can we resister a synchronization
    if ( !jtaPlatform.canRegisterSynchronization() ) {
      LOG.trace( "registered JTA platform says we cannot currently resister synchronization; skipping" );
      return;
    }

    // Should we resister a synchronization
    if ( ! transactionFactory().isJoinableJtaTransaction( this, currentHibernateTransaction ) ) {
      LOG.trace( "TransactionFactory reported no JTA transaction to join; skipping Synchronization registration" );
      return;
    }

    jtaPlatform.registerSynchronization( new RegisteredSynchronization( getSynchronizationCallbackCoordinator() ) );
    synchronizationRegistered = true;
    LOG.debug( "successfully registered Synchronization" );
  }
View Full Code Here

Examples of org.hibernate.service.jta.platform.spi.JtaPlatform

  private boolean isDriver;
  private boolean isInitiator;

  public JTATransactionManagerTransaction(TransactionCoordinator coordinator) {
    super( coordinator );
    final JtaPlatform jtaPlatform = coordinator
          .getTransactionContext()
          .getTransactionEnvironment()
          .getJtaPlatform();
    this.transactionManager = jtaPlatform.retrieveTransactionManager();
  }
View Full Code Here

Examples of org.hibernate.service.jta.platform.spi.JtaPlatform

  @Override
  public boolean isJoinableJtaTransaction(TransactionCoordinator transactionCoordinator,
      TransactionImplementor transaction) {
    try {
      final JtaPlatform jtaPlatform = transactionCoordinator
          .getTransactionContext()
          .getTransactionEnvironment()
          .getJtaPlatform();
      if ( jtaPlatform == null ) {
        throw new TransactionException( "Unable to check transaction status" );
      }
      if ( jtaPlatform.retrieveTransactionManager() != null ) {
        return JtaStatusHelper.isActive( jtaPlatform.retrieveTransactionManager().getStatus() );
      }
      else {
        final UserTransaction ut = jtaPlatform.retrieveUserTransaction();
        return ut != null && JtaStatusHelper.isActive( ut );
      }
    }
    catch ( SystemException se ) {
      throw new TransactionException( "Unable to check transaction status", se );
View Full Code Here

Examples of org.hibernate.service.jta.platform.spi.JtaPlatform

    // IMPL NOTE : At this point the local callback is the "maybe" one.  The only time that needs to change is if
    // we are able to successfully register the transaction synchronization in which case the local callback would  become
    // non driving.  To that end, the following checks are simply opt outs where we are unable to register the
    // synchronization

    JtaPlatform jtaPlatform = getTransactionEnvironment().getJtaPlatform();
    if ( jtaPlatform == null ) {
      // if no jta platform was registered we wont be able to register a jta synchronization
      return;
    }

    // Can we resister a synchronization
    if ( !jtaPlatform.canRegisterSynchronization() ) {
      LOG.trace( "registered JTA platform says we cannot currently resister synchronization; skipping" );
      return;
    }

    // Should we resister a synchronization
    if ( ! transactionFactory().isJoinableJtaTransaction( this, currentHibernateTransaction ) ) {
      LOG.trace( "TransactionFactory reported no JTA transaction to join; skipping Synchronization registration" );
      return;
    }

    jtaPlatform.registerSynchronization( new RegisteredSynchronization( getSynchronizationCallbackCoordinator() ) );
    synchronizationRegistered = true;
    LOG.debug( "successfully registered Synchronization" );
  }
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.