|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.helidb.impl.txn.SharedReadLockReadOnlyTxnCollaborator<K,V,P>
K
- The type of the keys in the database.V
- The type of the values in the database.P
- The type of positions used by the
DatabaseBackend
to locate records.public final class SharedReadLockReadOnlyTxnCollaborator<K,V,P>
This is a generic TransactionCollaborator
for read
only transactions.
Constructor Summary | |
---|---|
SharedReadLockReadOnlyTxnCollaborator(DatabaseBackend<K,V,P> backend,
Lock backendReadLock,
LogAdapterHolder lah)
Create a collaborator for a read only transaction. |
Method Summary | |
---|---|
void |
commit()
Commit this collaborator's work. |
protected void |
finalize()
Unlocks the backend read lock if it is still locked before calling super.finalize() . |
DatabaseBackend<K,V,P> |
getBackend()
Get the database's DatabaseBackend object. |
String |
getReasonForUnableToCommit()
Can this collaborator commit its changes? If not, why? |
boolean |
isFinished()
Has this collaborator finished or rolled back its part of the transaction? |
boolean |
isReadOnly()
Does this collaborator's Database participate in the
transaction read only? |
void |
rollback()
Roll back this collaborator's work. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SharedReadLockReadOnlyTxnCollaborator(DatabaseBackend<K,V,P> backend, Lock backendReadLock, LogAdapterHolder lah)
backend
- The database backend.backendReadLock
- A locked read lock for the database. This lock is
released when the transaction is committed or rolled back.lah
- A log adapter holder.Method Detail |
---|
public boolean isReadOnly()
TransactionCollaborator
Database
participate in the
transaction read only?
isReadOnly
in interface TransactionCollaborator<K,V,P>
true
, always.public boolean isFinished()
TransactionCollaborator
isFinished
in interface TransactionCollaborator<K,V,P>
true
if this collaborator has finished or rolled back its
part of the transaction.public DatabaseBackend<K,V,P> getBackend()
TransactionCollaborator
DatabaseBackend
object.
getBackend
in interface TransactionCollaborator<K,V,P>
DatabaseBackend
object.public void rollback()
TransactionCollaborator
This method should try to avoid throwing exceptions since that may put the resources participating in the entire transaction in an undefined state.
rollback
in interface TransactionCollaborator<K,V,P>
public String getReasonForUnableToCommit()
TransactionCollaborator
getReasonForUnableToCommit
in interface TransactionCollaborator<K,V,P>
null
if the collaborator is able to commit its changes to
its database, or a reason for why it cannot.public void commit()
TransactionCollaborator
TransactionCollaborator.getReasonForUnableToCommit()
has been called on all
collaborators.
This method should really not throw any exceptions since that would put
the resources participating in the entire transaction in an undefined
state. If the collaborator cannot commit the work in the database, it
should say so when asked via the TransactionCollaborator.getReasonForUnableToCommit()
.
commit
in interface TransactionCollaborator<K,V,P>
protected void finalize() throws Throwable
super.finalize()
.
finalize
in class Object
Throwable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |