Skip to content

Commit

Permalink
KEYCLOAK-5656 Remove KeycloakTcpTransportFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
hmlnarik committed Oct 6, 2017
1 parent 00ddf03 commit 6cbfbec
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 143 deletions.
1 change: 0 additions & 1 deletion misc/CrossDataCenter.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ Keycloak servers setup
<store class="org.keycloak.models.sessions.infinispan.remotestore.KeycloakRemoteStoreConfigurationBuilder" passivation="false" fetch-state="false" purge="false" preload="false" shared="true">
<property name="rawValues">true</property>
<property name="marshaller">org.keycloak.cluster.infinispan.KeycloakHotRodMarshallerFactory</property>
<property name="transportFactory">org.keycloak.models.sessions.infinispan.remotestore.KeycloakTcpTransportFactory</property>
<property name="remoteServers">localhost:${remote.cache.port}</property>
<property name="remoteCacheName">work</property>
<property name="sessionCache">false</property>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.KeycloakSessionFactory;
import org.keycloak.models.sessions.infinispan.remotestore.KeycloakRemoteStoreConfigurationBuilder;
import org.keycloak.models.sessions.infinispan.remotestore.KeycloakTcpTransportFactory;

import javax.naming.InitialContext;

Expand Down Expand Up @@ -367,10 +366,9 @@ private void configureRemoteCacheStore(ConfigurationBuilder builder, boolean asy
.rawValues(true)
.forceReturnValues(false)
.marshaller(KeycloakHotRodMarshallerFactory.class.getName())
.transportFactory(KeycloakTcpTransportFactory.class.getName())
// .addServer()
// .host(jdgServer)
// .port(jdgPort)
.addServer()
.host(jdgServer)
.port(jdgPort)
// .connectionPool()
// .maxActive(100)
// .exhaustedAction(ExhaustedAction.CREATE_NEW)
Expand All @@ -397,10 +395,9 @@ private void configureRemoteActionTokenCacheStore(ConfigurationBuilder builder,
.rawValues(true)
.forceReturnValues(false)
.marshaller(KeycloakHotRodMarshallerFactory.class.getName())
.transportFactory(KeycloakTcpTransportFactory.class.getName())
// .addServer()
// .host(jdgServer)
// .port(jdgPort)
.addServer()
.host(jdgServer)
.port(jdgPort)
.async()
.enabled(async);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.keycloak.models.sessions.infinispan.remotestore;

import java.util.Optional;
import java.util.concurrent.Executor;

import org.infinispan.commons.CacheException;
Expand Down Expand Up @@ -62,17 +61,10 @@ public void start() throws PersistenceException {
EmbeddedCacheManager cacheManager = ctx.getCache().getCacheManager();
cacheManager.getCache(cacheTemplateName, true);

Optional<StoreConfiguration> optional = cacheManager.getCacheConfiguration(cacheTemplateName).persistence().stores().stream().filter((StoreConfiguration storeConfig) -> {

return storeConfig instanceof KeycloakRemoteStoreConfiguration;

}).findFirst();

if (!optional.isPresent()) {
throw new CacheException("Unable to find remoteStore on cache '" + cacheTemplateName + ".");
}

KeycloakRemoteStoreConfiguration templateConfig = (KeycloakRemoteStoreConfiguration) optional.get();
KeycloakRemoteStoreConfiguration templateConfig = (KeycloakRemoteStoreConfiguration) cacheManager.getCacheConfiguration(cacheTemplateName).persistence().stores().stream()
.filter((StoreConfiguration storeConfig) -> storeConfig instanceof KeycloakRemoteStoreConfiguration)
.findFirst()
.orElseThrow(() -> new CacheException("Unable to find remoteStore on cache '" + cacheTemplateName + "."));

// We have template configuration, so create new configuration from it. Override just remoteCacheName and sessionsCache (not pretty, but works for now)
PersistenceConfigurationBuilder readPersistenceBuilder = new ConfigurationBuilder().read(ctx.getCache().getCacheConfiguration()).persistence();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ echo ** Update replicated-cache work element **
name=properties, value={ \
rawValues=true, \
marshaller=org.keycloak.cluster.infinispan.KeycloakHotRodMarshallerFactory, \
transportFactory=org.keycloak.models.sessions.infinispan.remotestore.KeycloakTcpTransportFactory, \
remoteServers=localhost:${remote.cache.port}, \
remoteCacheName=work, \
sessionCache=false \
Expand Down

0 comments on commit 6cbfbec

Please sign in to comment.