Example #1
0
 public ResourceHolder getResource() {
   TransactionState txState = transactionManager.getTransactionState();
   ResourceHolder resource = txState.getNeoStoreTransaction();
   if (resource == null) {
     txState.setNeoStoreTransaction(resource = createResource(getCurrentTransaction()));
   }
   return resource;
 }
Example #2
0
  private ResourceHolder createResource(Transaction tx) {
    try {
      XaConnection xaConnection = persistenceSource.getXaDataSource().getXaConnection();
      NeoStoreTransaction resource = persistenceSource.createTransaction(xaConnection);
      ResourceHolder result = new ResourceHolder(tx, xaConnection, resource);

      TransactionState state = transactionManager.getTransactionState();
      tx.registerSynchronization(new ResourceCleanupHook(tx, state, result));
      return result;
    } catch (RollbackException | SystemException e) {
      throw new ResourceAcquisitionFailedException(e);
    }
  }
Example #3
0
 TransactionState getTransactionState() {
   return transactionManager.getTransactionState();
 }