Search in sources :

Example 6 with RemoteCacheManager

use of org.infinispan.client.hotrod.RemoteCacheManager in project camel by apache.

the class InfinispanRemoteQueryProducerIT method doPreSetup.

@Override
protected void doPreSetup() throws IOException {
    ConfigurationBuilder builder = new ConfigurationBuilder().addServer().host("localhost").port(11222).marshaller(new ProtoStreamMarshaller());
    manager = new RemoteCacheManager(builder.build());
    RemoteCache<String, String> metadataCache = manager.getCache(ProtobufMetadataManagerConstants.PROTOBUF_METADATA_CACHE_NAME);
    metadataCache.put("sample_bank_account/bank.proto", Util.read(InfinispanRemoteQueryProducerIT.class.getResourceAsStream("/sample_bank_account/bank.proto")));
    MarshallerRegistration.registerMarshallers(ProtoStreamMarshaller.getSerializationContext(manager));
    SerializationContext serCtx = ProtoStreamMarshaller.getSerializationContext(manager);
    serCtx.registerProtoFiles(FileDescriptorSource.fromResources("/sample_bank_account/bank.proto"));
    serCtx.registerMarshaller(new UserMarshaller());
    serCtx.registerMarshaller(new GenderMarshaller());
}
Also used : SerializationContext(org.infinispan.protostream.SerializationContext) ConfigurationBuilder(org.infinispan.client.hotrod.configuration.ConfigurationBuilder) RemoteCacheManager(org.infinispan.client.hotrod.RemoteCacheManager) UserMarshaller(org.infinispan.protostream.sampledomain.marshallers.UserMarshaller) ProtoStreamMarshaller(org.infinispan.client.hotrod.marshall.ProtoStreamMarshaller) GenderMarshaller(org.infinispan.protostream.sampledomain.marshallers.GenderMarshaller)

Example 7 with RemoteCacheManager

use of org.infinispan.client.hotrod.RemoteCacheManager in project hazelcast-simulator by hazelcast.

the class InfinispanDriver method startVendorInstance.

@Override
public void startVendorInstance() throws Exception {
    String workerType = get("WORKER_TYPE");
    if ("javaclient".equals(workerType)) {
        Properties hotrodProperties = new Properties();
        hotrodProperties.setProperty("infinispan.client.hotrod.server_list", get("server_list"));
        Configuration configuration = new ConfigurationBuilder().withProperties(hotrodProperties).build();
        RemoteCacheManager remoteCacheManager = new RemoteCacheManager(configuration);
        this.cacheContainer = remoteCacheManager;
        remoteCacheManager.start();
    } else {
        DefaultCacheManager defaultCacheManager = new DefaultCacheManager("infinispan.xml");
        this.cacheContainer = defaultCacheManager;
        defaultCacheManager.start();
        HotRodServerConfiguration hotRodServerConfiguration = new HotRodServerConfigurationBuilder().host(get("PRIVATE_ADDRESS")).port(11222).build();
        this.hotRodServer = new HotRodServer();
        hotRodServer.start(hotRodServerConfiguration, defaultCacheManager);
    }
}
Also used : ConfigurationBuilder(org.infinispan.client.hotrod.configuration.ConfigurationBuilder) HotRodServerConfigurationBuilder(org.infinispan.server.hotrod.configuration.HotRodServerConfigurationBuilder) RemoteCacheManager(org.infinispan.client.hotrod.RemoteCacheManager) DefaultCacheManager(org.infinispan.manager.DefaultCacheManager) Configuration(org.infinispan.client.hotrod.configuration.Configuration) HotRodServerConfiguration(org.infinispan.server.hotrod.configuration.HotRodServerConfiguration) HotRodServer(org.infinispan.server.hotrod.HotRodServer) HotRodServerConfiguration(org.infinispan.server.hotrod.configuration.HotRodServerConfiguration) HotRodServerConfigurationBuilder(org.infinispan.server.hotrod.configuration.HotRodServerConfigurationBuilder) Properties(java.util.Properties)

Example 8 with RemoteCacheManager

use of org.infinispan.client.hotrod.RemoteCacheManager in project YCSB by brianfrankcooper.

the class RemoteCacheManagerHolder method getInstance.

