class TxnState extends Object
EntryHandle
s. Can accommodate entries locked by
more than one transaction. The synchronization of this object is
managed by the EntryHandle
that owns it.EntryHandle
Modifier and Type | Field and Description |
---|---|
private EntryHolder |
holder
The holder the handle which owns this object is in
|
private static Logger |
matchingLogger
Logger for logging information about entry matching
|
private Object |
mgrs
The list of known managers.
|
private TransactableMgr[] |
rslt
Used by mgr()
|
private int |
state
The current state of the handle, such as
READ or
TAKE . |
private static Logger |
txnLogger
Logger for logging transaction related information
|
Constructor and Description |
---|
TxnState(TransactableMgr mgr,
int state,
EntryHolder holder)
Create a new
TxnState . |
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
abort(TransactableMgr mgr,
OutriggerServerImpl space,
EntryHandle owner)
Abort this object's part of the transaction.
|
(package private) void |
add(TransactableMgr mgr,
int op)
Add
mgr to the list of known managers, setting the
state of this handle to op . |
(package private) void |
addTxns(Collection collection)
Add all the managers of this transaction to the given
collection.
|
(package private) boolean |
canPerform(TransactableMgr mgr,
int op)
Returns
true if the operation op
under the transaction manager by mgr is legal on
the associated entry given the operations already performed on
the entry under other transactions. |
(package private) boolean |
commit(TransactableMgr mgr,
OutriggerServerImpl space,
EntryHandle owner)
Commit this object's part of the transaction.
|
(package private) boolean |
empty()
Return true if there are no more transactions associated with
this object.
|
(package private) boolean |
knownMgr(TransactableMgr mgr)
Return
true if mgr is one of the managers
known to be managing this entry. |
private TransactableMgr |
mgr()
Returns the one manager associated with this transaction.
|
private void |
monitor(TransactableMgr mgr)
If we need to, add this manager to the list of transactions that
need to be monitored because of conflicts over this entry.
|
(package private) boolean |
onlyMgr(TransactableMgr mgr)
Return
true if the given manager is the only one
we know about. |
(package private) int |
prepare(TransactableMgr mgr,
OutriggerServerImpl space,
EntryHandle owner)
Prepare to commit this object's part of the transaction.
|
(package private) boolean |
promoteToTakeIfNeeded()
It this entry is read locked promote to take locked and return
true, otherwise return false.
|
private int |
removeMgr(TransactableMgr mgr)
Remove the given mgr from the list of known managers.
|
private Object mgrs
mgrs
is managed as a ``list'' in one of two states -- it is either a
direct reference to the only manager for this handle, or a reference
to an HashSet
with entries for each associated manager.private int state
READ
or
TAKE
.private final EntryHolder holder
private static final Logger matchingLogger
private static final Logger txnLogger
private final TransactableMgr[] rslt
TxnState(TransactableMgr mgr, int state, EntryHolder holder)
TxnState
. It will start initially
with the type of lock indicated by state
under the
transaction managed by mgr
. holder
is
the holder the associated entry handle is in.int prepare(TransactableMgr mgr, OutriggerServerImpl space, EntryHandle owner)
boolean abort(TransactableMgr mgr, OutriggerServerImpl space, EntryHandle owner)
boolean commit(TransactableMgr mgr, OutriggerServerImpl space, EntryHandle owner)
space
is the OutriggerServerImpl
on
which the operation happens -- some commit operations have
space-wide side effects (for example, a commit of a
write
operation can cause event notifications for
clients registered under the transaction's parent). Return true
if this clears the last transaction associated with this
object.private int removeMgr(TransactableMgr mgr)
void add(TransactableMgr mgr, int op)
mgr
to the list of known managers, setting the
state of this handle to op
.private void monitor(TransactableMgr mgr)
boolean promoteToTakeIfNeeded()
boolean canPerform(TransactableMgr mgr, int op)
true
if the operation op
under the transaction manager by mgr
is legal on
the associated entry given the operations already performed on
the entry under other transactions. It is legal to:
mgr
is the same as the writing transaction).
canPerform
otherwise returns false
.boolean knownMgr(TransactableMgr mgr)
true
if mgr
is one of the managers
known to be managing this entry.boolean onlyMgr(TransactableMgr mgr)
true
if the given manager is the only one
we know about.void addTxns(Collection collection)
boolean empty()
private TransactableMgr mgr()
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.