public final class UncommittedLibraryObjectDataCache extends Cache
Unlike the committed data cache maintained by S_LibraryService (which shares data across all sessions for that service), an UncommittedLibraryObjectDataCache provides a session-wise transaction-aware data cache.
Modifier and Type | Field and Description |
---|---|
protected LooselyBoundedCache |
m_CommittedLibraryObjectDataCache
The committed data cache belonging to S_LibraryService.
|
protected Vector |
m_Frames
The uncommitted data frames (one for each savepoint).
|
protected long |
m_HitCount
The number of cache hits.
|
protected long |
m_MissCount
The number of cache misses.
|
protected long |
m_PutCount
The number of cache puts.
|
protected long |
m_RemoveCount
The number of cache removes.
|
protected S_LibrarySession |
m_Session
The session to which this UncommittedLibraryObjectDataCache belongs.
|
m_Configuration
Constructor and Description |
---|
UncommittedLibraryObjectDataCache(UncommittedLibraryObjectDataCacheConfiguration config)
Constructs an uncommitted data cache.
|
Modifier and Type | Method and Description |
---|---|
protected void |
abortTransaction(Transaction transaction)
Handles the cache implications of aborting a transaction.
|
protected void |
beginTransaction(Transaction transaction)
Handles the cache implications of beginning a new transaction.
|
protected void |
completeTransaction(Transaction transaction,
LibraryConnection lconn)
Handles the cache implications of completing a transaction.
|
void |
dispose()
Disposes this cache.
|
Object |
find(Object id)
Gets an item from this cache.
|
CachePerformance |
getCachePerformance()
Gets the performance information for this cache.
|
protected void |
invalidateSharedState(IfsEvent event)
Invalidates shared state for the specified object.
|
boolean |
isMarkedDirty(Object id)
Detects whether the specified item ID is marked dirty in any
uncommitted frame.
|
void |
lock(Object id,
Object value)
Puts an item in this cache, locking it
if it represents committed data.
|
void |
lock(Object id,
S_LibraryObjectData lodata)
Puts an item in this cache, locking it
if it represents committed data.
|
protected void |
markDirty(Long id,
Long classId,
int eventType)
Marks the specified S_LibraryObjectData as being "dirty".
|
void |
put(Object id,
Object value)
Puts an item in this cache.
|
void |
put(Object id,
S_LibraryObjectData lodata)
Puts an item in this cache.
|
void |
remove(Object id)
Removes an item from this cache.
|
void |
reset()
Resets this cache.
|
void |
resetCachePerformance()
Resets the performance information for this cache.
|
protected void |
scheduleEvent(IfsEvent event)
Schedules a committed or rolled-back event for the specified uncommitted
event.
|
protected void |
scheduleRawAuditEvent(AuditExecutor.PreparedRawAuditEvent rawEvent,
int postMode)
Schedules an AuditEvent, to be created as success if the transaction
completes normally, or as a failure if the transaction aborts.
|
void |
setCacheConfiguration(CacheConfiguration config)
Alters the configuration of this cache.
|
getCacheConfiguration, getElements
protected S_LibrarySession m_Session
protected LooselyBoundedCache m_CommittedLibraryObjectDataCache
protected Vector m_Frames
protected long m_HitCount
protected long m_MissCount
protected long m_PutCount
protected long m_RemoveCount
public UncommittedLibraryObjectDataCache(UncommittedLibraryObjectDataCacheConfiguration config) throws IfsException
config
- the configuration paramaters for the new cacheIfsException
- if the operation failspublic final void setCacheConfiguration(CacheConfiguration config) throws IfsException
No configuration parameters of an UncommittedLibraryObjectDataCache are updateable. Consequently, this method is a no-op.
setCacheConfiguration
in class Cache
config
- the configuration parametersIfsException
- if the operation failspublic final void put(Object id, Object value) throws IfsException
put
in class Cache
id
- the item idvalue
- the itemIfsException
- if operation failspublic final void put(Object id, S_LibraryObjectData lodata) throws IfsException
id
- the item idlodata
- the S_LibraryObjectDataIfsException
- if operation failspublic final void lock(Object id, Object value) throws IfsException
id
- the item idvalue
- the itemIfsException
- if operation failspublic final void lock(Object id, S_LibraryObjectData lodata) throws IfsException
id
- the item idlodata
- the S_LibraryObjectDataIfsException
- if operation failspublic final void remove(Object id) throws IfsException
remove
in class Cache
id
- the item idIfsException
- if operation failspublic final Object find(Object id) throws IfsException
find
in class Cache
id
- the item idIfsException
- if operation failspublic final boolean isMarkedDirty(Object id) throws IfsException
id
- the item idIfsException
- if operation failspublic final CachePerformance getCachePerformance()
getCachePerformance
in class Cache
public final void resetCachePerformance()
resetCachePerformance
in class Cache
public void reset()
This causes the cache to be emptied and its performance information to be reset.
public void dispose()
After the cache is disposed, it is invalid to use this cache.
protected final void scheduleEvent(IfsEvent event) throws IfsException
event
- the uncommitted eventIfsException
- if the operation failsprotected final void scheduleRawAuditEvent(AuditExecutor.PreparedRawAuditEvent rawEvent, int postMode) throws IfsException
rawEvent
- the raw audit eventpostMode
- the post mode for the eventIfsException
- if the operation failsprotected final void markDirty(Long id, Long classId, int eventType) throws IfsException
id
- the idclassId
- the class ideventType
- the event type that caused the data to be dirtyIfsException
- if the operation failsprotected void invalidateSharedState(IfsEvent event) throws IfsException
event
- event causing shared state invalidationIfsException
- if the operation failsprotected final void beginTransaction(Transaction transaction) throws IfsException
transaction
- the new transactionIfsException
- if the operation failsprotected final void abortTransaction(Transaction transaction) throws IfsException
transaction
- the transactionIfsException
- if the operation failsprotected final void completeTransaction(Transaction transaction, LibraryConnection lconn) throws IfsException
transaction
- the transactionlconn
- a writeable library connection to use for posting
audit events, or null to use an auxiliary connectionIfsException
- if the operation failsCopyright © 2023. All rights reserved.