Examples of TransactionContext


Examples of org.hibernate.engine.transaction.spi.TransactionContext

    closeIfRequired();
  }

  private void closeIfRequired() throws HibernateException {
    final TransactionContext transactionContext = transactionCoordinator().getTransactionContext();
    final boolean close = isDriver &&
        transactionContext.shouldAutoClose() &&
        ! transactionContext.isClosed();
    if ( close ) {
      transactionContext.managedClose();
    }
  }
View Full Code Here

Examples of org.hibernate.search.backend.TransactionContext

      }

      final Object toReturn = super.visitPrepareCommand(ctx, command);

      if (ctx.isTransactionValid()) {
         final TransactionContext transactionContext = makeTransactionalEventContext();
         for (int i=0; i<writeCommands.length; i++) {
            final WriteCommand writeCommand = writeCommands[i];
            if (writeCommand instanceof PutKeyValueCommand) {
               processPutKeyValueCommand((PutKeyValueCommand) writeCommand, ctx, stateBeforePrepare[i], transactionContext);
            }
View Full Code Here

Examples of org.infinispan.context.TransactionContext

   }

   @Override
   public Object visitPrepareCommand(InvocationContext ctx, PrepareCommand command) throws Throwable {
      Object retVal = invokeNextInterceptor(ctx, command);
      TransactionContext transactionContext = ctx.getTransactionContext();
      if (transactionContext.hasLocalModifications()) {
         PrepareCommand replicablePrepareCommand = command.copy(); // make sure we remove any "local" transactions
         replicablePrepareCommand.removeModifications(transactionContext.getLocalModifications());
         command = replicablePrepareCommand;
      }

      if (!skipReplicationOfTransactionMethod(ctx)) runPreparePhase(command, command.getGlobalTransaction(), ctx);
      return retVal;
View Full Code Here

Examples of org.jboss.arquillian.transaction.spi.context.TransactionContext

            if (transactionMode != TransactionMode.DISABLED) {
                transactionProvider = getTransactionProvider();

                // creates the transaction context
                TransactionContext transactionContext = transactionContextInstance.get();
                transactionContext.activate();

                lifecycleEvent.fire(new BeforeTransactionStarted());

                transactionProvider.beginTransaction(new TransactionalTestImpl(getTransactionManager(beforeTest)));
View Full Code Here

Examples of org.jboss.cache.transaction.TransactionContext

      assertNotNull("Tx should have been set up by now", cache.getInvocationContext().getTransaction());
      assertEquals("The same current transaction should be associated with this invocation ctx.", tm.getTransaction(), cache.getInvocationContext().getTransaction());
      assertNotNull("Gtx should have been set up by now", cache.getInvocationContext().getGlobalTransaction());

      Transaction tx = tm.getTransaction();
      TransactionContext transactionContext = tt.get(tt.get(tx));

      if (commit)
      {
         tm.commit();
      } else
      {
         tm.rollback();
      }

      assertNull("Tx should have been scrubbed", cache.getInvocationContext().getTransaction());
      assertNull("Gtx should have been scrubbed", cache.getInvocationContext().getGlobalTransaction());
      assertEquals("Method call should have been scrubbed", null, cache.getInvocationContext().getMethodCall());
      assertEquals("Cache command should have been scrubbed", null, cache.getInvocationContext().getCommand());

      // check that the transaction transactionContext hasn't leaked stuff.
      assert transactionContext.getModifications().isEmpty() : "Should have scrubbed modifications in transaction transactionContext";
      assert transactionContext.getLocks().isEmpty() : "Should have scrubbed modifications in transaction transactionContext";
      assert transactionContext.getOrderedSynchronizationHandler() == null : "Should have removed the ordered sync handler";
   }
View Full Code Here

Examples of org.teiid.dqp.service.TransactionContext

    Command command = helpGetCommand("update bqt1.smalla set stringkey = 1 where stringkey = 2", EXAMPLE_BQT); //$NON-NLS-1$
    AtomicRequestMessage requestMsg = createNewAtomicRequestMessage(1, 1);
    requestMsg.setCommand(command);
   
    // To make the AtomicRequestMessage transactional, construct your own
    requestMsg.setTransactionContext( new TransactionContext(){
      @Override
      public Xid getXid() {
        return Mockito.mock(Xid.class);
      }} );
   
View Full Code Here

Examples of org.teiid.dqp.service.TransactionContext

    Command command = helpGetCommand("update bqt1.smalla set stringkey = 1 where stringkey = 2", EXAMPLE_BQT); //$NON-NLS-1$
    AtomicRequestMessage requestMsg = createNewAtomicRequestMessage(1, 1);
    requestMsg.setCommand(command);
   
    // To make the AtomicRequestMessage transactional, construct your own
    requestMsg.setTransactionContext( new TransactionContext(){
      @Override
      public Xid getXid() {
        return Mockito.mock(Xid.class);
      }} );
   
View Full Code Here

Examples of org.teiid.dqp.service.TransactionContext

        assertNotNull(t.getId());
    }
   
    @Test public void testGlobalPrepare() throws Exception {
      server.start(THREAD1, XID1, XAResource.TMNOFLAGS, 100,false);
        TransactionContext tc = server.getOrCreateTransactionContext(THREAD1);
        server.end(THREAD1, XID1, XAResource.TMSUCCESS, false);
       
      server.prepare(THREAD1, XID1, false);
     
      Mockito.verify(xaTerminator).prepare(tc.getXid());
     
      server.commit(THREAD1, XID1, true, false);
    }
View Full Code Here

Examples of org.teiid.dqp.service.TransactionContext

        Mockito.verify(txn).setRollbackOnly();
    }   
   
    @Test public void testGlobalOnePhaseCommit() throws Exception {
      server.start(THREAD1, XID1, XAResource.TMNOFLAGS, 100,false);
      TransactionContext tc = server.getOrCreateTransactionContext(THREAD1);
     
        server.end(THREAD1, XID1, XAResource.TMSUCCESS, false);
       
        server.prepare(THREAD1, XID1, false);

   
    server.commit(THREAD1, XID1, true, false);
    Mockito.verify(xaTerminator).commit(tc.getXid(), false);
   
View Full Code Here

Examples of org.teiid.dqp.service.TransactionContext

    Mockito.verify(xaTerminator).commit(tc.getXid(), false);
   
   
    @Test public void testGlobalOnePhaseCommit_force_prepare_through() throws Exception {
      server.start(THREAD1, XID1, XAResource.TMNOFLAGS, 100,false);
      TransactionContext tc = server.getOrCreateTransactionContext(THREAD1);
     
        server.end(THREAD1, XID1, XAResource.TMSUCCESS, false);
       
   
    server.commit(THREAD1, XID1, true, false);
   
    Mockito.verify(xaTerminator).prepare(tc.getXid());
    Mockito.verify(xaTerminator).commit(tc.getXid(), false);
   
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.