use of org.infinispan.avro.client.Marshaller in project gora by apache.
the class InfinispanClient method initialize.
public synchronized void initialize(Class<K> keyClass, Class<T> persistentClass, Properties properties) throws Exception {
if (cache != null)
// already initialized.
return;
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<>();
}
Aggregations