Examples of TransactionContext


Examples of co.cask.tephra.TransactionContext

    this.queueClientFactory = queueClientFactory;
  }

  @Override
  public TransactionContext createTransactionManager() {
    return new TransactionContext(txSystemClient, Iterables.unmodifiableIterable(txAware));
  }
View Full Code Here

Examples of com.alu.e3.common.transaction.TransactionContext

  public void testTransactionStateOverThreads() throws Exception {

    ExecutorService executor1 = Executors.newSingleThreadScheduledExecutor();

    // Create, then begin a transaction
    TransactionContext transactionState1 = executor1.submit( new Callable<TransactionContext>() {
      @Override
      public TransactionContext call() throws Exception {
        ITransactionManager txMnger = new TransactionManager();
        ITransaction tx = txMnger.getNewTransaction();
        tx.begin();
        return txMnger.getTransactionContext();
      }
    }).get();

    assertNotNull(transactionState1);
    assertNotNull(transactionState1.getTransactionId());
   
    // Later, a method in the same thread stack should be able to deal with the same transaction context
    TransactionContext transactionState2 = executor1.submit( new Callable<TransactionContext>() {
      @Override
      public TransactionContext call() throws Exception {
        ITransactionManager txMnger = new TransactionManager();
        return txMnger.getTransactionContext();
      }
    }).get();
   
    assertNotNull(transactionState2);
    assertNotNull(transactionState2.getTransactionId());
    assertEquals(transactionState1.getTransactionId(), transactionState2.getTransactionId());

    // The transaction in a thread must not be viewable from another thread
    ExecutorService executor2 = Executors.newSingleThreadScheduledExecutor();
    TransactionContext transactionState3 = executor2.submit( new Callable<TransactionContext>() {
      @Override
      public TransactionContext call() throws Exception {
        ITransactionManager txMnger = new TransactionManager();
        return txMnger.getTransactionContext();
      }
    }).get();
    assertNull (transactionState3);
   
    transactionState3 = executor2.submit( new Callable<TransactionContext>() {
      @Override
      public TransactionContext call() throws Exception {
        ITransactionManager txMnger = new TransactionManager();
        ITransaction tx = txMnger.getNewTransaction();
        tx.begin();
        return txMnger.getTransactionContext();
      }
    }).get();
   
    assertNotNull (transactionState3);
    assertTrue(transactionState1.getTransactionId() != transactionState3.getTransactionId());
  }
View Full Code Here

Examples of com.continuuity.tephra.TransactionContext

    }

    this.secondaryIndex = secondaryIndex;
    this.transactionAwareHTable = new TransactionAwareHTable(hTable);
    this.secondaryIndexTable = new TransactionAwareHTable(secondaryIndexHTable);
    this.transactionContext = new TransactionContext(transactionServiceClient, transactionAwareHTable,
                                                secondaryIndexTable);
  }
View Full Code Here

Examples of com.hazelcast.transaction.TransactionContext

        this.ttl = timeUnit == null ? ttl : timeUnit.toMillis(ttl);
    }


    public Object innerCall() throws Exception {
        final TransactionContext context = getEndpoint().getTransactionContext(txnId);
        final TransactionalMap map = context.getMap(name);
        switch (requestType) {
            case CONTAINS_KEY:
                return map.containsKey(key);
            case GET:
                return map.get(key);
View Full Code Here

Examples of com.sun.sgs.impl.util.TransactionContext

  TransactionContextFactory<TransactionContext> contextFactory =
      new TransactionContextFactory<TransactionContext>(txnProxy,
                                          "TestTransactionContextFactory")
            {
          protected TransactionContext createContext(Transaction txn) {
        return new TransactionContext(txn) {
      public boolean isPrepared() {
          if (isPrepared) {
        throw new RuntimeException(
            "isPrepared fails during commit");
          } else {
View Full Code Here

Examples of com.taobao.metamorphosis.client.transaction.TransactionContext

    }


    @Override
    public XAResource getXAResource() throws MetaClientException {
        TransactionContext xares = this.transactionContext.get();
        if (xares != null) {
            return xares;
        }
        else {
            this.beginTransaction();
            xares = this.transactionContext.get();
            // ��������ѡ����broker
            String selectedServer = this.selectTransactionBrokerURL();
            xares.setServerUrl(selectedServer);
            xares.setUniqueQualifier(this.uniqueQualifier);
            xares.setXareresourceURLs(this.urls);
            // ָ�����͵�url
            this.logLastSentInfo(selectedServer);
            return xares;
        }
    }
View Full Code Here

Examples of fi.evident.dalesbred.TransactionContext

    <T> T execute(int retries, @NotNull TransactionCallback<T> callback, @NotNull Dialect dialect) {
        int tries = 1;
        while (true) {
            try {
                try {
                    TransactionContext ctx = new DefaultTransactionContext(connection);
                    T value = callback.execute(ctx);
                    if (ctx.isRollbackOnly())
                        connection.rollback();
                    else
                        connection.commit();
                    return value;
View Full Code Here

Examples of org.activemq.TransactionContext

    public ActiveMQManagedConnection(Subject subject, ActiveMQConnection physicalConnection, ActiveMQConnectionRequestInfo info) throws ResourceException {
        try {
            this.subject = subject;
            this.info = info;
            this.physicalConnection = physicalConnection;
            this.transactionContext = new TransactionContext(physicalConnection);
           
            this.localAndXATransaction = new LocalAndXATransaction(transactionContext) {
                public void setInManagedTx(boolean inManagedTx) throws JMSException {
                    super.setInManagedTx(inManagedTx);                   
                    Iterator iterator = proxyConnections.iterator();
View Full Code Here

Examples of org.activiti.engine.impl.cfg.TransactionContext

    }
   
    if (processEngineConfig.isAsyncExecutorEnabled() == false) {
      JobExecutor jobExecutor = processEngineConfig.getJobExecutor();
      JobAddedNotification messageAddedNotification = new JobAddedNotification(jobExecutor);
      TransactionContext transactionContext = commandContext.getTransactionContext();
      transactionContext.addTransactionListener(TransactionState.COMMITTED, messageAddedNotification);
    }

    return null;
  }
View Full Code Here

Examples of org.apache.activemq.TransactionContext

    public ActiveMQManagedConnection(Subject subject, ActiveMQConnection physicalConnection, ActiveMQConnectionRequestInfo info) throws ResourceException {
        try {
            this.subject = subject;
            this.info = info;
            this.physicalConnection = physicalConnection;
            this.transactionContext = new TransactionContext(physicalConnection);

            this.localAndXATransaction = new LocalAndXATransaction(transactionContext) {
                public void setInManagedTx(boolean inManagedTx) throws JMSException {
                    super.setInManagedTx(inManagedTx);
                    for (ManagedConnectionProxy proxy:proxyConnections) {
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.