Search in sources :

Example 86 with Transaction

use of javax.transaction.Transaction in project neo4j-mobile-android by neo4j-contrib.

the class LockReleaser method hasRelationshipModifications.

boolean hasRelationshipModifications(NodeImpl node) {
    Transaction tx = getTransaction();
    if (tx == null) {
        return false;
    }
    PrimitiveElement primitiveElement = cowMap.get(tx);
    if (primitiveElement != null) {
        ArrayMap<Long, CowNodeElement> cowElements = primitiveElement.nodes;
        CowNodeElement element = cowElements.get(node.getId());
        if (element != null && (element.relationshipAddMap != null || element.relationshipRemoveMap != null)) {
            return true;
        }
    }
    return false;
}
Also used : Transaction(javax.transaction.Transaction)

Example 87 with Transaction

use of javax.transaction.Transaction in project neo4j-mobile-android by neo4j-contrib.

the class LockReleaser method commitCows.

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

Example 88 with Transaction

use of javax.transaction.Transaction in project neo4j-mobile-android by neo4j-contrib.

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)

Example 89 with Transaction

use of javax.transaction.Transaction in project neo4j-mobile-android by neo4j-contrib.

the class LockReleaser method dumpLocks.

// non thread safe but let exception be thrown instead of risking deadlock
public void dumpLocks() {
    System.out.print("Locks held: ");
    java.util.Iterator<?> itr = lockMap.keySet().iterator();
    if (!itr.hasNext()) {
        System.out.println("NONE");
    } else {
        System.out.println();
    }
    while (itr.hasNext()) {
        Transaction transaction = (Transaction) itr.next();
        System.out.println("" + transaction + "->" + lockMap.get(transaction).size());
    }
}
Also used : Transaction(javax.transaction.Transaction)

Example 90 with Transaction

use of javax.transaction.Transaction in project neo4j-mobile-android by neo4j-contrib.

the class LockReleaser method commit.

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

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