Package org.apache.derby.iapi.store.raw.xact

Examples of org.apache.derby.iapi.store.raw.xact.TransactionId


    boolean inUserCode = false;

    try {
      logOutputBuffer.reset();

      TransactionId transactionId = xact.getId();

      // write out the log header with the operation embedded
      logRecord.setValue(transactionId, compensation);

      inUserCode = true;
      logicalOut.writeObject(logRecord);
      inUserCode = false;

      // write out the undoInstant
      logicalOut.writeLong(((LogCounter)undoInstant).getValueAsLong());

      // in this implemetaion, there is no optional data for the
      // compensation operation.  Optional data for the rollback comes
      // from the undoable operation - and is passed into this call.
      int completeLength = logOutputBuffer.getPosition();
      long instant = 0;
     
      if (logFactory.databaseEncrypted())
      {
        // we must pad the encryption data to be multiple of block
        // size, which is logFactory.getEncryptionBlockSize()
        int encryptedLength = completeLength;
        if ((encryptedLength % logFactory.getEncryptionBlockSize()) != 0)
          encryptedLength = encryptedLength + logFactory.getEncryptionBlockSize() - (encryptedLength % logFactory.getEncryptionBlockSize());

        if (encryptionBuffer == null ||
          encryptionBuffer.length < encryptedLength)
          encryptionBuffer = new byte[encryptedLength];

        System.arraycopy(logOutputBuffer.getByteArray(), 0,
                 encryptionBuffer, 0, completeLength);

        // do not bother to clear out the padding area
        int len =
          logFactory.encrypt(encryptionBuffer, 0, encryptedLength,
                     encryptionBuffer, 0);

        if (SanityManager.DEBUG)
          SanityManager.ASSERT(len == encryptedLength,
            "encrypted log buffer length != log buffer len");

        instant = logFactory.
          appendLogRecord(encryptionBuffer,
                  0, encryptedLength, null, 0, 0);
      }
      else
      {
        instant = logFactory.
          appendLogRecord(logOutputBuffer.getByteArray(),
                  0, completeLength, null, 0, 0);
      }

      LogInstant logInstant = new LogCounter(instant);

      if (SanityManager.DEBUG)
            {
                if (SanityManager.DEBUG_ON(LogToFile.DBG_FLAG))
                {
                    SanityManager.DEBUG(
                        LogToFile.DBG_FLAG,
                        "Write CLR: Xact: " + transactionId.toString() +
                        "clrinstant: " + logInstant.toString() +
                        " undoinstant " + undoInstant + "\n");
                }
      }
View Full Code Here


        int btranCount   = 0;
        int etranCount   = 0;

    // end debug info

    TransactionId tranId = null;

        // the current log instant
    long instant = LogCounter.INVALID_LOG_INSTANT;

    //////////////////////////////////////////////////////////////////////
View Full Code Here

    }


  void add(Xact xact, boolean exclude)
  {
    TransactionId id = xact.getId();

        TransactionTableEntry newEntry = new TransactionTableEntry(
                xact, id, 0, exclude ? TransactionTableEntry.EXCLUDE : 0);

    synchronized(this)
View Full Code Here

    {
      // set tranaction to idle
      return findAndAssumeTransaction((TransactionId)null, tran);
    }

    TransactionId id = null;
    for (Iterator it = trans.values().iterator(); it.hasNext(); )
    {
      TransactionTableEntry ent = (TransactionTableEntry) it.next();

      if (ent != null && ent.isUpdate() && ent.isRecovery() &&
View Full Code Here

    <P>MT - unsafe, caller is recovery, which is single threaded.
  */
  public boolean getMostRecentTransactionForRollback(RawTransaction tran)
  {
        TransactionId id = null;

        if (!trans.isEmpty())
    {
      for (Iterator it = trans.values().iterator(); it.hasNext() ; )
      {
View Full Code Here

  {
        TransactionTableEntry   found_ent   = null;

        if (!trans.isEmpty())
    {
            TransactionId           id          = null;
            GlobalTransactionId     gid         = null;
            TransactionTableEntry   ent;

      for (Iterator it = trans.values().iterator(); it.hasNext(); )
      {
View Full Code Here

                !recovery, "trying to display recovery transaction");
      SanityManager.ASSERT(myxact != null, "my xact is null");
      SanityManager.ASSERT(isClone, "Should only call method on a clone");
    }

    TransactionId t = myxact.getIdNoCheck();
    return (t == null) ? "CLOSED" : t.toString();
  }
View Full Code Here

     *
     **/
    public String diag()
        throws StandardException
    {
        TransactionId id = ((Xact) diag_object).getId();

        if (id instanceof XactId)
            return("Transaction:(" + ((XactId) id).getId() + ")");
        else
            return(id.toString());
    }
View Full Code Here

                !recovery, "trying to display recovery transaction");
      SanityManager.ASSERT(myxact != null, "my xact is null");
      SanityManager.ASSERT(isClone, "Should only call method on a clone");
    }

    TransactionId t = myxact.getIdNoCheck();
    return (t == null) ? "CLOSED" : t.toString();
  }
View Full Code Here



  void add(Xact xact, boolean exclude)
  {
    TransactionId id = xact.getId();

    synchronized(this)
    {
      TransactionTableEntry ent = findTransactionEntry(id);
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.store.raw.xact.TransactionId

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.