@Override public Configuration get() { ConfigurationBuilder builder = new ConfigurationBuilder() .marshaller(new HotRodMarshaller(this.module.get())) .connectionTimeout(this.connectionTimeout) .keySizeEstimate(this.keySizeEstimate) .maxRetries(this.maxRetries) .version(ProtocolVersion.parseVersion(this.protocolVersion)) .socketTimeout(this.socketTimeout) .tcpNoDelay(this.tcpNoDelay) .tcpKeepAlive(this.tcpKeepAlive) .valueSizeEstimate(this.valueSizeEstimate); builder.connectionPool().read(this.connectionPool.get()); builder.nearCache().read(this.nearCache.get()); builder.asyncExecutorFactory().read(this.threadPools.get(ThreadPoolResourceDefinition.CLIENT).get()); for (Supplier<OutboundSocketBinding> bindingDependency : bindingDependencies) { OutboundSocketBinding binding = bindingDependency.get(); builder.addServer().host(binding.getUnresolvedDestinationAddress()).port(binding.getDestinationPort()); ClusterConfigurationBuilder clusterConfigurationBuilder = builder.addCluster(clusterName); for (Supplier<OutboundSocketBinding> bindingDependency : bindingDependencies) { OutboundSocketBinding binding = bindingDependency.get(); builder.security().read(this.security.get()); return builder.build();
@Override public NearCacheConfiguration get() { return new ConfigurationBuilder().nearCache().mode(NearCacheMode.DISABLED).create(); } }
@Override public ExecutorFactoryConfiguration get() { return new ConfigurationBuilder().asyncExecutorFactory().factory(this.factory).create(); }
public static RemoteCache<String,String> getExecCache() { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.addServer().host("127.0.0.1").port(11222); RemoteCacheManager cacheManager = new RemoteCacheManager(builder.build()); return cacheManager.getCache(); }
public MarketUpdater(String stockName, float initialValue) { this.NAME_OF_SHARES = stockName; this.sharesTrend = new SharesTrend(stockName, initialValue); KEY_DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT")); //configure the HotRod client and retrieve the cache Configuration config = new ConfigurationBuilder().addServer().host(SERVER_HOST).port(SERVER_PORT).build(); rcm = new RemoteCacheManager(config); cache = rcm.getCache(); }
@Bean @Conditional(InfinispanRemoteFileChecker.class) public RemoteCacheManager remoteCacheManager() throws IOException { org.infinispan.client.hotrod.configuration.Configuration configuration; if(infinispanRemoteConfigurer != null) { configuration = infinispanRemoteConfigurer.getRemoteConfiguration(); } else { final String remoteClientPropertiesLocation = infinispanProperties.getRemote().getClientProperties(); Resource hotRodClientPropertiesFile = ctx.getResource(remoteClientPropertiesLocation); Properties hotrodClientProperties = new Properties(); try (InputStream stream = hotRodClientPropertiesFile.getURL().openStream()) { hotrodClientProperties.load(stream); configuration = new ConfigurationBuilder().withProperties(hotrodClientProperties).build(); } } return new RemoteCacheManager(configuration); } }
/** * 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); } }
@Test public void testEmptyConfiguration() throws Exception { ConfigurationBuilder confBuilder = new ConfigurationBuilder(); addServers(confBuilder); RemoteCacheManager rcm = new RemoteCacheManager(confBuilder.build()); RemoteCache rc = rcm.getCache(testCache); ConfigurationBuilder builder = new ConfigurationBuilder(); addServers(builder); builder.balancingStrategy("org.infinispan.client.hotrod.impl.transport.tcp.RoundRobinBalancingStrategy") .forceReturnValues(false) .tcpNoDelay(true) .transportFactory("org.infinispan.client.hotrod.impl.transport.tcp.TcpTransportFactory") .marshaller("org.infinispan.commons.marshall.jboss.GenericJBossMarshaller") .asyncExecutorFactory().factoryClass("org.infinispan.client.hotrod.impl.async.DefaultAsyncExecutorFactory") .addExecutorProperty("infinispan.client.hotrod.default_executor_factory.pool_size", "10") .addExecutorProperty("infinispan.client.hotrod.default_executor_factory.queue_size", "100000") .keySizeEstimate(64) .valueSizeEstimate(512); Configuration defaultConf = builder.build(); assertEqualConfiguration(defaultConf, rc); }
@Test public void testViaDirectConfig() throws Exception { ConfigurationBuilder builder = new ConfigurationBuilder(); String hostname = ispnServer.getHotrodEndpoint().getInetAddress().getHostName(); builder.addServer().host(hostname).port(ispnServer.getHotrodEndpoint().getPort()); builder.security().ssl().enable().trustStoreFileName(DEFAULT_TRUSTSTORE_PATH).trustStorePassword(DEFAULT_TRUSTSTORE_PASSWORD.toCharArray()); remoteCacheManager = new RemoteCacheManager(builder.build()); remoteCache = remoteCacheManager.getCache(RemoteCacheManager.DEFAULT_CACHE_NAME); testPutGet(remoteCache); testSize(remoteCache); }
private RemoteCacheManager createRemoteCacheManager(Marshaller marshaller) { org.infinispan.client.hotrod.configuration.ConfigurationBuilder builder = new org.infinispan.client.hotrod.configuration.ConfigurationBuilder(); builder.addServer().host("localhost").port(hotRodServer.getPort()); if (marshaller != null) { builder.marshaller(marshaller); } return new RemoteCacheManager(builder.build()); }
public static RemoteCacheManager createNoAuth(InetAddress ip, int port) { ConfigurationBuilder clientBuilder = new ConfigurationBuilder(); clientBuilder = withIpAndPort(clientBuilder, ip, port); clientBuilder = withSingleConnection(clientBuilder); return new RemoteCacheManager(clientBuilder.build()); }
public InfinispanSessionLegacyConverter (String cacheName) throws Exception { //legacy serialization _legacyManager = new RemoteCacheManager(); _legacyCache = _legacyManager.getCache(cacheName); //new protobuf based String host = System.getProperty("host", "127.0.0.1"); _verbose = Boolean.getBoolean("verbose"); Properties properties = new Properties(); ConfigurationBuilder clientBuilder = new ConfigurationBuilder(); clientBuilder.withProperties(properties).addServer().host(host).marshaller(new ProtoStreamMarshaller()); _protoManager = new RemoteCacheManager(clientBuilder.build()); FileDescriptorSource fds = new FileDescriptorSource(); fds.addProtoFiles("/session.proto"); SerializationContext serCtx = ProtoStreamMarshaller.getSerializationContext(_protoManager); serCtx.registerProtoFiles(fds); serCtx.registerMarshaller(new SessionDataMarshaller()); _protoCache = _protoManager.getCache(cacheName); }
public InfinispanRemoteCacheManager(KiWiConfiguration configuration) { this.configuration = configuration; Configuration remoteCfg = new ConfigurationBuilder() .addServer() .host(configuration.getClusterAddress()) .port(configuration.getClusterPort()) .marshaller(new CustomJBossMarshaller()) .socketTimeout(configuration.getClusterTimeout()) .connectionTimeout(configuration.getClusterTimeout()) .build(); cacheManager = new RemoteCacheManager(remoteCfg); log.info("initialised Infinispan remote cache manager (servers: {})", configuration.getClusterAddress()); }
private Configuration createRemoteCacheManagerConfiguration() { ConfigurationBuilder config = new ConfigurationBuilder(); config.addServer() .host(server1.getHotrodEndpoint().getInetAddress().getHostName()) .port(server1.getHotrodEndpoint().getPort()); config.transaction().transactionMode(TransactionMode.NON_XA); config.transaction().transactionManagerLookup(RemoteTransactionManagerLookup.getInstance()); return config.build(); }
@Before public void setUp() throws Exception { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.addServer().host("127.0.0.1") .marshaller(new ProtoStreamMarshaller()) .nearCache().mode(NearCacheMode.INVALIDATED).cacheNamePattern("indexed").maxEntries(10); RemoteCacheManager remoteCacheManager = new RemoteCacheManager(builder.build()); remoteCache = remoteCacheManager.getCache("indexed"); //initialize server-side serialization context RemoteCache<String, String> metadataCache = remoteCacheManager.getCache(ProtobufMetadataManagerConstants.PROTOBUF_METADATA_CACHE_NAME); metadataCache.put("sample_bank_account/bank.proto", Util.getResourceAsString("/sample_bank_account/bank.proto", getClass().getClassLoader())); assertFalse(metadataCache.containsKey(ProtobufMetadataManagerConstants.ERRORS_KEY_SUFFIX)); //initialize client-side serialization context MarshallerRegistration.registerMarshallers(ProtoStreamMarshaller.getSerializationContext(remoteCacheManager)); }
@Before public void init() { ConfigurationBuilder builder = new SecurityConfigurationHelper().withDefaultSsl().withSni("sni1"); //FIXME: Use Infinispan Arquillian support after implementing https://issues.jboss.org/browse/ARQ-2035 builder.addServer().host("127.0.0.1").port(11222); remoteCacheManager = new RemoteCacheManager(builder.build()); remoteCache = remoteCacheManager.getCache(CACHE_NAME); rest = new RESTHelper(); rest.addServer("127.0.0.1", 8080, "/rest/multi-tenancy-1"); }
private Configuration createRemoteCacheManagerConfiguration() { ConfigurationBuilder config = new ConfigurationBuilder(); config.version(getProtocolVersion()); config.addServer() .host(server1.getHotrodEndpoint().getInetAddress().getHostName()) .port(server1.getHotrodEndpoint().getPort()); return config.build(); }
public RemoteCacheManager build() { ConfigurationBuilder builder = new ConfigurationBuilder() .classLoader( HotRodClientBuilder.class.getClassLoader() ) .withProperties( config.getClientProperties() ) .marshaller( this.marshaller ); if ( platform != null && !TransactionMode.NONE.equals( transactionMode ) ) { builder.transaction().transactionMode( transactionMode ); builder.transaction().transactionManagerLookup( new TransactionManagerLookupDelegator( platform ) ); } return new RemoteCacheManager( builder.build() ); }
ConfigurationBuilder builder = new ConfigurationBuilder(); builder.addServers(configuration.getHosts()); builder.classLoader(camelContext.getApplicationContextClassLoader()); } else { builder.classLoader(Thread.currentThread().getContextClassLoader()); builder.withProperties(properties); cacheContainer = new RemoteCacheManager(builder.build(), true);