@Override public RemoteCacheManager get() { Configuration configuration = this.configuration.get(); RemoteCacheManager remoteCacheManager = new RemoteCacheManager(configuration); remoteCacheManager.start(); InfinispanLogger.ROOT_LOGGER.remoteCacheContainerStarted(this.name); return remoteCacheManager; }
/** * Start the {@link org.infinispan.client.hotrod.RemoteCacheManager * <code>org.infinispan.client.hotrod.RemoteCacheManager</code>} that backs this * <code>SpringRemoteCacheManager</code>. */ public void start() { this.nativeCacheManager.start(); }
/** * Start the {@link RemoteCacheManager * <code>org.infinispan.client.hotrod.RemoteCacheManager</code>} that backs this * <code>SpringRemoteCacheManager</code>. */ public void start() { this.nativeCacheManager.start(); }
@Override public RemoteCacheManager get() { Configuration configuration = this.configuration.get(); RemoteCacheManager remoteCacheManager = new RemoteCacheManager(configuration); remoteCacheManager.start(); InfinispanLogger.ROOT_LOGGER.remoteCacheContainerStarted(this.name); return remoteCacheManager; }
@Override protected void doStart() throws Exception { if (maximumRedeliveries < 0) { throw new IllegalArgumentException("Maximum redelivery retries must be zero or a positive integer."); } if (recoveryInterval < 0) { throw new IllegalArgumentException("Recovery interval must be zero or a positive integer."); } if (ObjectHelper.isEmpty(configuration)) { manager = new RemoteCacheManager(); manager.start(); } else { manager = new RemoteCacheManager(configuration); manager.start(); } if (ObjectHelper.isEmpty(cacheName)) { cache = manager.getCache(); } else { cache = manager.getCache(cacheName); } }
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<>(); }
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); } }
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); } }
/** * Test correct behaviour for RemoteCacheManagers start/stop function <br> * Current operations can be completed, but no new operations are supposed to * be issued * * @throws IOException * @throws InterruptedException */ @Test public void RCMStopTest() throws IOException, InterruptedException { byte[] value = new byte[100]; byte[] ret = new byte[100]; random.nextBytes(value); Long key = random.nextLong(); OutputStream out = src1.put(key); out.write(value, 0, 50); rcm1.stop(); Exceptions.expectException(IOException.class, () -> { out.write(value, 50, 50); out.close(); }); Exceptions.expectException(TransportException.class, () -> src1.get(key)); Exceptions.expectException(TransportException.class, () -> src1.put(key)); rcm1.start(); src1 = rcm1.getCache("streamingTestCache").streaming(); assertEquals(null, src1.get(key)); }
@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); }
@Override protected void setup() throws Exception { super.setup(); hotrodServer = HotRodClientTestingUtil.startHotRodServer(cacheManager); port = hotrodServer.getPort(); remoteCacheManager = new RemoteCacheManager( new org.infinispan.client.hotrod.configuration.ConfigurationBuilder().addServer().host("localhost").port(port).build()); remoteCacheManager.start(); GlobalComponentRegistry gcr = TestingUtil.extractGlobalComponentRegistry(cacheManager); interpreter = gcr.getComponent(Interpreter.class); }
@Test public void testStartStop() { Configuration cfg = createRemoteCacheManagerConfigurationBuilder().build(); RemoteCacheManager rcm = new RemoteCacheManager(cfg, false); // check initial status assertTrue("RemoteCacheManager should not be started initially", !rcm.isStarted()); // check start status rcm.start(); assertTrue("RemoteCacheManager should be started after calling start()", rcm.isStarted()); // check stopped status rcm.stop(); assertTrue("RemoteCacheManager should be stopped after calling stop()", !rcm.isStarted()); }
@BeforeClass public void setup() throws Exception { ConfigurationBuilder serverBuilder = TestCacheManagerFactory.getDefaultCacheConfiguration(false); serverCacheManager = TestCacheManagerFactory .createCacheManager(hotRodCacheConfiguration(serverBuilder)); serverCache = serverCacheManager.getCache(); sourceServer = HotRodClientTestingUtil.startHotRodServer(serverCacheManager); remoteSourceCacheManager = HotRodClientTestingUtil.getRemoteCacheManager(sourceServer); remoteSourceCacheManager.start(); remoteSourceCache = remoteSourceCacheManager.getCache(); ConfigurationBuilder clientBuilder = TestCacheManagerFactory.getDefaultCacheConfiguration(false); clientBuilder.persistence().addStore(RemoteStoreConfigurationBuilder.class) .hotRodWrapping(true) .addServer() .host(sourceServer.getHost()) .port(sourceServer.getPort()); targetCacheManager = TestCacheManagerFactory .createCacheManager(hotRodCacheConfiguration(clientBuilder)); targetCache = targetCacheManager.getCache(); targetServer = HotRodClientTestingUtil.startHotRodServer(targetCacheManager); remoteTargetCacheManager = HotRodClientTestingUtil.getRemoteCacheManager(targetServer); remoteTargetCacheManager.start(); remoteTargetCache = remoteTargetCacheManager.getCache(); }
@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(); }
@BeforeClass public void setup() throws Exception { ConfigurationBuilder serverBuilder = TestCacheManagerFactory.getDefaultCacheConfiguration(false); serverBuilder.memory().size(100) .expiration().wakeUpInterval(10L); serverCacheManager = TestCacheManagerFactory.createCacheManager( hotRodCacheConfiguration(serverBuilder)); serverCache = serverCacheManager.getCache(); hrServer = HotRodClientTestingUtil.startHotRodServer(serverCacheManager); ConfigurationBuilder clientBuilder = TestCacheManagerFactory.getDefaultCacheConfiguration(false); clientBuilder.persistence().addStore(RemoteStoreConfigurationBuilder.class) .rawValues(true) .addServer() .host(hrServer.getHost()) .port(hrServer.getPort()); clientCacheManager = TestCacheManagerFactory.createCacheManager(clientBuilder); clientCache = clientCacheManager.getCache(); org.infinispan.client.hotrod.configuration.ConfigurationBuilder rcmBuilder = new org.infinispan.client.hotrod.configuration.ConfigurationBuilder(); rcmBuilder.addServer() .host(hrServer.getHost()) .port(hrServer.getPort()); remoteCacheManager = new RemoteCacheManager(rcmBuilder.build()); remoteCacheManager.start(); remoteCache = remoteCacheManager.getCache(); }