
org.infinispan.cdi.DefaultRemoteCacheManagerProducer Maven / Gradle / Ivy
package org.infinispan.cdi;
import org.infinispan.cdi.util.defaultbean.DefaultBean;
import org.infinispan.client.hotrod.RemoteCacheManager;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;
/**
* The default {@link RemoteCacheManager} producer.
*
* The remote cache manager used by default can be overridden by creating a producer which produces the new default
* remote cache manager. The remote cache manager produced must have the scope {@link ApplicationScoped} and the
* {@linkplain javax.enterprise.inject.Default Default} qualifier.
*
* @author Kevin Pollet (C) 2011 SERLI
*/
public class DefaultRemoteCacheManagerProducer {
/**
* Produces the default remote cache manager with the default settings.
*
* @return the default remote cache manager.
* @see org.infinispan.client.hotrod.RemoteCacheManager#RemoteCacheManager()
*/
@Produces
@ApplicationScoped
@DefaultBean(RemoteCacheManager.class)
public RemoteCacheManager getDefaultRemoteCacheManager() {
return new RemoteCacheManager();
}
/**
* Stops the default remote cache manager when the corresponding instance is released.
*
* @param defaultRemoteCacheManager the default remote cache manager.
*/
@SuppressWarnings("unused")
private void stopRemoteCacheManager(@Disposes RemoteCacheManager defaultRemoteCacheManager) {
defaultRemoteCacheManager.stop();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy