Class AgeOffStore<T>

  • All Implemented Interfaces:
    ReadOnlyTStore<T>, TStore<T>

    public class AgeOffStore<T>
    extends Object
    implements TStore<T>
    This store removes Repos, in the store it wraps, that are in a finished or new state for more than a configurable time period. No external time source is used. It starts tracking idle time when its created.
    • Method Detail

      • ageOff

        public void ageOff()
      • create

        public long create()
        Description copied from interface: TStore
        Create a new transaction id
        Specified by:
        create in interface TStore<T>
        Returns:
        a transaction id
      • reserve

        public long reserve()
        Description copied from interface: ReadOnlyTStore
        Reserve a transaction that is IN_PROGRESS or FAILED_IN_PROGRESS. Reserving a transaction id ensures that nothing else in-process interacting via the same instance will be operating on that transaction id.
        Specified by:
        reserve in interface ReadOnlyTStore<T>
        Returns:
        a transaction id that is safe to interact with, chosen by the store.
      • reserve

        public void reserve​(long tid)
        Description copied from interface: ReadOnlyTStore
        Reserve the specific tid. Reserving a transaction id ensures that nothing else in-process interacting via the same instance will be operating on that transaction id.
        Specified by:
        reserve in interface ReadOnlyTStore<T>
      • tryReserve

        public boolean tryReserve​(long tid)
        Description copied from interface: TStore
        Attempt to reserve transaction
        Specified by:
        tryReserve in interface TStore<T>
        Parameters:
        tid - transaction id
        Returns:
        true if reserved by this call, false if already reserved
      • unreserve

        public void unreserve​(long tid,
                              long deferTime)
        Description copied from interface: ReadOnlyTStore
        Return the given transaction to the store. upon successful return the store now controls the referenced transaction id. caller should no longer interact with it.
        Specified by:
        unreserve in interface ReadOnlyTStore<T>
        Parameters:
        tid - transaction id, previously reserved.
        deferTime - time in millis to keep this transaction out of the pool used in the reserve method. must be non-negative.
      • top

        public Repo<T> top​(long tid)
        Description copied from interface: ReadOnlyTStore
        Get the current operation for the given transaction id. Caller must have already reserved tid.
        Specified by:
        top in interface ReadOnlyTStore<T>
        Specified by:
        top in interface TStore<T>
        Parameters:
        tid - transaction id, previously reserved.
        Returns:
        a read-only view of the operation
      • pop

        public void pop​(long tid)
        Description copied from interface: TStore
        Remove the last pushed operation from the given transaction.
        Specified by:
        pop in interface TStore<T>
      • getStatus

        public ReadOnlyTStore.TStatus getStatus​(long tid)
        Description copied from interface: ReadOnlyTStore
        Get the state of a given transaction. Caller must have already reserved tid.
        Specified by:
        getStatus in interface ReadOnlyTStore<T>
        Parameters:
        tid - transaction id, previously reserved.
        Returns:
        execution status
      • setStatus

        public void setStatus​(long tid,
                              ReadOnlyTStore.TStatus status)
        Description copied from interface: TStore
        Update the state of a given transaction
        Specified by:
        setStatus in interface TStore<T>
        Parameters:
        tid - transaction id
        status - execution status
      • setTransactionInfo

        public void setTransactionInfo​(long tid,
                                       Fate.TxInfo txInfo,
                                       Serializable val)
        Description copied from interface: TStore
        Set transaction-specific information.
        Specified by:
        setTransactionInfo in interface TStore<T>
        Parameters:
        tid - transaction id
        txInfo - name of attribute of a transaction to set.
        val - transaction data to store
      • getTransactionInfo

        public Serializable getTransactionInfo​(long tid,
                                               Fate.TxInfo txInfo)
        Description copied from interface: ReadOnlyTStore
        Retrieve transaction-specific information. Caller must have already reserved tid.
        Specified by:
        getTransactionInfo in interface ReadOnlyTStore<T>
        Parameters:
        tid - transaction id, previously reserved.
        txInfo - name of attribute of a transaction to retrieve.
      • delete

        public void delete​(long tid)
        Description copied from interface: TStore
        Remove the transaction from the store.
        Specified by:
        delete in interface TStore<T>
        Parameters:
        tid - the transaction id
      • list

        public List<Long> list()
        Description copied from interface: ReadOnlyTStore
        list all transaction ids in store.
        Specified by:
        list in interface ReadOnlyTStore<T>
        Returns:
        all outstanding transactions, including those reserved by others.
      • timeCreated

        public long timeCreated​(long tid)
        Description copied from interface: ReadOnlyTStore
        Retrieve the creation time of a FaTE transaction.
        Specified by:
        timeCreated in interface ReadOnlyTStore<T>
        Parameters:
        tid - Transaction id, previously reserved.
        Returns:
        creation time of transaction.
      • getStack

        public List<ReadOnlyRepo<T>> getStack​(long tid)
        Description copied from interface: ReadOnlyTStore
        Get all operations on a transactions stack. Element 0 contains the most recent operation pushed or the top.
        Specified by:
        getStack in interface ReadOnlyTStore<T>