Package de.caluga.morphium.cache
Class MessagingCacheSynchronizer
java.lang.Object
de.caluga.morphium.cache.AbstractCacheSynchronizer<MessagingCacheSyncListener>
de.caluga.morphium.cache.MessagingCacheSynchronizer
- All Implemented Interfaces:
MessageListener,MorphiumStorageListener<Object>
public class MessagingCacheSynchronizer
extends AbstractCacheSynchronizer<MessagingCacheSyncListener>
implements MessageListener, MorphiumStorageListener<Object>
User: Stephan Bösebeck
Date: 27.05.12
Time: 14:14
Connects to the Messaging system and to morphium. As soon as there is a message coming with name "cacheSync", this
is responsible for clearing the local cache for this entity.
Messaging used:
- Msg.name == Always cacheSync
- Msg.type == Always multi - more than one node may listen to those messages
- Msg.msg == The messag is the Reason for clearing (remove, store, user interaction...)
- Msg.value == String, name of the class whose cache should be cleared
- Msg.additional == always null
- Msg.ttl == 30 sec - shoule be enought time for the message to be processed by all nodes
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.caluga.morphium.MorphiumStorageListener
MorphiumStorageListener.UpdateTypes -
Field Summary
FieldsFields inherited from class de.caluga.morphium.cache.AbstractCacheSynchronizer
listenerForType, listeners, log, morphium -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddetach()voidvoidvoidfirePostSendEvent(Class type, Msg m) voidfirePreSendEvent(Class type, Msg m) booleanbooleanprocess message, send answer if null is returned, no answer is sentvoidvoidvoidvoidpostRemove(Morphium m, Query q) voidpostRemove(Morphium m, Object r) voidpostRemove(Morphium m, List<Object> lst) voidvoidvoidpostUpdate(Morphium m, Class cls, Enum updateType) voidvoidvoidvoidvoidvoidvoidsendClearAllMessage(String reason) voidsendClearMessage(Class type, String reason) voidsendClearMessage(Class type, String reason, boolean force) sends message if necessaryvoidsendClearMessage(String reason, Map<Object, Boolean> isNew) voidsetCommitMessage(boolean msg) Methods inherited from class de.caluga.morphium.cache.AbstractCacheSynchronizer
addSyncListener, addSyncListener, firePostClearEvent, firePreClearEvent, removeSyncListener, removeSyncListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.caluga.morphium.messaging.MessageListener
markAsProcessedBeforeExec
-
Field Details
-
CACHE_SYNC_TYPE
- See Also:
-
CACHE_SYNC_RECORD
- See Also:
-
-
Constructor Details
-
MessagingCacheSynchronizer
- Parameters:
msg- - primary messaging, will attach to and send messages overmorphium- - the underlying morphium instance
-
-
Method Details
-
sendClearMessage
-
sendClearMessage
-
sendClearMessage
sends message if necessary- Parameters:
type- - typereason- - reason
-
detach
public void detach() -
isAttached
public boolean isAttached() -
sendClearAllMessage
-
preStore
- Specified by:
preStorein interfaceMorphiumStorageListener<Object>- Throws:
MorphiumAccessVetoException
-
preStore
- Specified by:
preStorein interfaceMorphiumStorageListener<Object>- Throws:
MorphiumAccessVetoException
-
postStore
- Specified by:
postStorein interfaceMorphiumStorageListener<Object>
-
postStore
- Specified by:
postStorein interfaceMorphiumStorageListener<Object>- Throws:
MorphiumAccessVetoException
-
postDrop
- Specified by:
postDropin interfaceMorphiumStorageListener<Object>
-
preDrop
- Specified by:
preDropin interfaceMorphiumStorageListener<Object>
-
postRemove
- Specified by:
postRemovein interfaceMorphiumStorageListener<Object>
-
postRemove
- Specified by:
postRemovein interfaceMorphiumStorageListener<Object>
-
firePostSendEvent
-
firePreSendEvent
- Throws:
CacheSyncVetoException
-
preRemove
- Specified by:
preRemovein interfaceMorphiumStorageListener<Object>- Throws:
MorphiumAccessVetoException
-
preRemove
- Specified by:
preRemovein interfaceMorphiumStorageListener<Object>- Throws:
MorphiumAccessVetoException
-
postLoad
- Specified by:
postLoadin interfaceMorphiumStorageListener<Object>- Throws:
MorphiumAccessVetoException
-
postLoad
- Specified by:
postLoadin interfaceMorphiumStorageListener<Object>- Throws:
MorphiumAccessVetoException
-
preUpdate
- Specified by:
preUpdatein interfaceMorphiumStorageListener<Object>- Throws:
MorphiumAccessVetoException
-
postRemove
- Specified by:
postRemovein interfaceMorphiumStorageListener<Object>
-
postUpdate
- Specified by:
postUpdatein interfaceMorphiumStorageListener<Object>
-
onMessage
Description copied from interface:MessageListenerprocess message, send answer if null is returned, no answer is sent- Specified by:
onMessagein interfaceMessageListener
-
disableCommitMessages
public void disableCommitMessages() -
enableCommitMessages
public void enableCommitMessages() -
setCommitMessage
public void setCommitMessage(boolean msg) -
isCommitMessages
public boolean isCommitMessages()
-