Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
package org.wildfly.swarm.infinispan.runtime;
import org.jboss.msc.Service;
import org.jboss.msc.service.ServiceActivator;
import org.jboss.msc.service.ServiceActivatorContext;
import org.jboss.msc.service.ServiceBuilder;
import org.jboss.msc.service.ServiceController;
import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.ServiceRegistryException;
* Activator to force a cache to start prior to deployment.
* Created by bob on 8/15/17.
public class CacheActivator implements ServiceActivator {
// for WildFly 11, it was enough to add an artificial dependency
// on org.wildfly.clustering.infinispan.cache-container-configuration.<cache container>,
// because the Infinispan services were actually always started (albeit in a passive mode)
// since WildFly 14, we need to add an artificial dependency
// on org.wildfly.clustering.infinispan.default-cache.<cache container>,
// because the Infinispan services are now only started on demand
private ServiceName BASE = ServiceName.parse("org.wildfly.clustering.infinispan.default-cache");
public CacheActivator(String cacheContainerName) {
this.cacheContainerName = cacheContainerName;
public void activate(ServiceActivatorContext context) throws ServiceRegistryException {
ServiceBuilder<?> builder = context.getServiceTarget()
private final String cacheContainerName;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment