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 HashAlgorithm
hashAlgorithm
private 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 Session
getSessionByElection(java.lang.String key, java.util.List<Session> copySessionList)
Session
getSessionByKey(java.lang.String key)
Returns a session by special key.void
updateSessions(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:MemcachedSessionLocator
Returns 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:MemcachedSessionLocator
Update sessions when session was added or removed.- Parameters:
list
- The newer sessions
-
-