|
Protege 3.5 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.smi.protege.server.update.DeferredOperationCache
public class DeferredOperationCache
Certain operations, most noteably begin/commit/rollback transaction apply to all the cache's in the RemoteClientFrameStore. It is clear that updating all of these caches on such an operation is expensive. So we defer telling the frame caches about transaction operations until that cache is needed. The RemoteClientFrameStore uses a Fifo writer to track the transactions that have not been seen by its various caches. When this cache is needed it can read through all the transaction operations that it has not seen and it will be ready to perform the needed operation.
Also, it is sometimes necessary to start a cache when the invoker is already in a transaction. This is bad. It can lead to incorrect data in the untransacted cache and missing rollbacks. This situation should be taken care of by the InvalidatableCache which commits suicide when it noties a transaction with nesting less than 0.
Constructor Summary | |
---|---|
DeferredOperationCache(Cache<RemoteSession,Sft,List> delegate,
FifoReader<SerializedCacheUpdate<RemoteSession,Sft,List>> transactionUpdates)
|
Method Summary | |
---|---|
void |
abortCompleteCache()
|
void |
beginTransaction(RemoteSession session)
The session has entered a transaction. |
void |
commitTransaction(RemoteSession session)
A transaction is committed. |
void |
finishCompleteCache()
The startCompleteCache and the finishCompleteCache are part of a protocol. |
void |
flush()
Try to avoid this. |
int |
getCacheId()
This method returns a unique id for each cache. |
int |
getTransactionNesting(RemoteSession session)
Returns the transaction nesting for a session. |
void |
invalidate(RemoteSession session)
This notifies the cache that this cache is now invalid either because the object that this cache represents is deleted or for any other reason. |
boolean |
isCacheComplete()
|
boolean |
isInvalid()
This indicates that the cache has entered the deleted state or is otherwise invalid. |
void |
modifyCache(RemoteSession session,
Sft var)
This notifies the cache, that the caller has made a change to the value of the var. |
void |
modifyCache(RemoteSession session,
Sft var,
List value)
This notifies the cache that the caller has made a change to the value of var and that the caller knows the new value is value. |
CacheResult<List> |
readCache(RemoteSession session,
Sft var)
If the variable var is cached then this returns the cached value. |
void |
rollbackTransaction(RemoteSession session)
A transaction is rolled back. |
void |
startCompleteCache()
The startCompleteCache and the finishCompleteCache are part of a protocol. |
void |
updateCache(RemoteSession session,
Sft var)
This call indicates that a read was scheduled but no useful value was retrieved. |
void |
updateCache(RemoteSession session,
Sft var,
List value)
The caller has received an update that the new value of var is value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DeferredOperationCache(Cache<RemoteSession,Sft,List> delegate, FifoReader<SerializedCacheUpdate<RemoteSession,Sft,List>> transactionUpdates)
Method Detail |
---|
public CacheResult<List> readCache(RemoteSession session, Sft var)
Cache
CacheResult result = cache.readCache(session, var); if (result.isValid()) { return result.getValue(); else { go to the source to find the right value }works and is the recommended approach.
readCache
in interface Cache<RemoteSession,Sft,List>
var
- a variable
public void updateCache(RemoteSession session, Sft var)
Cache
updateCache
in interface Cache<RemoteSession,Sft,List>
session
- the session making the changepublic void updateCache(RemoteSession session, Sft var, List value)
Cache
updateCache
in interface Cache<RemoteSession,Sft,List>
session
- the session making the changepublic void modifyCache(RemoteSession session, Sft var)
Cache
modifyCache
in interface Cache<RemoteSession,Sft,List>
session
- the session making the changevar
- the variable being modified.public void modifyCache(RemoteSession session, Sft var, List value)
Cache
modifyCache
in interface Cache<RemoteSession,Sft,List>
session
- the session making the changevar
- the variable being changedvalue
- the new value for the variablepublic void invalidate(RemoteSession session)
Cache
invalidate
in interface Cache<RemoteSession,Sft,List>
public boolean isInvalid()
Cache
isInvalid
in interface Cache<RemoteSession,Sft,List>
public void flush()
Cache
flush
in interface Cache<RemoteSession,Sft,List>
public void startCompleteCache()
Cache
startCompleteCache
in interface Cache<RemoteSession,Sft,List>
public void finishCompleteCache()
Cache
finishCompleteCache
in interface Cache<RemoteSession,Sft,List>
public void abortCompleteCache()
abortCompleteCache
in interface Cache<RemoteSession,Sft,List>
public boolean isCacheComplete()
isCacheComplete
in interface Cache<RemoteSession,Sft,List>
public void beginTransaction(RemoteSession session)
Cache
beginTransaction
in interface Cache<RemoteSession,Sft,List>
public void commitTransaction(RemoteSession session)
Cache
commitTransaction
in interface Cache<RemoteSession,Sft,List>
public void rollbackTransaction(RemoteSession session)
Cache
rollbackTransaction
in interface Cache<RemoteSession,Sft,List>
public int getTransactionNesting(RemoteSession session)
Cache
getTransactionNesting
in interface Cache<RemoteSession,Sft,List>
public int getCacheId()
Cache
getCacheId
in interface Cache<RemoteSession,Sft,List>
|
Protege 3.5 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |