org.axonframework.cache
Class AbstractCacheAdapter<L>

java.lang.Object
  extended by org.axonframework.cache.AbstractCacheAdapter<L>
Type Parameters:
L - The type of event listener the cache uses
All Implemented Interfaces:
Cache
Direct Known Subclasses:
EhCacheAdapter, JCacheAdapter

public abstract class AbstractCacheAdapter<L>
extends Object
implements Cache

Abstract implementation of the Cache interface which makes it easier to implement Adapters.

Since:
2.1.2
Author:
Allard Buijze

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.axonframework.cache.Cache
Cache.EntryListener, Cache.EntryListenerAdapter
 
Constructor Summary
AbstractCacheAdapter()
           
 
Method Summary
protected abstract  L createListenerAdapter(Cache.EntryListener cacheEntryListener)
          Creates an adapter for the given cacheEntryListener.
protected abstract  void doRegisterListener(L listenerAdapter)
          Registers the given listener with the cache implementation
protected abstract  void doUnregisterListener(L listenerAdapter)
          Unregisters the given listener with the cache
 void registerCacheEntryListener(Cache.EntryListener entryListener)
          Registers the given cacheEntryListener to listen for Cache changes.
 void unregisterCacheEntryListener(Cache.EntryListener entryListener)
          Unregisters the previously registered cacheEntryListener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.axonframework.cache.Cache
containsKey, get, put, putIfAbsent, remove
 

Constructor Detail

AbstractCacheAdapter

public AbstractCacheAdapter()
Method Detail

createListenerAdapter

protected abstract L createListenerAdapter(Cache.EntryListener cacheEntryListener)
Creates an adapter for the given cacheEntryListener. The adapter must forward all incoming notifications to the respective methods on the cacheEntryListener.

Parameters:
cacheEntryListener - The listener to create an adapter for
Returns:
an adapter that forwards notifications

registerCacheEntryListener

public void registerCacheEntryListener(Cache.EntryListener entryListener)
Description copied from interface: Cache
Registers the given cacheEntryListener to listen for Cache changes.

Specified by:
registerCacheEntryListener in interface Cache
Parameters:
entryListener - The listener to register

unregisterCacheEntryListener

public void unregisterCacheEntryListener(Cache.EntryListener entryListener)
Description copied from interface: Cache
Unregisters the previously registered cacheEntryListener.

Specified by:
unregisterCacheEntryListener in interface Cache
Parameters:
entryListener - The listener to unregister

doUnregisterListener

protected abstract void doUnregisterListener(L listenerAdapter)
Unregisters the given listener with the cache

Parameters:
listenerAdapter - The listener to register with the cache

doRegisterListener

protected abstract void doRegisterListener(L listenerAdapter)
Registers the given listener with the cache implementation

Parameters:
listenerAdapter - the listener to register


Copyright © 2010-2016. All Rights Reserved.