org.apache.accumulo.fate
Class AgeOffStore<T>

java.lang.Object
  extended by org.apache.accumulo.fate.AgeOffStore<T>
All Implemented Interfaces:
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.


Nested Class Summary
static interface AgeOffStore.TimeSource
           
 
Nested classes/interfaces inherited from interface org.apache.accumulo.fate.TStore
TStore.TStatus
 
Constructor Summary
AgeOffStore(TStore<T> store, long ageOffTime)
           
AgeOffStore(TStore<T> store, long ageOffTime, AgeOffStore.TimeSource timeSource)
           
 
Method Summary
 void ageOff()
           
 long create()
          Create a new transaction id
 void delete(long tid)
          Remove the transaction from the store.
 Serializable getProperty(long tid, String prop)
           
 TStore.TStatus getStatus(long tid)
          Get the state of a given transaction.
 List<Long> list()
          list all transaction ids in store
 void pop(long tid)
          Remove the last pushed operation from the given transaction.
 void push(long tid, Repo<T> repo)
          Update the given transaction with the next operation
 long reserve()
          Reserve a transaction that is IN_PROGRESS or FAILED_IN_PROGRESS.
 void reserve(long tid)
           
 void setProperty(long tid, String prop, Serializable val)
           
 void setStatus(long tid, TStore.TStatus status)
          Update the state of a given transaction
 Repo<T> top(long tid)
          Get the current operation for the given transaction id.
 void unreserve(long tid, long deferTime)
          Return the given transaction to the store
 TStore.TStatus waitForStatusChange(long tid, EnumSet<TStore.TStatus> expected)
          Wait for the satus of a transaction to change
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgeOffStore

public AgeOffStore(TStore<T> store,
                   long ageOffTime,
                   AgeOffStore.TimeSource timeSource)

AgeOffStore

public AgeOffStore(TStore<T> store,
                   long ageOffTime)
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: TStore
Reserve a transaction that is IN_PROGRESS or FAILED_IN_PROGRESS.

Specified by:
reserve in interface TStore<T>

reserve

public void reserve(long tid)
Specified by:
reserve in interface TStore<T>

unreserve

public void unreserve(long tid,
                      long deferTime)
Description copied from interface: TStore
Return the given transaction to the store

Specified by:
unreserve in interface TStore<T>

top

public Repo<T> top(long tid)
Description copied from interface: TStore
Get the current operation for the given transaction id.

Specified by:
top in interface TStore<T>
Parameters:
tid - transaction id
Returns:
the operation

push

public void push(long tid,
                 Repo<T> repo)
          throws StackOverflowException
Description copied from interface: TStore
Update the given transaction with the next operation

Specified by:
push in interface TStore<T>
Parameters:
tid - the transaction id
repo - the operation
Throws:
StackOverflowException

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 TStore.TStatus getStatus(long tid)
Description copied from interface: TStore
Get the state of a given transaction.

Specified by:
getStatus in interface TStore<T>
Parameters:
tid - transaction id
Returns:
execution status

setStatus

public void setStatus(long tid,
                      TStore.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

waitForStatusChange

public TStore.TStatus waitForStatusChange(long tid,
                                          EnumSet<TStore.TStatus> expected)
Description copied from interface: TStore
Wait for the satus of a transaction to change

Specified by:
waitForStatusChange in interface TStore<T>
Parameters:
tid - transaction id

setProperty

public void setProperty(long tid,
                        String prop,
                        Serializable val)
Specified by:
setProperty in interface TStore<T>

getProperty

public Serializable getProperty(long tid,
                                String prop)
Specified by:
getProperty in interface TStore<T>

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: TStore
list all transaction ids in store

Specified by:
list in interface TStore<T>


Copyright © 2013 Apache Accumulo Project. All Rights Reserved.