Search in sources :

Example 6 with Transaction

use of javax.transaction.Transaction in project hibernate-orm by hibernate.

the class ClusteredTimestampsRegionImpl method evictAll.

@Override
public void evictAll() throws CacheException {
    // TODO Is this a valid operation on a timestamps cache?
    final Transaction tx = suspend();
    try {
        // Invalidate the local region and then go remote
        invalidateRegion();
        Caches.broadcastEvictAll(cache);
    } finally {
        resume(tx);
    }
}
Also used : Transaction(javax.transaction.Transaction)

Example 7 with Transaction

use of javax.transaction.Transaction in project graphdb by neo4j-attic.

the class MasterImpl method suspendOtherAndResumeThis.

Transaction suspendOtherAndResumeThis(SlaveContext txId) {
    try {
        TransactionManager txManager = graphDbConfig.getTxModule().getTxManager();
        Transaction otherTx = txManager.getTransaction();
        Transaction transaction = getTx(txId);
        if (otherTx != null && otherTx == transaction) {
            return null;
        } else {
            if (otherTx != null) {
                txManager.suspend();
            }
            if (transaction == null) {
                beginTx(txId);
            } else {
                txManager.resume(transaction);
            }
            return otherTx;
        }
    } catch (Exception e) {
        e.printStackTrace();
        throw new RuntimeException(e);
    }
}
Also used : Transaction(javax.transaction.Transaction) TransactionManager(javax.transaction.TransactionManager) DeadlockDetectedException(org.neo4j.kernel.DeadlockDetectedException) IllegalResourceException(org.neo4j.kernel.impl.transaction.IllegalResourceException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) NotSupportedException(javax.transaction.NotSupportedException) SystemException(javax.transaction.SystemException)

Example 8 with Transaction

use of javax.transaction.Transaction in project graphdb by neo4j-attic.

the class MasterImpl method beginTx.

private Transaction beginTx(SlaveContext txId) {
    try {
        TransactionManager txManager = graphDbConfig.getTxModule().getTxManager();
        txManager.begin();
        Transaction tx = txManager.getTransaction();
        transactions.put(txId, tx);
        return tx;
    } catch (NotSupportedException e) {
        throw new RuntimeException(e);
    } catch (SystemException e) {
        throw new RuntimeException(e);
    }
}
Also used : Transaction(javax.transaction.Transaction) SystemException(javax.transaction.SystemException) TransactionManager(javax.transaction.TransactionManager) NotSupportedException(javax.transaction.NotSupportedException)

Example 9 with Transaction

use of javax.transaction.Transaction in project graphdb by neo4j-attic.

the class LockReleaser method commit.

public void commit() {
    Transaction tx = getTransaction();
    // propertyIndex
    propertyIndexManager.commit(tx);
    releaseCows(tx, Status.STATUS_COMMITTED);
    releaseLocks(tx);
}
Also used : Transaction(javax.transaction.Transaction)

Example 10 with Transaction

use of javax.transaction.Transaction in project graphdb by neo4j-attic.

the class LockReleaser method getAndSetupPrimitiveElement.

private PrimitiveElement getAndSetupPrimitiveElement() {
    Transaction tx = getTransaction();
    if (tx == null) {
        throw new NotInTransactionException();
    }
    PrimitiveElement primitiveElement = cowMap.get(tx);
    if (primitiveElement == null) {
        primitiveElement = new PrimitiveElement();
        cowMap.put(tx, primitiveElement);
    }
    return primitiveElement;
}
Also used : Transaction(javax.transaction.Transaction) NotInTransactionException(org.neo4j.graphdb.NotInTransactionException)

Aggregations

Transaction (javax.transaction.Transaction)160 SystemException (javax.transaction.SystemException)55 Test (org.junit.Test)42 RollbackException (javax.transaction.RollbackException)26 TransactionManager (javax.transaction.TransactionManager)24 UserTransaction (javax.transaction.UserTransaction)19 NotInTransactionException (org.neo4j.graphdb.NotInTransactionException)14 NotSupportedException (javax.transaction.NotSupportedException)13 Synchronization (javax.transaction.Synchronization)10 XAResource (javax.transaction.xa.XAResource)10 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)10 HazelcastXAResource (com.hazelcast.transaction.HazelcastXAResource)8 InvalidTransactionException (javax.transaction.InvalidTransactionException)7 TransactionContext (com.hazelcast.transaction.TransactionContext)6 RemoteException (java.rmi.RemoteException)6 ResourceException (javax.resource.ResourceException)6 ManagedConnection (javax.resource.spi.ManagedConnection)6 SQLException (java.sql.SQLException)5 HeuristicMixedException (javax.transaction.HeuristicMixedException)5 HeuristicRollbackException (javax.transaction.HeuristicRollbackException)5