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

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


        }

        TransactionBroker[] tbas = (TransactionBroker[])bmmap.keySet().toArray(
                                                       new TransactionBroker[0]);
        boolean persist = true;
        ClusterTransaction clusterTransaction =null;
        if(Globals.isNewTxnLogEnabled())
        {
          // create a cluster transaction which will be logged 
          clusterTransaction = new ClusterTransaction(id,nextState,txnWork,tbas);         
          translist.logClusterTransaction(id, nextState, tbas, true, persist, clusterTransaction);
        }
        else{
          translist.logClusterTransaction(id, nextState, tbas, true, persist);
        }
View Full Code Here


    // if txn is complete then mark this also

    // clustered txnUpdate record
    // TO DO
    //first look in unstored
    ClusterTransaction clusterTxn = null;
    boolean stored = false;

    clusterTxn = (ClusterTransaction) incompleteUnstored.get(tid);
    if (clusterTxn == null) {
      clusterTxn = (ClusterTransaction) incompleteStored.get(tid);
      if (clusterTxn != null)
        stored = true;

    }
    if (clusterTxn != null) {
      boolean allComplete = updateTransactionBrokerState(txnBkr,
          clusterTxn);
      if (Store.getDEBUG()) {                       
        Globals.getLogger().log(Logger.DEBUG, getPrefix() + " allComplete:  = " + allComplete);
      }
      if (allComplete) {
        clusterTxn.getTransactionDetails().setComplete(true);
        if (!stored) {
          removeFromIncompleteUnstored(tid);
        } else {
          removeFromIncompleteStored(tid);
          addToCompleteStored(clusterTxn);
View Full Code Here

      Globals.getLogger().log(Logger.DEBUG,
          getPrefix() + " replayTransactionEvent");
    }
    ClusterTransactionEvent clusterTxnEvent = (ClusterTransactionEvent) txnEvent;
    // replay to store on commit
    ClusterTransaction clusterTxn = clusterTxnEvent.clusterTransaction;
    int state = clusterTxn.getState();
    TransactionUID tid = clusterTxn.getTid();
    if (clusterTxnEvent.getSubType() == ClusterTransactionEvent.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 "
              + clusterTxn;
          Globals.getLogger().log(Logger.DEBUG, msg);
        }
      } else {
        addToIncompleteUnstored(clusterTxn);
      }

    } else if (clusterTxnEvent.getSubType() == ClusterTransactionEvent.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)
        if (state == TransactionState.ROLLEDBACK) {
          existingWork = removeFromIncompleteUnstored(tid);
        } else if (state == TransactionState.COMMITTED) {

          existingWork = incompleteUnstored.get(tid);
          existingWork.getTransactionDetails().setState(state);
          existingWork.getTransactionState().setState(state);
        }
       
      } 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 "
                + clusterTxn.getTid());
      }
    }

  }
View Full Code Here

      Globals.getLogger().log(Logger.DEBUG,
          getPrefix() + "readFromBytes");
    }
    ByteArrayInputStream bais = new ByteArrayInputStream(data);
    DataInputStream dis = new DataInputStream(bais);
    clusterTransaction = new ClusterTransaction();
    dis.skip(2);
   

    clusterTransaction.getTransactionDetails().readContent(dis);
    if (Store.getDEBUG()) {
View Full Code Here

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

    clusterTransaction = new ClusterTransaction();
    dis.skip(2);
    clusterTransaction.getTransactionDetails().readContent(dis);

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

  class ClusterTxnConverter extends TxnConverter {

    void convert(BaseTransaction baseTxn) throws BrokerException,
        IOException {

      ClusterTransaction clusterTxn = (ClusterTransaction) baseTxn;
      TransactionUID id = baseTxn.getTid();

      TransactionState ts = baseTxn.getTransactionState();

      int finalState = ts.getState();

      ts.setState(TransactionState.STARTED);

      // TransactionState
      fileStore.storeTransaction(id, ts, true);

      TransactionWork txnWork = baseTxn.getTransactionWork();
      if (txnWork != null)
        convertWork(txnWork, ts, id);

      store.updateClusterTransaction(id, clusterTxn
          .getTransactionBrokers(), Destination.PERSIST_SYNC);

      ts.setState(TransactionState.PREPARED);
      fileStore.updateTransactionState(id, ts, true);
View Full Code Here

TOP

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

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.