V
- specific type of Version
this TimelyResource
managespublic class TimelyResource<V extends com.persistit.Version> extends Object
Transactionally manage multiple versions of a resource. For example, a
resource which caches state created and either committed or rolled back by a
transaction may be use a TimelyResource to hold its versions. Each version
must implement the Version
interface and may optionally implement
Version.PrunableVersion
in which case its Version.PrunableVersion.prune()
method is called when TimelyResource
detects that the version is
obsolete.
The method addVersion(Version, Transaction)
attempts to add a new
version on behalf of the supplied transaction.
The method getVersion()
returns the snapshot version associated with
the transaction, in other words, an instance of a P which was either
committed last before this transaction started, or which was created by this
transaction. If there is no such version the method returns null
.
The method getVersion(com.persistit.Version.VersionCreator)
does the
same thing, except that if there is no snapshot version the
Version.VersionCreator.createVersion(TimelyResource)
method is called to
construct a new version.
Constructor and Description |
---|
TimelyResource(Persistit persistit) |
Modifier and Type | Method and Description |
---|---|
void |
addVersion(V resource,
Transaction txn) |
void |
delete() |
V |
getVersion() |
V |
getVersion(Version.VersionCreator<V> creator) |
boolean |
isEmpty() |
boolean |
isTransactionPrivate(boolean byStep) |
String |
toString() |
public TimelyResource(Persistit persistit)
public void delete() throws RollbackException, PersistitException
RollbackException
PersistitException
public void addVersion(V resource, Transaction txn) throws PersistitInterruptedException, RollbackException
public V getVersion() throws TimeoutException, PersistitInterruptedException
public V getVersion(Version.VersionCreator<V> creator) throws PersistitException, RollbackException
PersistitException
RollbackException
public boolean isEmpty() throws TimeoutException, PersistitInterruptedException
true
if and only if this TimelyResource
has no Version
instances.TimeoutException
PersistitInterruptedException
public boolean isTransactionPrivate(boolean byStep) throws TimeoutException, PersistitInterruptedException
TimeoutException
PersistitInterruptedException
Copyright © 2025 Open Identity Platform Community. All rights reserved.