Package com.sun.messaging.jmq.jmsserver.data

Examples of com.sun.messaging.jmq.jmsserver.data.LocalTransaction


          } else {

            // one phase commit
            // log all work here
            transactionType = BaseTransaction.LOCAL_TRANSACTION_TYPE;
            LocalTransaction localTxn = new LocalTransaction(id,
                TransactionState.COMMITTED, xid, txnWork);
            logTxn(localTxn);
          }
        }
            else {
View Full Code Here


              // work not logged yet, so this must be a local broker transaction
              // (there are no remote acknowledgements) 
              // The end client must have called prepare
              if(Globals.isNewTxnLogEnabled())
                {          
                  baseTransaction= new LocalTransaction();
                baseTransaction.setTransactionWork(txnWork);
                baseTransaction.setTransactionState(nextState);
                baseTransaction.getTransactionDetails().setTid(id);
                baseTransaction.getTransactionDetails().setXid(ts.getXid());
                baseTransaction.getTransactionDetails().setState(TransactionState.PREPARED);
View Full Code Here

  void readFromBytes(byte[] data) throws IOException, BrokerException {
    ByteArrayInputStream bais = new ByteArrayInputStream(data);
    DataInputStream dis = new DataInputStream(bais);

    localTransaction = new LocalTransaction();
    dis.skip(2);
    localTransaction.getTransactionDetails().readContent(dis);
    TransactionWork work = new TransactionWork();
    work.readWork(dis);
    localTransaction.setTransactionWork(work);
View Full Code Here

  void readFromBytes(byte[] data) throws IOException, BrokerException {
    ByteArrayInputStream bais = new ByteArrayInputStream(data);
    DataInputStream dis = new DataInputStream(bais);

    localTransaction = new LocalTransaction();
    dis.skip(2);
    localTransaction.getTransactionDetails().readContent(dis);
    TransactionWork work = new TransactionWork();
    work.readWork(dis);
    localTransaction.setTransactionWork(work);
View Full Code Here

  void readFromBytes(byte[] data) throws IOException, BrokerException {
    ByteArrayInputStream bais = new ByteArrayInputStream(data);
    DataInputStream dis = new DataInputStream(bais);

    localTransaction = new LocalTransaction();
    dis.skip(2);
    localTransaction.getTransactionDetails().readContent(dis);

    dis.close();
    bais.close();
View Full Code Here

      Globals.getLogger().log(Logger.DEBUG,
          getPrefix() + " replayTransactionEvent");
    }
    LocalTransactionEvent localTxnEvent = (LocalTransactionEvent) txnEvent;
    // replay to store on commit
    LocalTransaction localTxn = localTxnEvent.localTransaction;
    int state = localTxn.getState();
    TransactionUID tid = localTxn.getTid();
    if (localTxnEvent.getSubType() == LocalTransactionEvent.Type1PCommitEvent) {
      //one phase commit
      //Just replay it now

      transactionLogManager.transactionLogReplayer.replayTransactionWork(localTxn
          .getTransactionWork(), tid, dstLoadedSet);
    } else if (localTxnEvent.getSubType() == LocalTransactionEvent.Type2PPrepareEvent) {
      // 2-phase prepare
      // check if it is stored
      // (this should only be the case if a failure occurred between saving
      // in prepared txn store and resetting the transaction log
      if (incompleteStored.containsKey(tid)) {
        if (Store.getDEBUG()) {
          String msg = getPrefix()
              + " found matching txn in prepared store on replay "
              + localTxn;
          Globals.getLogger().log(Logger.DEBUG, msg);
        }
      } else {
        addToIncompleteUnstored(localTxn);
      }

    } else if (localTxnEvent.getSubType() == LocalTransactionEvent.Type2PCompleteEvent) {
      // we are completing a transaction
      // the transaction could be
      // a) unstored (prepare replayed earlier)
      // b) stored incomplete (prepare occurred before last checkpoint,
      //    completion not written to prepared store yet)
      //    This should therefore be the last entry in log.
      // c) stored complete (prepare occurred before last checkpoint,
      //    and failure occurred after completion stored in prepared store
      BaseTransaction existingWork = null;
      if (incompleteUnstored.containsKey(tid)) {
        // a) unstored (prepare replayed earlier)
        existingWork = removeFromIncompleteUnstored(tid);
      } else if (incompleteStored.containsKey(tid)) {
        // b) stored incomplete (prepare occurred before last checkpoint,
        //    completion not written to prepared store yet)

        existingWork = removeFromIncompleteStored(tid);

        updateStoredState(tid, state);

        addToCompleteStored(existingWork);
      } else if (completeStored.containsKey(tid)) {
        // c) stored complete (prepare occurred before last checkpoint,
        //    and failure occurred after completion stored in prepared store
        existingWork = completeStored.get(tid);
      }
      if (existingWork != null) {
        if (state == TransactionState.COMMITTED) {
          transactionLogManager.transactionLogReplayer.replayTransactionWork(existingWork
              .getTransactionWork(), tid, dstLoadedSet);
        }
      } else {
        logger.log(Logger.ERROR,
            "Could not find prepared work for completing two-phase transaction "
                + localTxn.getTid());
      }
    }

  }
View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.jmsserver.data.LocalTransaction

Copyright © 2018 www.massapicom. 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.