Class TransactionHandler

java.lang.Object
com.j_spaces.core.transaction.TransactionHandler

public class TransactionHandler extends Object
Handle engine transactions
Since:
6.0
Author:
anna
  • Field Details

    • XTN_ADDITIONAL_TIMEOUT

      public static final long XTN_ADDITIONAL_TIMEOUT
  • Constructor Details

  • Method Details

    • getXtnTable

      public Map<ServerTransaction,XtnEntry> getXtnTable()
      Returns:
      the xtnTable
    • removeXtnEntry

      public XtnEntry removeXtnEntry(ServerTransaction key)
    • removeXtnEntry

      public boolean removeXtnEntry(ServerTransaction key, XtnEntry value)
    • getTimedXtns

      public Map<ServerTransaction,Long> getTimedXtns()
      Returns:
      the timedLocalXtns
    • getPhantomGlobalXtns

      public Map<ServerTransaction,Long> getPhantomGlobalXtns()
    • getTxWriteLock

      public Lock getTxWriteLock()
    • getTxReadLock

      public Lock getTxReadLock()
    • addTransaction

      public void addTransaction(XtnEntry xtnEntry)
    • addTransactionIfAbsent

      public XtnEntry addTransactionIfAbsent(XtnEntry xtnEntry)
    • removeTransactionAfterEnd

      public void removeTransactionAfterEnd(XtnEntry xtnEntry)
      Remove given transaction from handled transactions
    • removeUnusedTransaction

      public void removeUnusedTransaction(XtnEntry xtnEntry, boolean needLock)
      Remove an unused transaction from handled transactions
    • createTransactionEntry

      public XtnEntry createTransactionEntry(ServerTransaction txn)
      Create new TransactionEntry and add it to the list of managed transactions
      Returns:
      XtnEntry
    • createTransactionEntryIfAbsent

      public XtnEntry createTransactionEntryIfAbsent(ServerTransaction txn, XtnEntry newXtnEntry)
      Create new TransactionEntry and add it to the list of managed transactions if such xtn does not exist. if it exists=return it
      Parameters:
      newXtnEntry - - to be inserted if absent
      Returns:
      XtnEntry
    • renewTransactionLease

      public void renewTransactionLease(ServerTransaction txn, long time)
    • getUnusedXtnCleanTime

      public int getUnusedXtnCleanTime()
    • getTransactionEntry

      public XtnEntry getTransactionEntry(ServerTransaction txn) throws TransactionException
      Get the transaction entry for given transaction. Check if transaction is valid
      Returns:
      XtnEntry
      Throws:
      TransactionException
    • attachToXtnGranular

      public XtnEntry attachToXtnGranular(ServerTransaction txn, boolean fromReplication) throws TransactionException, RemoteException
      Join the specified transaction, if not already joined.
      Parameters:
      txn - the transaction to join
      Throws:
      TransactionException
      RemoteException
    • xtnLockEntryOnTemplateOperation

      public void xtnLockEntryOnTemplateOperation(Context context, IEntryHolder eh, ITemplateHolder th, XtnEntry alreadyLockedXtn)
      /** given an entry + template- perform the xtn locks and set the appropriate
      Parameters:
      alreadyLockedXtn - - if an encapsulating xtn was already locked (for example in takemultiple)
    • xtnUnlockEntryOnTemplateOperation

      public void xtnUnlockEntryOnTemplateOperation(ITemplateHolder th, XtnEntry alreadyLockedXtn)
    • lockXtnOnXtnEnd

      public boolean lockXtnOnXtnEnd(XtnEntry xtnEntry)
      xtn is ending (rollbak/commit) - lock + fifo lock if fifo entries in xtn
    • unlockXtnOnXtnEnd

      public void unlockXtnOnXtnEnd(XtnEntry xtnEntry, boolean lockedXtnTable)
    • isLightTransaction

      public boolean isLightTransaction(XtnEntry xtnEntry)
    • isPhantomGlobalXtn

      public boolean isPhantomGlobalXtn(ServerTransaction xtn)
    • addToPhantomGlobalXtns

      public void addToPhantomGlobalXtns(ServerTransaction xtn)
    • removeFromPhantomGlobalXtns

      public void removeFromPhantomGlobalXtns(ServerTransaction xtn)
    • getBasicTimeForPreparedXtn

      public static long getBasicTimeForPreparedXtn()
    • isSupportsPreparedXtnsExtentionTime

      public static boolean isSupportsPreparedXtnsExtentionTime()
    • getExtentionTimeForPreparedXtn

      public static long getExtentionTimeForPreparedXtn()
    • getMaxNumberOfPreaparedXtnExtentions

      public static int getMaxNumberOfPreaparedXtnExtentions()
    • addToPrepared2PCXtns

      public void addToPrepared2PCXtns(XtnEntry xtnEntry)
    • removeFromPrepared2PCXtns

      public void removeFromPrepared2PCXtns(ServerTransaction xtn)
    • getPrepared2PCXtns

      public Map<ServerTransaction,Prepared2PCXtnInfo> getPrepared2PCXtns()
    • getTimeToWaitForTm

      public static long getTimeToWaitForTm()
    • checkTransactionDisconnection

      public void checkTransactionDisconnection(OperationID opid, ServerTransaction txn) throws TransactionException
      Throws:
      TransactionException
    • waitForActiveTransactions

      public boolean waitForActiveTransactions(long timeoutInMillis) throws InterruptedException
      Throws:
      InterruptedException
    • waitForFinalizingTransactions

      public boolean waitForFinalizingTransactions(long timeoutInMillis) throws InterruptedException
      Throws:
      InterruptedException