public interface TransactionManager extends Remote, TransactionConstants
ServerTransaction
objects
are governed by a transaction manager that runs this protocol.NestableTransactionManager
,
ServerTransaction
,
TransactionParticipant
Modifier and Type | Interface and Description |
---|---|
static class |
TransactionManager.Created
Class that holds return values from create methods.
|
ABORTED, ACTIVE, COMMITTED, NOTCHANGED, PREPARED, VOTING
Modifier and Type | Method and Description |
---|---|
void |
abort(long id)
Abort the transaction.
|
void |
abort(long id,
long waitFor)
Abort the transaction, waiting for participants to be notified of
the decision.
|
void |
commit(long id)
Commit the transaction.
|
void |
commit(long id,
long waitFor)
Commit the transaction, waiting for participants to be notified of
the decision.
|
TransactionManager.Created |
create(long lease)
Begin a new top-level transaction.
|
int |
getState(long id)
Returns the current state of the given transaction.
|
void |
join(long id,
TransactionParticipant part,
long crashCount)
Join a transaction that is managed by this transaction manager.
|
TransactionManager.Created create(long lease) throws LeaseDeniedException, RemoteException
lease
- the requested lease time for the transactionLeaseDeniedException
- if this manager is unwilling to
grant the requested lease timeRemoteException
- if there is a communication errorvoid join(long id, TransactionParticipant part, long crashCount) throws UnknownTransactionException, CannotJoinException, CrashCountException, RemoteException
crashCount
marks the state of the storage used by
the participant for transactions. If the participant attempts to
join a transaction more than once, the crash counts must be the same.
Each system crash or other event that destroys the state of the
participant's unprepared transaction storage must cause the crash
count to increase by at least one.id
- the transaction IDpart
- the participant joining the transactioncrashCount
- the participant's current crash countUnknownTransactionException
- if the transaction
is unknown to the transaction manager, either
because the transaction ID is incorrect or because the
transaction is complete and its state has been
discarded by the manager.CannotJoinException
- if the transaction is known
to the manager but is no longer active.CrashCountException
- if the crash count provided
for the participant differs from the crash count
in a previous invocation of the same pairing of
participant and transactionRemoteException
- if there is a communication errorServerTransaction.join(net.jini.core.transaction.server.TransactionParticipant, long)
int getState(long id) throws UnknownTransactionException, RemoteException
TransactionConstants
values.id
- the transaction IDint
representing the state of the transactionUnknownTransactionException
- if the transaction
is unknown to the transaction manager, either
because the transaction ID is incorrect or because the
transaction is complete and its state has been
discarded by the manager.RemoteException
- if there is a communication errorServerTransaction.getState()
,
TransactionConstants
void commit(long id) throws UnknownTransactionException, CannotCommitException, RemoteException
NOTCHANGED
or the COMMITTED
state, without waiting for the
transaction manager to notify all participants of the decision.
If the transaction must be aborted (because one or more participants
are unable to prepare), CannotCommitException
is thrown
without waiting for the transaction manager to notify all participants
of the decision.id
- the transaction IDUnknownTransactionException
- if the transaction
is unknown to the transaction manager, either
because the transaction ID is incorrect or because the
transaction is complete and its state has been
discarded by the manager.CannotCommitException
- if the transaction is being or already
has been abortedRemoteException
- if there is a communication errorvoid commit(long id, long waitFor) throws UnknownTransactionException, CannotCommitException, TimeoutExpiredException, RemoteException
NOTCHANGED
or the
COMMITTED
state, and the transaction manager has
notified all participants of the decision, before the specified
timeout expires. If the transaction must be aborted (because one
or more participants are unable to prepare),
CannotCommitException
is thrown if the transaction
manager is able to notify all participants of the decision before
the specified timeout expires. If the transaction manager reaches
a decision, but is unable to notify all participants of that
decision before the specified timeout expires, then
TimeoutExpiredException
is thrown. If the specified
timeout expires before the transaction manager reaches a decision,
TimeoutExpiredException
is not thrown until the
manager reaches a decision.id
- the transaction IDwaitFor
- timeout to wait, from the start of the call until
all participants have been notified of the transaction manager's
decisionUnknownTransactionException
- if the transaction
is unknown to the transaction manager, either
because the transaction ID is incorrect or because the
transaction is complete and its state has been
discarded by the manager.CannotCommitException
- if the transaction is being or already
has been abortedTimeoutExpiredException
- if the transaction manager reaches
a decision, but is unable to notify all participants of that
decision before the specified timeout expiresRemoteException
- if there is a communication errorvoid abort(long id) throws UnknownTransactionException, CannotAbortException, RemoteException
id
- the transaction IDUnknownTransactionException
- if the transaction
is unknown to the transaction manager, either
because the transaction ID is incorrect or because the
transaction is complete and its state has been
discarded by the manager.CannotAbortException
- if the transaction is known to have
previously reached the COMMITTED state due to an earlier
commitRemoteException
- if there is a communication errorvoid abort(long id, long waitFor) throws UnknownTransactionException, CannotAbortException, TimeoutExpiredException, RemoteException
TimeoutExpiredException
is thrown.id
- the transaction IDwaitFor
- timeout to wait, from the start of the call until
all participants have been notified of the transaction manager's
decisionUnknownTransactionException
- if the transaction
is unknown to the transaction manager, either
because the transaction ID is incorrect or because the
transaction is complete and its state has been
discarded by the manager.CannotAbortException
- if the transaction is known to have
previously reached the COMMITTED state due to an earlier
commitTimeoutExpiredException
- if the timeout expires before
all participants have been notifiedRemoteException
- if there is a communication errorCopyright © 2016–2018 The Apache Software Foundation. All rights reserved.