Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WFLY-5581 Routing cache should always use REPL
- Loading branch information
Showing
11 changed files
with
176 additions
and
4 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
.../wildfly/clustering/web/infinispan/session/DistributedRouteCacheGroupBuilderProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2015, Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. See the copyright.txt file in the | ||
* distribution for a full listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
|
||
package org.wildfly.clustering.web.infinispan.session; | ||
|
||
import org.wildfly.clustering.spi.DistributedCacheGroupBuilderProvider; | ||
|
||
/** | ||
* @author Paul Ferraro | ||
*/ | ||
public class DistributedRouteCacheGroupBuilderProvider extends RouteCacheGroupBuilderProvider implements DistributedCacheGroupBuilderProvider { | ||
|
||
public DistributedRouteCacheGroupBuilderProvider() { | ||
super(DistributedCacheGroupBuilderProvider.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...va/org/wildfly/clustering/web/infinispan/session/LocalRouteCacheGroupBuilderProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2015, Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. See the copyright.txt file in the | ||
* distribution for a full listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
|
||
package org.wildfly.clustering.web.infinispan.session; | ||
|
||
import org.wildfly.clustering.spi.LocalCacheGroupBuilderProvider; | ||
|
||
/** | ||
* @author Paul Ferraro | ||
*/ | ||
public class LocalRouteCacheGroupBuilderProvider extends RouteCacheGroupBuilderProvider implements LocalCacheGroupBuilderProvider { | ||
|
||
public LocalRouteCacheGroupBuilderProvider() { | ||
super(LocalCacheGroupBuilderProvider.class); | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
...in/java/org/wildfly/clustering/web/infinispan/session/RouteCacheGroupBuilderProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2015, Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. See the copyright.txt file in the | ||
* distribution for a full listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
|
||
package org.wildfly.clustering.web.infinispan.session; | ||
|
||
import java.util.Collection; | ||
import java.util.LinkedList; | ||
import java.util.List; | ||
import java.util.ServiceLoader; | ||
|
||
import org.infinispan.configuration.cache.CacheMode; | ||
import org.infinispan.configuration.cache.ConfigurationBuilder; | ||
import org.wildfly.clustering.infinispan.spi.service.CacheBuilder; | ||
import org.wildfly.clustering.infinispan.spi.service.TemplateConfigurationBuilder; | ||
import org.wildfly.clustering.service.Builder; | ||
import org.wildfly.clustering.service.SubGroupServiceNameFactory; | ||
import org.wildfly.clustering.spi.CacheGroupAliasBuilderProvider; | ||
import org.wildfly.clustering.spi.CacheGroupBuilderProvider; | ||
|
||
/** | ||
* Creates routing services. | ||
* @author Paul Ferraro | ||
*/ | ||
public class RouteCacheGroupBuilderProvider implements CacheGroupBuilderProvider, CacheGroupAliasBuilderProvider { | ||
|
||
static final String CACHE_NAME = "routing"; | ||
|
||
private final Class<? extends CacheGroupBuilderProvider> providerClass; | ||
|
||
RouteCacheGroupBuilderProvider(Class<? extends CacheGroupBuilderProvider> providerClass) { | ||
this.providerClass = providerClass; | ||
} | ||
|
||
@Override | ||
public Collection<Builder<?>> getBuilders(String containerName, String cacheName) { | ||
List<Builder<?>> builders = new LinkedList<>(); | ||
if (containerName.equals(InfinispanSessionManagerFactoryBuilder.DEFAULT_CACHE_CONTAINER) && cacheName.equals(SubGroupServiceNameFactory.DEFAULT_SUB_GROUP)) { | ||
builders.add(new TemplateConfigurationBuilder(containerName, CACHE_NAME, cacheName) { | ||
@Override | ||
public ConfigurationBuilder createConfigurationBuilder() { | ||
ConfigurationBuilder builder = super.createConfigurationBuilder(); | ||
CacheMode mode = builder.clustering().cacheMode(); | ||
builder.clustering().cacheMode(mode.isClustered() ? CacheMode.REPL_SYNC : CacheMode.LOCAL); | ||
builder.persistence().clearStores(); | ||
return builder; | ||
} | ||
}); | ||
builders.add(new CacheBuilder<>(containerName, CACHE_NAME)); | ||
for (CacheGroupBuilderProvider provider : ServiceLoader.load(this.providerClass, this.providerClass.getClassLoader())) { | ||
System.out.println(String.format("RoutingCacheGroupBuilderProvider.getBuilders(%s, %s), provider = %s", containerName, cacheName, provider.getClass().getName())); | ||
builders.addAll(provider.getBuilders(containerName, CACHE_NAME)); | ||
} | ||
} | ||
return builders; | ||
} | ||
|
||
@Override | ||
public Collection<Builder<?>> getBuilders(String containerName, String aliasCacheName, String targetCacheName) { | ||
return this.getBuilders(containerName, aliasCacheName); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...ain/resources/META-INF/services/org.wildfly.clustering.spi.CacheGroupAliasBuilderProvider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.wildfly.clustering.web.infinispan.session.DistributedRouteCacheGroupBuilderProvider |
1 change: 1 addition & 0 deletions
1
...sources/META-INF/services/org.wildfly.clustering.spi.DistributedCacheGroupBuilderProvider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.wildfly.clustering.web.infinispan.session.DistributedRouteCacheGroupBuilderProvider |
1 change: 1 addition & 0 deletions
1
...ain/resources/META-INF/services/org.wildfly.clustering.spi.LocalCacheGroupBuilderProvider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.wildfly.clustering.web.infinispan.session.LocalRouteCacheGroupBuilderProvider |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters