org.infinispan.client.hotrod.RemoteCacheManager.start()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(12.2k)|赞(0)|评价(0)|浏览(100)

本文整理了Java中org.infinispan.client.hotrod.RemoteCacheManager.start方法的一些代码示例,展示了RemoteCacheManager.start的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RemoteCacheManager.start方法的具体详情如下:
包路径:org.infinispan.client.hotrod.RemoteCacheManager
类名称:RemoteCacheManager
方法名:start

RemoteCacheManager.start介绍

暂无

代码示例

代码示例来源:origin: wildfly/wildfly

@Override
public RemoteCacheManager get() {
  Configuration configuration = this.configuration.get();
  RemoteCacheManager remoteCacheManager = new RemoteCacheManager(configuration);
  remoteCacheManager.start();
  InfinispanLogger.ROOT_LOGGER.remoteCacheContainerStarted(this.name);
  return remoteCacheManager;
}

代码示例来源:origin: org.infinispan/infinispan-spring

/**
* 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();
}

代码示例来源:origin: org.infinispan/infinispan-spring5-remote

/**
* Start the {@link RemoteCacheManager
* <code>org.infinispan.client.hotrod.RemoteCacheManager</code>} that backs this
* <code>SpringRemoteCacheManager</code>.
*/
public void start() {
 this.nativeCacheManager.start();
}

代码示例来源:origin: org.wildfly/wildfly-clustering-infinispan-extension

@Override
public RemoteCacheManager get() {
  Configuration configuration = this.configuration.get();
  RemoteCacheManager remoteCacheManager = new RemoteCacheManager(configuration);
  remoteCacheManager.start();
  InfinispanLogger.ROOT_LOGGER.remoteCacheContainerStarted(this.name);
  return remoteCacheManager;
}

代码示例来源:origin: org.apache.camel/camel-infinispan

@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);
  }
}

代码示例来源:origin: apache/gora

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<>();
}

代码示例来源:origin: org.teiid.wildfly.connectors/connector-infinispan-hotrod

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);
  }
}

代码示例来源:origin: org.teiid.wildfly.connectors/connector-infinispan-hotrod

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);
  }
}

代码示例来源:origin: org.infinispan.server/infinispan-server-testsuite

/**
* 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));
}

代码示例来源:origin: org.infinispan/infinispan-cli-server

@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);
}

代码示例来源:origin: org.infinispan/infinispan-cli-interpreter

@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);
}

代码示例来源:origin: org.infinispan.server/infinispan-server-testsuite

@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());
}

代码示例来源:origin: org.infinispan/infinispan-cachestore-remote

@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();
}

代码示例来源:origin: org.infinispan/infinispan-cli-interpreter

@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();
}

代码示例来源:origin: org.infinispan/infinispan-cli-server

@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();
}

代码示例来源:origin: org.infinispan/infinispan-cachestore-remote

@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();
}

相关文章