ehcache

net.sf.ehcache.terracotta
Class ClusteredInstanceFactoryWrapper

java.lang.Object
  extended by net.sf.ehcache.terracotta.ClusteredInstanceFactoryWrapper
All Implemented Interfaces:
ClusteredInstanceFactory

public class ClusteredInstanceFactoryWrapper
extends Object
implements ClusteredInstanceFactory

A ClusteredInstanceFactory implementation that delegates all operations to an underlying delegate except for the following operations:

Author:
Abhishek Sanoujam

Constructor Summary
ClusteredInstanceFactoryWrapper(TerracottaClient client, ClusteredInstanceFactory delegate)
          Constructor accepting the TerracottaClient and the actual factory
 
Method Summary
 CacheEventListener createEventReplicator(Ehcache cache)
          Create a replicator for the cache events of a given cache
 ManagementEventSink createEventSink()
          Create a management event sink
 TerracottaStore createNonStopStore(Callable<TerracottaStore> store, Ehcache cache)
          Create a NonStopStoreWrapper for a terracottaStore
 Store createStore(Ehcache cache)
          Create a Store instance for the given cache
 TransactionIDFactory createTransactionIDFactory(String uuid, String cacheManagerName)
          Create a TransactionIDFactory
 WriteBehind createWriteBehind(Ehcache cache)
          Create an WriteBehind instance for the given cache
 boolean destroyCache(String cacheManagerName, String cacheName)
          Destroys the specified cache
 void enableNonStopForCurrentThread(boolean enable)
          Enable or disable NonStop for the current thread only.
protected  ClusteredInstanceFactory getActualFactory()
          Returns the actual underlying factory
 SoftLockManager getOrCreateSoftLockManager(Ehcache cache)
          Create a SoftLockManager for a cache
 CacheCluster getTopology()
          Get an api for looking at the clustered node topology.
 String getUUID()
          Returns a universally unique identifiers for this factory.
 void linkClusteredCacheManager(String cacheManagerName, Configuration configuration)
          Links this cache manager to the cluster
 void shutdown()
          Cleans up any resources left behind after the shutdown of the associated CacheManager
 void unlinkCache(String cacheName)
          Un-links the cache from its cluster entity
 void waitForOrchestrator(String cacheManagerName)
          Wait until the Orchestrator is running for the given CacheManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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:
getTopology in interface ClusteredInstanceFactory

getUUID

public String getUUID()
Returns a universally unique identifiers for this factory.

Specified by:
getUUID in interface ClusteredInstanceFactory
Returns:
the identifier as a string

enableNonStopForCurrentThread

public void enableNonStopForCurrentThread(boolean enable)
Enable or disable NonStop for the current thread only.

Specified by:
enableNonStopForCurrentThread in interface ClusteredInstanceFactory
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:
createEventReplicator in interface ClusteredInstanceFactory
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:
createStore in interface ClusteredInstanceFactory
Parameters:
cache - the cache will backed by the returned store
Returns:
store instance

createTransactionIDFactory

public TransactionIDFactory createTransactionIDFactory(String uuid,
                                                       String cacheManagerName)
Create a TransactionIDFactory

Specified by:
createTransactionIDFactory in interface ClusteredInstanceFactory
Parameters:
uuid - a UUID unique to the cluster
cacheManagerName - 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:
createWriteBehind in interface ClusteredInstanceFactory
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:
getOrCreateSoftLockManager in interface ClusteredInstanceFactory
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:
shutdown in interface ClusteredInstanceFactory

createNonStopStore

public TerracottaStore createNonStopStore(Callable<TerracottaStore> store,
                                          Ehcache cache)
Description copied from interface: ClusteredInstanceFactory
Create a NonStopStoreWrapper for a terracottaStore

Specified by:
createNonStopStore in interface ClusteredInstanceFactory
Parameters:
store - the store for which to create a NonStopStore
Returns:
a NonStopStore

destroyCache

public boolean destroyCache(String cacheManagerName,
                            String cacheName)
Description copied from interface: ClusteredInstanceFactory
Destroys the specified cache

Specified by:
destroyCache in interface ClusteredInstanceFactory
Parameters:
cacheManagerName - name of the cache manager the cache belongs to
cacheName - name of the cache
Returns:
true if the cache existed before being destroyed

linkClusteredCacheManager

public void linkClusteredCacheManager(String cacheManagerName,
                                      Configuration configuration)
Description copied from interface: ClusteredInstanceFactory
Links this cache manager to the cluster

Specified by:
linkClusteredCacheManager in interface ClusteredInstanceFactory
Parameters:
cacheManagerName - the name of the cache manager
configuration - the cache manager configuration

unlinkCache

public void unlinkCache(String cacheName)
Description copied from interface: ClusteredInstanceFactory
Un-links the cache from its cluster entity

Specified by:
unlinkCache in interface ClusteredInstanceFactory
Parameters:
cacheName - the cache to unlink

createEventSink

public ManagementEventSink createEventSink()
Description copied from interface: ClusteredInstanceFactory
Create a management event sink

Specified by:
createEventSink in interface ClusteredInstanceFactory
Returns:
a management event sink

waitForOrchestrator

public void waitForOrchestrator(String cacheManagerName)
Wait until the Orchestrator is running for the given CacheManager

Specified by:
waitForOrchestrator in interface ClusteredInstanceFactory
Parameters:
cacheManagerName - name of the CacheManager

ehcache

Copyright 2001-2015, Terracotta, Inc.