keycloak
クラス | 公開メンバ関数 | 関数 | 非公開変数類 | 静的非公開変数類 | 全メンバ一覧
org.keycloak.models.sessions.infinispan.util.InfinispanKeyGenerator クラス
org.keycloak.models.sessions.infinispan.util.InfinispanKeyGenerator 連携図
Collaboration graph

クラス

class  StringKeyGenerator
 
class  UUIDKeyGenerator
 

公開メンバ関数

String generateKeyString (KeycloakSession session, Cache< String, ?> cache)
 
UUID generateKeyUUID (KeycloakSession session, Cache< UUID, ?> cache)
 

関数

private< K > K generateKey (KeycloakSession session, Cache< K, ?> cache, KeyGenerator< K > keyGenerator)
 
private< K > KeyAffinityService< K > createKeyAffinityService (Cache< K, ?> cache, KeyGenerator< K > keyGenerator)
 

非公開変数類

final Map< String, KeyAffinityService > keyAffinityServices = new ConcurrentHashMap<>()
 

静的非公開変数類

static final Logger log = Logger.getLogger(InfinispanKeyGenerator.class)
 

詳解

著者
Marek Posolda

関数詳解

◆ createKeyAffinityService()

private<K> KeyAffinityService<K> org.keycloak.models.sessions.infinispan.util.InfinispanKeyGenerator.createKeyAffinityService ( Cache< K, ?>  cache,
KeyGenerator< K >  keyGenerator 
)
inlinepackage
80  {
81  // SingleThreadExecutor is recommended due it needs the single thread and leave it in the WAITING state
82  return KeyAffinityServiceFactory.newLocalKeyAffinityService(
83  cache,
84  keyGenerator,
85  Executors.newSingleThreadExecutor(),
86  16);
87  }

◆ generateKey()

private<K> K org.keycloak.models.sessions.infinispan.util.InfinispanKeyGenerator.generateKey ( KeycloakSession  session,
Cache< K, ?>  cache,
KeyGenerator< K >  keyGenerator 
)
inlinepackage
55  {
56  String cacheName = cache.getName();
57 
58  // "wantsLocalKey" is true if route is not attached to the sticky session cookie. Without attached route, We want the key, which will be "owned" by this node.
59  // This is needed due the fact that external loadbalancer will attach route corresponding to our node, which will be the owner of the particular key, hence we
60  // will be able to lookup key locally.
61  boolean wantsLocalKey = !session.getProvider(StickySessionEncoderProvider.class).shouldAttachRoute();
62 
63  if (wantsLocalKey && cache.getCacheConfiguration().clustering().cacheMode().isClustered()) {
64  KeyAffinityService<K> keyAffinityService = keyAffinityServices.get(cacheName);
65  if (keyAffinityService == null) {
66  keyAffinityService = createKeyAffinityService(cache, keyGenerator);
67  keyAffinityServices.put(cacheName, keyAffinityService);
68 
69  log.debugf("Registered key affinity service for cache '%s'", cacheName);
70  }
71 
72  return keyAffinityService.getKeyForAddress(cache.getCacheManager().getAddress());
73  } else {
74  return keyGenerator.getKey();
75  }
76 
77  }
final Map< String, KeyAffinityService > keyAffinityServices
Definition: InfinispanKeyGenerator.java:42
static final Logger log
Definition: InfinispanKeyGenerator.java:39
private< K > KeyAffinityService< K > createKeyAffinityService(Cache< K, ?> cache, KeyGenerator< K > keyGenerator)
Definition: InfinispanKeyGenerator.java:80

◆ generateKeyString()

String org.keycloak.models.sessions.infinispan.util.InfinispanKeyGenerator.generateKeyString ( KeycloakSession  session,
Cache< String, ?>  cache 
)
inline
45  {
46  return generateKey(session, cache, new StringKeyGenerator());
47  }
private< K > K generateKey(KeycloakSession session, Cache< K, ?> cache, KeyGenerator< K > keyGenerator)
Definition: InfinispanKeyGenerator.java:55

◆ generateKeyUUID()

UUID org.keycloak.models.sessions.infinispan.util.InfinispanKeyGenerator.generateKeyUUID ( KeycloakSession  session,
Cache< UUID, ?>  cache 
)
inline
50  {
51  return generateKey(session, cache, new UUIDKeyGenerator());
52  }
private< K > K generateKey(KeycloakSession session, Cache< K, ?> cache, KeyGenerator< K > keyGenerator)
Definition: InfinispanKeyGenerator.java:55

メンバ詳解

◆ keyAffinityServices

final Map<String, KeyAffinityService> org.keycloak.models.sessions.infinispan.util.InfinispanKeyGenerator.keyAffinityServices = new ConcurrentHashMap<>()
private

◆ log

final Logger org.keycloak.models.sessions.infinispan.util.InfinispanKeyGenerator.log = Logger.getLogger(InfinispanKeyGenerator.class)
staticprivate

このクラス詳解は次のファイルから抽出されました: