Package net.sf.ehcache.terracotta
Class ClusteredInstanceFactoryWrapper
- java.lang.Object
-
- net.sf.ehcache.terracotta.ClusteredInstanceFactoryWrapper
-
- All Implemented Interfaces:
ClusteredInstanceFactory
public class ClusteredInstanceFactoryWrapper extends java.lang.Object implements ClusteredInstanceFactory
AClusteredInstanceFactoryimplementation that delegates all operations to an underlying delegate except for the following operations:getTopology(): Delegates to theTerracottaClient.getCacheCluster()
- Author:
- Abhishek Sanoujam
-
-
Constructor Summary
Constructors Constructor Description ClusteredInstanceFactoryWrapper(TerracottaClient client, ClusteredInstanceFactory delegate)Constructor accepting the TerracottaClient and the actual factory
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CacheEventListenercreateEventReplicator(Ehcache cache)Create a replicator for the cache events of a given cacheManagementEventSinkcreateEventSink()Create a management event sinkTerracottaStorecreateNonStopStore(java.util.concurrent.Callable<TerracottaStore> store, Ehcache cache)Create a NonStopStoreWrapper for a terracottaStoreStorecreateStore(Ehcache cache)Create a Store instance for the given cacheTransactionIDFactorycreateTransactionIDFactory(java.lang.String uuid, java.lang.String cacheManagerName)Create a TransactionIDFactoryWriteBehindcreateWriteBehind(Ehcache cache)Create an WriteBehind instance for the given cachebooleandestroyCache(java.lang.String cacheManagerName, java.lang.String cacheName)Destroys the specified cachevoidenableNonStopForCurrentThread(boolean enable)Enable or disable NonStop for the current thread only.protected ClusteredInstanceFactorygetActualFactory()Returns the actual underlying factorySoftLockManagergetOrCreateSoftLockManager(Ehcache cache)Create a SoftLockManager for a cacheCacheClustergetTopology()Get an api for looking at the clustered node topology.java.lang.StringgetUUID()Returns a universally unique identifiers for this factory.voidlinkClusteredCacheManager(java.lang.String cacheManagerName, Configuration configuration)Links this cache manager to the clustervoidshutdown()Cleans up any resources left behind after the shutdown of the associated CacheManagervoidunlinkCache(java.lang.String cacheName)Un-links the cache from its cluster entityvoidwaitForOrchestrator(java.lang.String cacheManagerName)Wait until the Orchestrator is running for the given CacheManager
-
-
-
Constructor Detail
-
ClusteredInstanceFactoryWrapper
public ClusteredInstanceFactoryWrapper(TerracottaClient client, ClusteredInstanceFactory delegate)
Constructor accepting the TerracottaClient and the actual factory- Parameters:
client-delegate-
-
-
Method Detail
-
getActualFactory
protected ClusteredInstanceFactory getActualFactory()
Returns the actual underlying factory- Returns:
- the actual underlying factory
-
getTopology
public CacheCluster getTopology()
Get an api for looking at the clustered node topology.- Specified by:
getTopologyin interfaceClusteredInstanceFactory
-
getUUID
public java.lang.String getUUID()
Returns a universally unique identifiers for this factory.- Specified by:
getUUIDin interfaceClusteredInstanceFactory- Returns:
- the identifier as a string
-
enableNonStopForCurrentThread
public void enableNonStopForCurrentThread(boolean enable)
Enable or disable NonStop for the current thread only.- Specified by:
enableNonStopForCurrentThreadin interfaceClusteredInstanceFactory- Parameters:
enable- true to enable NonStop, false otherwise.
-
createEventReplicator
public CacheEventListener createEventReplicator(Ehcache cache)
Create a replicator for the cache events of a given cache- Specified by:
createEventReplicatorin interfaceClusteredInstanceFactory- Parameters:
cache- the cache to which the replicator will be bound- Returns:
- cache event replicator
-
createStore
public Store createStore(Ehcache cache)
Create a Store instance for the given cache- Specified by:
createStorein interfaceClusteredInstanceFactory- Parameters:
cache- the cache will backed by the returned store- Returns:
- store instance
-
createTransactionIDFactory
public TransactionIDFactory createTransactionIDFactory(java.lang.String uuid, java.lang.String cacheManagerName)
Create a TransactionIDFactory- Specified by:
createTransactionIDFactoryin interfaceClusteredInstanceFactory- Parameters:
uuid- a UUID unique to the clustercacheManagerName- the name of the cache manager creating a TransactionIDFactory- Returns:
- a TransactionIDFactory
-
createWriteBehind
public WriteBehind createWriteBehind(Ehcache cache)
Create an WriteBehind instance for the given cache- Specified by:
createWriteBehindin interfaceClusteredInstanceFactory- Parameters:
cache- the cache to which the write behind will be tied- Returns:
- write behind instance
-
getOrCreateSoftLockManager
public SoftLockManager getOrCreateSoftLockManager(Ehcache cache)
Create a SoftLockManager for a cache- Specified by:
getOrCreateSoftLockManagerin interfaceClusteredInstanceFactory- Parameters:
cache- the cache for which to create a SoftLockManager- Returns:
- a SoftLockManager
-
shutdown
public void shutdown()
Cleans up any resources left behind after the shutdown of the associated CacheManager- Specified by:
shutdownin interfaceClusteredInstanceFactory
-
createNonStopStore
public TerracottaStore createNonStopStore(java.util.concurrent.Callable<TerracottaStore> store, Ehcache cache)
Description copied from interface:ClusteredInstanceFactoryCreate a NonStopStoreWrapper for a terracottaStore- Specified by:
createNonStopStorein interfaceClusteredInstanceFactory- Parameters:
store- the store for which to create a NonStopStore- Returns:
- a NonStopStore
-
destroyCache
public boolean destroyCache(java.lang.String cacheManagerName, java.lang.String cacheName)Description copied from interface:ClusteredInstanceFactoryDestroys the specified cache- Specified by:
destroyCachein interfaceClusteredInstanceFactory- Parameters:
cacheManagerName- name of the cache manager the cache belongs tocacheName- name of the cache- Returns:
- true if the cache existed before being destroyed
-
linkClusteredCacheManager
public void linkClusteredCacheManager(java.lang.String cacheManagerName, Configuration configuration)Description copied from interface:ClusteredInstanceFactoryLinks this cache manager to the cluster- Specified by:
linkClusteredCacheManagerin interfaceClusteredInstanceFactory- Parameters:
cacheManagerName- the name of the cache managerconfiguration- the cache manager configuration
-
unlinkCache
public void unlinkCache(java.lang.String cacheName)
Description copied from interface:ClusteredInstanceFactoryUn-links the cache from its cluster entity- Specified by:
unlinkCachein interfaceClusteredInstanceFactory- Parameters:
cacheName- the cache to unlink
-
createEventSink
public ManagementEventSink createEventSink()
Description copied from interface:ClusteredInstanceFactoryCreate a management event sink- Specified by:
createEventSinkin interfaceClusteredInstanceFactory- Returns:
- a management event sink
-
waitForOrchestrator
public void waitForOrchestrator(java.lang.String cacheManagerName)
Wait until the Orchestrator is running for the given CacheManager- Specified by:
waitForOrchestratorin interfaceClusteredInstanceFactory- Parameters:
cacheManagerName- name of the CacheManager
-
-