public class ZooStore<T> extends Object implements TStore<T>
ReadOnlyTStore.TStatus
Constructor and Description |
---|
ZooStore(String path,
IZooReaderWriter zk) |
Modifier and Type | Method and Description |
---|---|
long |
create()
Create a new transaction id
|
void |
delete(long tid)
Remove the transaction from the store.
|
Serializable |
getProperty(long tid,
String prop)
Retrieve a transaction-specific property.
|
List<ReadOnlyRepo<T>> |
getStack(long tid)
Get all operations on a transactions stack.
|
ReadOnlyTStore.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)
Reserve the specific tid.
|
void |
setProperty(long tid,
String prop,
Serializable so) |
void |
setStatus(long tid,
ReadOnlyTStore.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.
|
ReadOnlyTStore.TStatus |
waitForStatusChange(long tid,
EnumSet<ReadOnlyTStore.TStatus> expected)
Wait for the status of a transaction to change
|
public ZooStore(String path, IZooReaderWriter zk) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperException
InterruptedException
public long create()
TStore
public long reserve()
ReadOnlyTStore
reserve
in interface ReadOnlyTStore<T>
public void reserve(long tid)
ReadOnlyTStore
reserve
in interface ReadOnlyTStore<T>
public void unreserve(long tid, long deferTime)
ReadOnlyTStore
unreserve
in interface ReadOnlyTStore<T>
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.public Repo<T> top(long tid)
ReadOnlyTStore
public void push(long tid, Repo<T> repo) throws StackOverflowException
TStore
push
in interface TStore<T>
tid
- the transaction idrepo
- the operationStackOverflowException
public void pop(long tid)
TStore
public ReadOnlyTStore.TStatus getStatus(long tid)
ReadOnlyTStore
getStatus
in interface ReadOnlyTStore<T>
tid
- transaction id, previously reserved.public ReadOnlyTStore.TStatus waitForStatusChange(long tid, EnumSet<ReadOnlyTStore.TStatus> expected)
ReadOnlyTStore
waitForStatusChange
in interface ReadOnlyTStore<T>
tid
- transaction id, need not have been reserved.expected
- a set of possible statuses we are interested in being notified about. may not be null.public void setStatus(long tid, ReadOnlyTStore.TStatus status)
TStore
public void delete(long tid)
TStore
public void setProperty(long tid, String prop, Serializable so)
setProperty
in interface TStore<T>
public Serializable getProperty(long tid, String prop)
ReadOnlyTStore
getProperty
in interface ReadOnlyTStore<T>
tid
- transaction id, previously reserved.prop
- name of property to retrieve.public List<Long> list()
ReadOnlyTStore
list
in interface ReadOnlyTStore<T>
public List<ReadOnlyRepo<T>> getStack(long tid)
ReadOnlyTStore
getStack
in interface ReadOnlyTStore<T>
Copyright © 2011–2019 The Apache Software Foundation. All rights reserved.