Top Description Fields Constructors Methods
net.sf.ehcache.terracotta

public Class TerracottaClient

extends Object
Class Inheritance
Imports
net.sf.ehcache.CacheException, .CacheManager, net.sf.ehcache.cluster.CacheCluster, net.sf.ehcache.config.TerracottaClientConfiguration, org.slf4j.Logger, .LoggerFactory, java.lang.reflect.Method, java.util.concurrent.ExecutorService, .Executors, .ThreadFactory

Class encapsulating the idea of a Terracotta client. Provides access to the ClusteredInstanceFactory for the cluster
Author
Abhishek Sanoujam

Field Summary

Modifier and TypeField and Description
private final TerracottaCacheCluster
private final CacheManager
private volatile ClusteredInstanceFactoryWrapper
public static final String
CUSTOM_SECRET_PROVIDER_SYSTEM_PROPERTY

System property used to specify the secrect provider to use

private static final String
private ExecutorService
private static final Logger
private static final int
private final TerracottaClientConfiguration

Constructor Summary

AccessConstructor and Description
public
TerracottaClient(CacheManager
the cache manager to be clustered
cacheManager
,
TerracottaClientConfiguration
the configuration for the terracotta client
terracottaClientConfiguration
)

Constructor accepting the CacheManager and the TerracottaClientConfiguration

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the clusteredInstanceFactory was created, otherwise returns false
createClusteredInstanceFactory
()

Returns true if the clusteredInstanceFactory was created, otherwise returns false.

private synchronized ClusteredInstanceFactoryWrapper
private void
public TerracottaCacheCluster

Returns:

the CacheCluster associated with this client
getCacheCluster
()

Get the CacheCluster associated with this client

private String
public ClusteredInstanceFactory

Returns:

The ClusteredInstanceFactory
getClusteredInstanceFactory
()

Returns the ClusteredInstanceFactory associated with this client

private synchronized ExecutorService
private String
private void
info(String msg)

private void
private static void
public synchronized void
shutdown()

Shuts down the client

private void
public void
waitForOrchestrator(String
Name of the cache manager
cacheManagerName
)

Wait for the Orchestrator for this CacheManager

private void
warn(String msg)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheClusterback to summary
private final TerracottaCacheCluster cacheCluster
cacheManagerback to summary
private final CacheManager cacheManager
clusteredInstanceFactoryback to summary
private volatile ClusteredInstanceFactoryWrapper clusteredInstanceFactory
CUSTOM_SECRET_PROVIDER_SYSTEM_PROPERTYback to summary
public static final String CUSTOM_SECRET_PROVIDER_SYSTEM_PROPERTY

System property used to specify the secrect provider to use

CUSTOM_SECRET_PROVIDER_WRAPPER_CLASSNAMEback to summary
private static final String CUSTOM_SECRET_PROVIDER_WRAPPER_CLASSNAME
l1TerminatorThreadPoolback to summary
private ExecutorService l1TerminatorThreadPool
LOGGERback to summary
private static final Logger LOGGER
REJOIN_SLEEP_MILLIS_ON_EXCEPTIONback to summary
private static final int REJOIN_SLEEP_MILLIS_ON_EXCEPTION
terracottaClientConfigurationback to summary
private final TerracottaClientConfiguration terracottaClientConfiguration

Constructor Detail

TerracottaClientback to summary
public TerracottaClient(CacheManager cacheManager, TerracottaClientConfiguration terracottaClientConfiguration)

Constructor accepting the CacheManager and the TerracottaClientConfiguration

Parameters
cacheManager:CacheManager

the cache manager to be clustered

terracottaClientConfiguration:TerracottaClientConfiguration

the configuration for the terracotta client

Method Detail

createClusteredInstanceFactoryback to summary
public boolean createClusteredInstanceFactory()

Returns true if the clusteredInstanceFactory was created, otherwise returns false. Multiple threads calling this method block and only one of them creates the factory.

Returns:boolean

true if the clusteredInstanceFactory was created, otherwise returns false

createNewClusteredInstanceFactoryback to summary
private synchronized ClusteredInstanceFactoryWrapper createNewClusteredInstanceFactory()
debugback to summary
private void debug(String msg)
getCacheClusterback to summary
public TerracottaCacheCluster getCacheCluster()

Get the CacheCluster associated with this client

Returns:TerracottaCacheCluster

the CacheCluster associated with this client

getCacheManagerNameback to summary
private String getCacheManagerName()
getClusteredInstanceFactoryback to summary
public ClusteredInstanceFactory getClusteredInstanceFactory()

Returns the ClusteredInstanceFactory associated with this client

Returns:ClusteredInstanceFactory

The ClusteredInstanceFactory

getL1TerminatorThreadPoolback to summary
private synchronized ExecutorService getL1TerminatorThreadPool()
getLogPrefixback to summary
private String getLogPrefix()
infoback to summary
private void info(String msg)
infoback to summary
private void info(String msg, Throwable t)
setTestModeback to summary
private static void setTestMode(TerracottaClusteredInstanceHelper testHelper)
shutdownback to summary
public synchronized void shutdown()

Shuts down the client

shutdownClusteredInstanceFactoryWrapperback to summary
private void shutdownClusteredInstanceFactoryWrapper(ClusteredInstanceFactoryWrapper clusteredInstanceFactory)
waitForOrchestratorback to summary
public void waitForOrchestrator(String cacheManagerName)

Wait for the Orchestrator for this CacheManager

Parameters
cacheManagerName:String

Name of the cache manager

warnback to summary
private void warn(String msg)