K
- the key typeV
- the value typepublic static class TransactionStore.TransactionMap<K,V> extends Object
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the map.
|
boolean |
containsKey(K key)
Whether the map contains the key.
|
Iterator<Map.Entry<K,V>> |
entryIterator(K from)
Iterate over entries.
|
K |
firstKey()
Get the first key.
|
V |
get(K key)
Get the value for the given key at the time when this map was opened.
|
V |
get(K key,
long maxLogId)
Get the value for the given key.
|
TransactionStore.TransactionMap<K,V> |
getInstance(TransactionStore.Transaction transaction,
long savepoint)
Get a clone of this map for the given transaction.
|
DataType |
getKeyType() |
V |
getLatest(K key)
Get the most recent value for the given key.
|
TransactionStore.Transaction |
getTransaction() |
K |
higherKey(K key)
Get the smallest key that is larger than the given key, or null if no
such key exists.
|
boolean |
isClosed()
Check whether this map is closed.
|
boolean |
isSameTransaction(K key)
Whether the entry for this key was added or removed from this
session.
|
Iterator<K> |
keyIterator(K from)
Iterate over keys.
|
Iterator<K> |
keyIterator(K from,
boolean includeUncommitted)
Iterate over keys.
|
K |
lastKey()
Get the last key.
|
K |
lowerKey(K key)
Get the largest key that is smaller than the given key, or null if no
such key exists.
|
V |
put(K key,
V value)
Update the value for the given key.
|
V |
putCommitted(K key,
V value)
Update the value for the given key, without adding an undo log entry.
|
K |
relativeKey(K key,
long offset)
Get one of the previous or next keys.
|
V |
remove(K key)
Remove an entry.
|
void |
setSavepoint(long savepoint)
Set the savepoint.
|
long |
sizeAsLong()
Get the size of the map as seen by this transaction.
|
long |
sizeAsLongMax()
Get the size of the raw map.
|
boolean |
tryPut(K key,
V value)
Try to update the value for the given key.
|
boolean |
tryRemove(K key)
Try to remove the value for the given key.
|
boolean |
trySet(K key,
V value,
boolean onlyIfUnchanged)
Try to set or remove the value.
|
Iterator<K> |
wrapIterator(Iterator<K> iterator,
boolean includeUncommitted)
Iterate over keys.
|
public void setSavepoint(long savepoint)
savepoint
- the savepointpublic TransactionStore.TransactionMap<K,V> getInstance(TransactionStore.Transaction transaction, long savepoint)
transaction
- the transactionsavepoint
- the savepointpublic long sizeAsLongMax()
public long sizeAsLong()
public V remove(K key)
If the row is locked, this method will retry until the row could be updated or until a lock timeout.
key
- the keyIllegalStateException
- if a lock timeout occurspublic V put(K key, V value)
If the row is locked, this method will retry until the row could be updated or until a lock timeout.
key
- the keyvalue
- the new value (not null)IllegalStateException
- if a lock timeout occurspublic V putCommitted(K key, V value)
key
- the keyvalue
- the valuepublic boolean tryRemove(K key)
This will fail if the row is locked by another transaction (that means, if another open transaction changed the row).
key
- the keypublic boolean tryPut(K key, V value)
This will fail if the row is locked by another transaction (that means, if another open transaction changed the row).
key
- the keyvalue
- the new valuepublic boolean trySet(K key, V value, boolean onlyIfUnchanged)
key
- the keyvalue
- the new value (null to remove the value)onlyIfUnchanged
- only set the value if it was not changed (by
this or another transaction) since the map was openedpublic V get(K key)
key
- the keypublic V getLatest(K key)
key
- the keypublic boolean containsKey(K key)
key
- the keypublic V get(K key, long maxLogId)
key
- the keymaxLogId
- the maximum log idpublic boolean isSameTransaction(K key)
key
- the keypublic boolean isClosed()
public void clear()
public K firstKey()
public K lastKey()
public K higherKey(K key)
key
- the key (may not be null)public K relativeKey(K key, long offset)
key
- the key (may not be null)offset
- how many keys to skip (-1 for previous, 1 for next)public K lowerKey(K key)
key
- the key (may not be null)public Iterator<K> keyIterator(K from)
from
- the first key to returnpublic Iterator<K> keyIterator(K from, boolean includeUncommitted)
from
- the first key to returnincludeUncommitted
- whether uncommitted entries should be
includedpublic Iterator<Map.Entry<K,V>> entryIterator(K from)
from
- the first key to returnpublic Iterator<K> wrapIterator(Iterator<K> iterator, boolean includeUncommitted)
iterator
- the iterator to wrapincludeUncommitted
- whether uncommitted entries should be
includedpublic TransactionStore.Transaction getTransaction()
public DataType getKeyType()
Copyright © 2017 JBoss by Red Hat. All rights reserved.