本文整理汇总了Java中org.infinispan.avro.client.Marshaller类的典型用法代码示例。如果您正苦于以下问题:Java Marshaller类的具体用法?Java Marshaller怎么用?Java Marshaller使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Marshaller类属于org.infinispan.avro.client包,在下文中一共展示了Marshaller类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: QueryOperation
import org.infinispan.avro.client.Marshaller; //导入依赖的package包/类
public QueryOperation(Codec codec, TransportFactory transportFactory, byte[] cacheName,
AtomicInteger topologyId, Flag[] flags, RemoteQuery query) {
super(codec, transportFactory, cacheName, topologyId, flags);
this.remoteQuery = query;
this.requestAvroMarshaller = new Marshaller<>(Request.class);
this.responseAvroMarshaller = new Marshaller<>(Response.class);
}
示例2: createCacheManager
import org.infinispan.avro.client.Marshaller; //导入依赖的package包/类
@Override
protected EmbeddedCacheManager createCacheManager() throws Exception {
if (cacheManager != null)
return cacheManager;
GlobalConfigurationBuilder gcb = new GlobalConfigurationBuilder().clusteredDefault();
ConfigurationBuilder builder = hotRodCacheConfiguration(getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, false));
builder.indexing().enable()
.addProperty("default.directory_provider", "ram")
.addProperty("lucene_version", "LUCENE_CURRENT");
builder.jmxStatistics().enable();
cacheManager = TestCacheManagerFactory.createClusteredCacheManager(gcb, new ConfigurationBuilder());
cacheManager.defineConfiguration(TEST_CACHE_NAME, builder.build());
cache = cacheManager.getCache(TEST_CACHE_NAME);
hotRodServer = HotRodClientTestingUtil.startHotRodServer(cacheManager);
org.infinispan.client.hotrod.configuration.ConfigurationBuilder clientBuilder =
new org.infinispan.client.hotrod.configuration.ConfigurationBuilder();
clientBuilder.addServer().host(hotRodServer.getAddress().host()).port(hotRodServer.getAddress().port());
clientBuilder.marshaller(new Marshaller<>(Employee.class));
remoteCacheManager = new RemoteCacheManager(clientBuilder.build());
employeeCache = remoteCacheManager.getCache(TEST_CACHE_NAME);
employeeQF = Search.getQueryFactory(employeeCache);
Support.registerSchema(remoteCacheManager, Employee.getClassSchema());
Thread.sleep(1000); // wait that the cluster forms
return cacheManager;
}
示例3: createClient
import org.infinispan.avro.client.Marshaller; //导入依赖的package包/类
@Override
protected RemoteCacheManager createClient(int i) {
org.infinispan.client.hotrod.configuration.ConfigurationBuilder clientBuilder
= new org.infinispan.client.hotrod.configuration.ConfigurationBuilder();
clientBuilder.addServer().host(server(i).getAddress().host()).port(server(i).getAddress().port());
clientBuilder.marshaller(new Marshaller<Employee>(Employee.class));
return new RemoteCacheManager(clientBuilder.build());
}
示例4: createHotRodClientConfigurationBuilder
import org.infinispan.avro.client.Marshaller; //导入依赖的package包/类
@Override
protected org.infinispan.client.hotrod.configuration.ConfigurationBuilder createHotRodClientConfigurationBuilder(int serverPort) {
org.infinispan.client.hotrod.configuration.ConfigurationBuilder clientBuilder = new org.infinispan.client.hotrod.configuration.ConfigurationBuilder();
clientBuilder.addServer()
.host("localhost")
.port(serverPort)
.pingOnStartup(false);
clientBuilder.marshaller(new Marshaller<>(Employee.class));
return clientBuilder;
}
示例5: initialize
import org.infinispan.avro.client.Marshaller; //导入依赖的package包/类
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<T>(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<>();
}
示例6: initialize
import org.infinispan.avro.client.Marshaller; //导入依赖的package包/类
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<>();
}