Class SessionAffinityService<K>
java.lang.Object
org.keycloak.models.sessions.infinispan.SessionAffinityService<K>
- Type Parameters:
K- the type of keys generated by this service
- All Implemented Interfaces:
Supplier<K>
A key affinity service that generates keys with affinity to the local node in a distributed cache.
This service provides similar functionality to KeyAffinityService, but with a more
lenient, best-effort approach. Unlike KeyAffinityService, this implementation never blocks or throws
exceptions when unable to generate a key belonging to the local node. Instead, it attempts to generate an affine key
up to 32 times, and if unsuccessful, returns a random key.
The service automatically tracks topology changes and updates its knowledge of which cache segments are owned by the local node. It prefers keys that map to primary segments owned by this node, but falls back to backup segments if no primary segments are available.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSessionAffinityService(Supplier<K> generator, org.infinispan.distribution.ch.KeyPartitioner keyPartitioner, org.infinispan.remoting.transport.Address localAddress) -
Method Summary
-
Field Details
-
MAX_ATTEMPTS
public static final int MAX_ATTEMPTS- See Also:
-
-
Constructor Details
-
SessionAffinityService
-
-
Method Details