本文整理匯總了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<>();
}