class TxnTable extends Object
TransactionManager
/id pairs, to Txn
objects. Some Txn
s may be broken, that is the
TransactionManager
they are associated with can not be
unmarshalled and prepared, and thus can't currently be used (but may be
usable in the future).Modifier and Type | Class and Description |
---|---|
private class |
TxnTable.Key
Key class for the primary map (from manager/id pairs to
Txn
s. |
Modifier and Type | Field and Description |
---|---|
private Map |
brokenTxns
Map of transaction ids to the
List of broken
Txn objects that have the id. |
private static Logger |
logger
The logger to use
|
private ProxyPreparer |
proxyPreparer
ProxyPreparer to use when unpacking transactions, may be
null . |
private static Txn[] |
txnArray
An array of type
Txn to pass to toArray |
private Map |
txns
Map of manager,id pairs (represented as
Keys s) to non-broken
Txn s. |
Constructor and Description |
---|
TxnTable(ProxyPreparer proxyPreparer)
Create a new
TxnTable . |
Modifier and Type | Method and Description |
---|---|
(package private) Txn |
get(TransactionManager manager,
long id)
Given a
TransactionManager , manager , and a
transaction id, return the associated Txn , or
null if there is no Txn for this manager/id
pair. |
(package private) Txn |
put(ServerTransaction tr)
Atomically test if there is a
Txn for the specified
ServerTransaction in the table, creating a new
Txn , and place in table if there is not. |
private void |
put(Txn txn)
Used to put a formally broken
Txn in the main table. |
(package private) void |
recover(Txn txn)
Restore a
Txn in the table as part of log recovery. |
(package private) void |
remove(TransactionManager manager,
long id)
Remove the mapping for the given
TransactionManager , id
pair. |
private final Map txns
Keys
s) to non-broken
Txn
s. Only Key
s that have their prepared flag
set should go in this Map.private Map brokenTxns
List
of broken
Txn
objects that have the id. null
if there are
no broken Txn
s.private final ProxyPreparer proxyPreparer
ProxyPreparer
to use when unpacking transactions, may be
null
.private static final Txn[] txnArray
Txn
to pass to toArray
private static final Logger logger
TxnTable(ProxyPreparer proxyPreparer)
TxnTable
.proxyPreparer
- the proxy preparer to use on recovered
TransactionManager
s.Txn get(TransactionManager manager, long id) throws IOException, ClassNotFoundException
TransactionManager
, manager
, and a
transaction id, return the associated Txn
, or
null
if there is no Txn
for this manager/id
pair. The only method this method will call on manager
is
hashCode
. The returned Txn
object will not be
broken.manager
- a TransactionManager
.id
- a transaction id.Txn
for the specified pair or null if none can
be found.IOException
- if there was one or more possible matches, but they are
broken and the attempt to unpack them yielded an
IOException
.ClassNotFoundException
- if there was one or more possible matches, but they are
broken and the attempt to unpack them yielded a
ClassNotFoundException
.SecurityException
- if there was one or more possible matches, but they are
broken and the attempt to unpack them yielded a
SecurityException
.Txn put(ServerTransaction tr)
Txn
for the specified
ServerTransaction
in the table, creating a new
Txn
, and place in table if there is not. If there is already
a Txn
for the specified ServerTransaction
return the existing one, otherwise return the new one. Does not check for
matches against broken txns.tr
- ServerTransaction
to add to the table. The
contained manager proxy should already been preparedTxn
for tr
.private void put(Txn txn)
Txn
in the main table. Only
puts it in the table if it is not already their.txn
- the Txn
being moved, should have been preparedvoid recover(Txn txn)
Txn
in the table as part of log recovery. An
attempt will be made unpack and prepare the transaction manager. The
Txn
may be broken. This method is not synchronized.txn
- the Txn
being recovered.void remove(TransactionManager manager, long id)
TransactionManager
, id
pair. Will not remove broken Txn
s.manager
- the TransactionManager
for transaction being
removed.id
- the manager assigned to the transaction being removed.Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.