static RemoteCacheManager getInstance(Properties props) {
    RemoteCacheManager result = cacheManager;
    if (result == null) {
        synchronized (RemoteCacheManagerHolder.class) {
            result = cacheManager;
            if (result == null) {
                result = new RemoteCacheManager(props);
                cacheManager = new RemoteCacheManager(props);
            }
        }
    }
    return result;
}
Also used : RemoteCacheManager(org.infinispan.client.hotrod.RemoteCacheManager)

Example 9 with RemoteCacheManager

use of org.infinispan.client.hotrod.RemoteCacheManager in project jnosql-diana-driver by eclipse.

the class InfinispanKeyValueConfiguration method get.

/**
 * Creates a {@link InfinispanBucketManagerFactory} from configuration map
 * @param configurations the configuration map
 * @return the InfinispanBucketManagerFactory instance
 * @throws NullPointerException when configurations is null
 */
public InfinispanBucketManagerFactory get(Map<String, String> configurations) {
    requireNonNull(configurations, "configurations is required");
    List<String> servers = configurations.keySet().stream().filter(s -> s.startsWith("infinispan-server-")).collect(Collectors.toList());
    if (!servers.isEmpty()) {
        org.infinispan.client.hotrod.configuration.ConfigurationBuilder builder = new org.infinispan.client.hotrod.configuration.ConfigurationBuilder();
        for (String server : servers) {
            builder.addServer().host(server);
        }
        return new InfinispanBucketManagerFactory(new RemoteCacheManager(builder.build()));
    } else if (configurations.containsKey("infinispan-config")) {
        try {
            return new InfinispanBucketManagerFactory(new DefaultCacheManager(configurations.get("infinispan-config")));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    } else {
        GlobalConfigurationBuilder builder = new GlobalConfigurationBuilder();
        builder.globalJmxStatistics().allowDuplicateDomains(true);
        return new InfinispanBucketManagerFactory(new DefaultCacheManager(builder.build()));
    }
}
Also used : List(java.util.List) DefaultCacheManager(org.infinispan.manager.DefaultCacheManager) ConfigurationReader(org.jnosql.diana.driver.ConfigurationReader) Objects.requireNonNull(java.util.Objects.requireNonNull) Map(java.util.Map) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) IOException(java.io.IOException) HashMap(java.util.HashMap) KeyValueConfiguration(org.jnosql.diana.api.key.KeyValueConfiguration) Settings(org.jnosql.diana.api.Settings) Collectors(java.util.stream.Collectors) RemoteCacheManager(org.infinispan.client.hotrod.RemoteCacheManager) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) DefaultCacheManager(org.infinispan.manager.DefaultCacheManager) IOException(java.io.IOException) RemoteCacheManager(org.infinispan.client.hotrod.RemoteCacheManager)

Aggregations

RemoteCacheManager (org.infinispan.client.hotrod.RemoteCacheManager)9 ConfigurationBuilder (org.infinispan.client.hotrod.configuration.ConfigurationBuilder)5 ProtoStreamMarshaller (org.infinispan.client.hotrod.marshall.ProtoStreamMarshaller)2 DefaultCacheManager (org.infinispan.manager.DefaultCacheManager)2 SerializationContext (org.infinispan.protostream.SerializationContext)2 GenderMarshaller (org.infinispan.protostream.sampledomain.marshallers.GenderMarshaller)2 UserMarshaller (org.infinispan.protostream.sampledomain.marshallers.UserMarshaller)2 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Objects.requireNonNull (java.util.Objects.requireNonNull)1 Properties (java.util.Properties)1 Collectors (java.util.stream.Collectors)1 Marshaller (org.infinispan.avro.client.Marshaller)1 Configuration (org.infinispan.client.hotrod.configuration.Configuration)1 GlobalConfigurationBuilder (org.infinispan.configuration.global.GlobalConfigurationBuilder)1 HotRodServer (org.infinispan.server.hotrod.HotRodServer)1 HotRodServerConfiguration (org.infinispan.server.hotrod.configuration.HotRodServerConfiguration)1 HotRodServerConfigurationBuilder (org.infinispan.server.hotrod.configuration.HotRodServerConfigurationBuilder)1