|
Protege 3.4.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.smi.protege.server.update.DeferredTransactionsCache
public class DeferredTransactionsCache
This is a hacky cache designed to solve two problems seen by the remote client frame store. First, 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. However, since this cache will only be used by the invoker, I believe that all this badness is countered by flushing the cache when the invokers transaction completes. I also believe that all transactions will be closed when this flush is called making it a clean flush. This is true because the server sends the begin and end of transactions made by other clients (not the invoker) in a group. Second, the begin/commit/rollback transaction operations apply to all the frame caches 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.
Constructor Summary | |
---|---|
DeferredTransactionsCache(Cache<RemoteSession,Sft,List> delegate,
RemoteSession invoker,
int invokersTransactionNesting,
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 |
delete(RemoteSession session)
This notifies the cache that the caller has made deleted the object that this cache represents. |
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. |
boolean |
isCacheComplete()
|
boolean |
isDeleted()
This indicates that the cache has entered the deleted state. |
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 DeferredTransactionsCache(Cache<RemoteSession,Sft,List> delegate, RemoteSession invoker, int invokersTransactionNesting, 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 delete(RemoteSession session)
Cache
delete
in interface Cache<RemoteSession,Sft,List>
public boolean isDeleted()
Cache
isDeleted
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.4.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |