Package net.rubyeye.xmemcached.impl
Class ElectionMemcachedSessionLocator
- java.lang.Object
-
- net.rubyeye.xmemcached.impl.AbstractMemcachedSessionLocator
-
- net.rubyeye.xmemcached.impl.ElectionMemcachedSessionLocator
-
- All Implemented Interfaces:
MemcachedSessionLocator
public class ElectionMemcachedSessionLocator extends AbstractMemcachedSessionLocator
Election hash strategy
-
-
Field Summary
Fields Modifier and Type Field Description private HashAlgorithmhashAlgorithmprivate java.util.List<Session>sessions-
Fields inherited from class net.rubyeye.xmemcached.impl.AbstractMemcachedSessionLocator
failureMode
-
-
Constructor Summary
Constructors Constructor Description ElectionMemcachedSessionLocator()ElectionMemcachedSessionLocator(HashAlgorithm hashAlgorithm)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private SessiongetSessionByElection(java.lang.String key, java.util.List<Session> copySessionList)SessiongetSessionByKey(java.lang.String key)Returns a session by special key.voidupdateSessions(java.util.Collection<Session> list)Update sessions when session was added or removed.-
Methods inherited from class net.rubyeye.xmemcached.impl.AbstractMemcachedSessionLocator
setFailureMode
-
-
-
-
Field Detail
-
sessions
private transient volatile java.util.List<Session> sessions
-
hashAlgorithm
private final HashAlgorithm hashAlgorithm
-
-
Constructor Detail
-
ElectionMemcachedSessionLocator
public ElectionMemcachedSessionLocator()
-
ElectionMemcachedSessionLocator
public ElectionMemcachedSessionLocator(HashAlgorithm hashAlgorithm)
-
-
Method Detail
-
getSessionByKey
public Session getSessionByKey(java.lang.String key)
Description copied from interface:MemcachedSessionLocatorReturns a session by special key.- Returns:
-
getSessionByElection
private Session getSessionByElection(java.lang.String key, java.util.List<Session> copySessionList)
-
updateSessions
public void updateSessions(java.util.Collection<Session> list)
Description copied from interface:MemcachedSessionLocatorUpdate sessions when session was added or removed.- Parameters:
list- The newer sessions
-
-