public synchronized void initialize(Class<K> keyClass, Class<T> persistentClass, Properties properties) throws Exception { if (cache!=null) return; // already initialized. this.keyClass = keyClass; this.persistentClass = persistentClass; String host = properties.getProperty(ISPN_CONNECTION_STRING_KEY, getConf().get(ISPN_CONNECTION_STRING_KEY, ISPN_CONNECTION_STRING_DEFAULT)); conf.set(ISPN_CONNECTION_STRING_KEY, host); properties.setProperty(ISPN_CONNECTION_STRING_KEY, host); LOG.info("Connecting client to "+host); Marshaller<T> marshaller = new Marshaller<>(persistentClass); ConfigurationBuilder builder = new ConfigurationBuilder(); builder.addServers(host); builder.marshaller(marshaller); cacheManager = new RemoteCacheManager(builder.build()); cacheManager.start(); cache = cacheManager.getCache(persistentClass.getSimpleName()); qf = org.infinispan.avro.hotrod.Search.getQueryFactory(cache); createSchema(); toPut = new HashMap<>(); }
.addServers(securedHotRodEndpoint) .security() .authentication()
/** * Overrides the default remote cache manager. */ @Produces @ApplicationScoped public static RemoteCacheManager defaultRemoteCacheManager() { return new RemoteCacheManager( new org.infinispan.client.hotrod.configuration.ConfigurationBuilder() .addServers("127.0.0.1:" + hotRodServer.getPort()).build()); }
/** * Overrides the default remote cache manager. */ @Produces @ApplicationScoped public static RemoteCacheManager defaultRemoteCacheManager() { return new RemoteCacheManager( new org.infinispan.client.hotrod.configuration.ConfigurationBuilder() .addServers("127.0.0.1:" + hotRodServer.getPort()).build()); }
private void buildScriptCacheManager() throws ResourceException { try { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.addServers(remoteServerList); builder.marshaller(new GenericJBossMarshaller()); handleSecurity(builder); // note this object is expensive, so there needs to only one // instance for the JVM, in this case one per RA instance. this.scriptCacheManager = new RemoteCacheManager(builder.build()); this.scriptCacheManager.start(); } catch (Throwable e) { throw new ResourceException(e); } }
/** * Produces a specific cache manager for the small cache. * * @see Small */ @Small @Produces @ApplicationScoped public static RemoteCacheManager smallRemoteCacheManager() { return new RemoteCacheManager( new org.infinispan.client.hotrod.configuration.ConfigurationBuilder() .addServers("127.0.0.1:" + hotRodServer.getPort()).build()); }
builder.addServers(configuration.getHosts());
private void buildCacheManager() throws ResourceException { try { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.addServers(remoteServerList); builder.marshaller(new ProtoStreamMarshaller()); handleSecurity(builder); // note this object is expensive, so there needs to only one // instance for the JVM, in this case one per RA instance. this.cacheManager = new RemoteCacheManager(builder.build()); // register default marshellers /* SerializationContext ctx = ProtoStreamMarshaller.getSerializationContext(this.cacheManager); FileDescriptorSource fds = new FileDescriptorSource(); ctx.registerProtoFiles(fds); */ this.cacheManager.start(); this.ctx = ProtoStreamMarshaller.getSerializationContext(this.cacheManager); } catch (Throwable e) { throw new ResourceException(e); } }
private void createHotRodCache(HotRodServer server) { hotrod = server; hotrodClient = new RemoteCacheManager(new ConfigurationBuilder() .addServers("localhost:" + hotrod.getPort()) .addJavaSerialWhiteList(".*Person.*", ".*CustomEvent.*") .marshaller(marshaller) .build()); hotrodCache = cacheName.isEmpty() ? hotrodClient.getCache() : hotrodClient.getCache(cacheName); }
@Override protected void setup() throws Exception { super.setup(); hotrodServer = TestHelper.startHotRodServer(cacheManager); port = hotrodServer.getPort(); remoteCacheManager = new RemoteCacheManager( new org.infinispan.client.hotrod.configuration.ConfigurationBuilder() .addServers("localhost:" + hotrodServer.getPort()).build()); remoteCacheManager.start(); GlobalComponentRegistry gcr = TestingUtil.extractGlobalComponentRegistry(cacheManager); interpreter = gcr.getComponent(Interpreter.class); }
@BeforeClass public void setup() throws Exception { ConfigurationBuilder serverBuilder = hotRodCacheConfiguration( TestCacheManagerFactory.getDefaultCacheConfiguration(false)); sourceContainer = TestCacheManagerFactory.createCacheManager(serverBuilder); sourceServerCache = sourceContainer.getCache(); sourceServer = HotRodClientTestingUtil.startHotRodServer(sourceContainer); ConfigurationBuilder targetConfigurationBuilder = hotRodCacheConfiguration( TestCacheManagerFactory.getDefaultCacheConfiguration(false)); targetConfigurationBuilder.persistence().addStore(RemoteStoreConfigurationBuilder.class).hotRodWrapping(true).addServer().host("localhost").port(sourceServer.getPort()); targetContainer = TestCacheManagerFactory.createCacheManager(targetConfigurationBuilder); targetServerCache = targetContainer.getCache(); targetServer = HotRodClientTestingUtil.startHotRodServer(targetContainer); sourceRemoteCacheManager = new RemoteCacheManager( new org.infinispan.client.hotrod.configuration.ConfigurationBuilder() .addServers("localhost:" + sourceServer.getPort()).build()); sourceRemoteCacheManager.start(); sourceRemoteCache = sourceRemoteCacheManager.getCache(); targetRemoteCacheManager = new RemoteCacheManager( new org.infinispan.client.hotrod.configuration.ConfigurationBuilder() .addServers("localhost:" + sourceServer.getPort()).build()); targetRemoteCacheManager.start(); }
@BeforeClass public void setup() throws Exception { ConfigurationBuilder serverBuilder = hotRodCacheConfiguration( TestCacheManagerFactory.getDefaultCacheConfiguration(false)); sourceContainer = TestCacheManagerFactory.createCacheManager(serverBuilder); sourceServerCache = sourceContainer.getCache(); sourceServer = TestHelper.startHotRodServer(sourceContainer); ConfigurationBuilder targetConfigurationBuilder = hotRodCacheConfiguration( TestCacheManagerFactory.getDefaultCacheConfiguration(false)); targetConfigurationBuilder.persistence().addStore(RemoteStoreConfigurationBuilder.class).hotRodWrapping(true).addServer().host("localhost").port(sourceServer.getPort()); targetContainer = TestCacheManagerFactory.createCacheManager(targetConfigurationBuilder); targetServerCache = targetContainer.getCache(); targetServer = TestHelper.startHotRodServer(targetContainer); sourceRemoteCacheManager = new RemoteCacheManager( new org.infinispan.client.hotrod.configuration.ConfigurationBuilder() .addServers("localhost:" + sourceServer.getPort()).build()); sourceRemoteCacheManager.start(); sourceRemoteCache = sourceRemoteCacheManager.getCache(); targetRemoteCacheManager = new RemoteCacheManager( new org.infinispan.client.hotrod.configuration.ConfigurationBuilder() .addServers("localhost:" + sourceServer.getPort()).build()); targetRemoteCacheManager.start(); targetRemoteCache = targetRemoteCacheManager.getCache(); }