Class RemoteCacheNoWaitFacade<K,V>
- All Implemented Interfaces:
AuxiliaryCache<K,
,V> ICache<K,
,V> ICacheType
Typically, we only connect to one remote server per facade. We use a list of one RemoteCacheNoWait.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.commons.jcs3.engine.behavior.ICacheType
ICacheType.CacheType
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
Attempt to restore primary connection (switched off for testing)Fields inherited from class org.apache.commons.jcs3.auxiliary.remote.AbstractRemoteCacheNoWaitFacade
noWaits
Fields inherited from interface org.apache.commons.jcs3.engine.behavior.ICache
NAME_COMPONENT_DELIMITER
-
Constructor Summary
ConstructorsConstructorDescriptionRemoteCacheNoWaitFacade
(List<RemoteCacheNoWait<K, V>> noWaits, IRemoteCacheAttributes rca, ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer, RemoteCacheFactory cacheFactory) Constructs with the given remote cache, and fires events to any listeners. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
The thread tries to establish a connection with a failover server, if any are defined.protected void
failover
(RemoteCacheNoWait<K, V> rcnw) Begin the failover process if this is a local cache.Methods inherited from class org.apache.commons.jcs3.auxiliary.remote.AbstractRemoteCacheNoWaitFacade
dispose, get, getAuxiliaryCacheAttributes, getCacheName, getCacheType, getEventLoggingExtraInfo, getKeySet, getMatching, getMultiple, getPrimaryServer, getSize, getStatistics, getStats, getStatus, remove, removeAll, restorePrimaryServer, toString, update
Methods inherited from class org.apache.commons.jcs3.auxiliary.AbstractAuxiliaryCache
createICacheEvent, createICacheEvent, getCacheEventLogger, getElementSerializer, getKeyMatcher, logApplicationEvent, logError, logICacheEvent, processGetMultiple, setCacheEventLogger, setElementSerializer, setKeyMatcher
-
Field Details
-
attemptRestorePrimary
Attempt to restore primary connection (switched off for testing)
-
-
Constructor Details
-
RemoteCacheNoWaitFacade
public RemoteCacheNoWaitFacade(List<RemoteCacheNoWait<K, V>> noWaits, IRemoteCacheAttributes rca, ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer, RemoteCacheFactory cacheFactory) Constructs with the given remote cache, and fires events to any listeners.- Parameters:
noWaits
-rca
-cacheEventLogger
-elementSerializer
-cacheFactory
-
-
-
Method Details
-
failover
Begin the failover process if this is a local cache. Clustered remote caches do not failover.- Specified by:
failover
in classAbstractRemoteCacheNoWaitFacade<K,
V> - Parameters:
rcnw
- The no wait in error.
-
connectAndRestore
The thread tries to establish a connection with a failover server, if any are defined. Once a failover connection is made, it will attempt to replace the failover with the primary remote server.It works by switching out the RemoteCacheNoWait inside the Facade.
Client (i.e.) the CompositeCache has reference to a RemoteCacheNoWaitFacade. This facade is created by the RemoteCacheFactory. The factory maintains a set of managers, one for each remote server. Typically, there will only be one manager.
If you use multiple remote servers, you may want to set one or more as failovers. If a local cache cannot connect to the primary server, or looses its connection to the primary server, it will attempt to restore that Connection in the background. If failovers are defined, the Failover runner will try to connect to a failover until the primary is restored. If no failovers are defined, this will exit automatically.
- Since:
- 3.1
-