本文整理汇总了Java中org.apache.ignite.configuration.IgniteConfiguration.setMarshaller方法的典型用法代码示例。如果您正苦于以下问题:Java IgniteConfiguration.setMarshaller方法的具体用法?Java IgniteConfiguration.setMarshaller怎么用?Java IgniteConfiguration.setMarshaller使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.configuration.IgniteConfiguration
的用法示例。
在下文中一共展示了IgniteConfiguration.setMarshaller方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setBinaryConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* Sets binary config.
*
* @param igniteCfg Ignite config.
* @param dotNetCfg .NET config.
*/
private void setBinaryConfiguration(IgniteConfiguration igniteCfg, PlatformDotNetConfigurationEx dotNetCfg) {
// Check marshaller.
Marshaller marsh = igniteCfg.getMarshaller();
if (marsh == null) {
igniteCfg.setMarshaller(new BinaryMarshaller());
dotNetCfg.warnings(Collections.singleton("Marshaller is automatically set to " +
BinaryMarshaller.class.getName() + " (other nodes must have the same marshaller type)."));
}
else if (!(marsh instanceof BinaryMarshaller))
throw new IgniteException("Unsupported marshaller (only " + BinaryMarshaller.class.getName() +
" can be used when running Apache Ignite.NET): " + marsh.getClass().getName());
BinaryConfiguration bCfg = igniteCfg.getBinaryConfiguration();
}
示例2: configuration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public IgniteConfiguration configuration() {
if (staticCfg != null)
return staticCfg;
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setMarshaller(marshaller);
cfg.setNodeId(nodeId);
cfg.setMBeanServer(jmx);
cfg.setIgniteHome(home);
cfg.setLocalHost(locHost);
try {
cfg.setWorkDirectory(U.defaultWorkDirectory());
}
catch (IgniteCheckedException e) {
throw new IgniteException("Failed to get default work directory.", e);
}
return cfg;
}
示例3: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("deprecation")
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName, IgniteTestResources rsrcs)
throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName, rsrcs);
DataStorageConfiguration memCfg = new DataStorageConfiguration()
.setDefaultDataRegionConfiguration(
new DataRegionConfiguration().setMaxSize(300 * 1024 * 1024).setPersistenceEnabled(true))
.setStoragePath(workSubdir() + "/db")
.setWalArchivePath(workSubdir() + "/db/wal/archive")
.setWalPath(workSubdir() + "/db/wal")
.setWalMode(WALMode.LOG_ONLY);
cfg.setDataStorageConfiguration(memCfg);
cfg.setMarshaller(new OptimizedMarshaller());
return cfg;
}
示例4: setUp
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
@Before
public void setUp() {
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
ipFinder.setAddresses(Collections.singletonList(HOST));
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(ipFinder);
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setDiscoverySpi(discoSpi);
cfg.setPeerClassLoadingEnabled(true);
cfg.setMarshaller(new OptimizedMarshaller());
cfg.setGridName("test");
ignite = Ignition.start(cfg);
Properties props = new Properties();
props.setProperty(IgniteSqlInterpreter.IGNITE_JDBC_URL, "jdbc:ignite:cfg://[email protected]");
intp = new IgniteSqlInterpreter(props);
CacheConfiguration<Integer, Person> cacheConf = new CacheConfiguration<>();
cacheConf.setIndexedTypes(Integer.class, Person.class);
cacheConf.setName("person");
IgniteCache<Integer, Person> cache = ignite.createCache(cacheConf);
cache.put(1, new Person("sun", 100));
cache.put(2, new Person("moon", 50));
assertEquals("moon", cache.get(2).getName());
intp.open();
}
示例5: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setMarshaller(new BinaryMarshaller());
return cfg;
}
示例6: check
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* Perform check.
*
* @param odbcCfg ODBC configuration.
* @param success Success flag. * @throws Exception If failed.
*/
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
private void check(OdbcConfiguration odbcCfg, boolean success) throws Exception {
final IgniteConfiguration cfg = super.getConfiguration();
cfg.setIgniteInstanceName(OdbcConfigurationValidationSelfTest.class.getName() + "-" +
NODE_IDX_GEN.incrementAndGet());
cfg.setLocalHost("127.0.0.1");
cfg.setOdbcConfiguration(odbcCfg);
cfg.setMarshaller(new BinaryMarshaller());
TcpDiscoverySpi spi = new TcpDiscoverySpi();
spi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
cfg.setDiscoverySpi(spi);
if (success)
startGrid(cfg.getIgniteInstanceName(), cfg);
else {
GridTestUtils.assertThrows(log, new Callable<Void>() {
@Override public Void call() throws Exception {
startGrid(cfg.getIgniteInstanceName(), cfg);
return null;
}
}, IgniteException.class, null);
}
}
示例7: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(final String igniteInstanceName) throws Exception {
final IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
if (igniteInstanceName != null && igniteInstanceName.startsWith("binary"))
cfg.setMarshaller(new BinaryMarshaller());
return cfg;
}
示例8: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(final String igniteInstanceName) throws Exception {
final IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setMarshaller(null);
return cfg;
}
示例9: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
// Use small system thread pool to reproduce the issue.
cfg.setSystemThreadPoolSize(IGNITE_THREAD_POOL_SIZE);
cfg.setMarshaller(new BinaryMarshaller());
return cfg;
}
示例10: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
CacheConfiguration<Integer, IndexedObject> ccfg = new CacheConfiguration<>(cacheName);
ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
ccfg.setRebalanceMode(CacheRebalanceMode.NONE);
ccfg.setIndexedTypes(Integer.class, IndexedObject.class);
ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
ccfg.setAffinity(new RendezvousAffinityFunction(false, 64 * 4)); // 64 per node
ccfg.setReadFromBackup(true);
cfg.setCacheConfiguration(ccfg);
DataStorageConfiguration memCfg = new DataStorageConfiguration()
.setDefaultDataRegionConfiguration(
new DataRegionConfiguration().setMaxSize(500 * 1024 * 1024).setPersistenceEnabled(true))
.setWalMode(WALMode.LOG_ONLY)
.setPageSize(PAGE_SIZE);
cfg.setDataStorageConfiguration(memCfg);
cfg.setMarshaller(null);
BinaryConfiguration binCfg = new BinaryConfiguration();
binCfg.setCompactFooter(false);
cfg.setBinaryConfiguration(binCfg);
return cfg;
}
示例11: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(ipFinder);
cfg.setDiscoverySpi(discoSpi);
cfg.setLocalHost("127.0.0.1");
if (flag)
cfg.setMarshaller(new JdkMarshaller());
else
cfg.setMarshaller(sameMarsh ? new JdkMarshaller() : new BinaryMarshaller());
// Flip flag.
flag = !flag;
return cfg;
}
示例12: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("deprecation")
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME));
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(disco);
cfg.setMarshaller(new BinaryMarshaller());
return cfg;
}
示例13: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setMarshaller(null);
final CacheConfiguration<String, MyMap> mapCacheConfig = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
mapCacheConfig.setCacheMode(CacheMode.PARTITIONED);
mapCacheConfig.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
mapCacheConfig.setBackups(1);
mapCacheConfig.setName("cache");
cfg.setCacheConfiguration(mapCacheConfig);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(discoSpi);
return cfg;
}
示例14: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
BinaryConfiguration bCfg = new BinaryConfiguration();
bCfg.setNameMapper(new BinaryBasicNameMapper(false));
bCfg.setIdMapper(new BinaryBasicIdMapper(false));
bCfg.setClassNames(Arrays.asList(TestObject1.class.getName(), TestObject2.class.getName()));
cfg.setBinaryConfiguration(bCfg);
cfg.setMarshaller(new BinaryMarshaller());
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
cfg.setCacheConfiguration(ccfg);
GridDefaultBinaryMappersBinaryMetaDataSelfTest.cfg = cfg;
return cfg;
}
示例15: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
if (!getTestIgniteInstanceName(0).equals(igniteInstanceName))
cfg.setClientMode(true);
CacheConfiguration ccfg = new CacheConfiguration();
ccfg.setName(CACHE_NAME);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
cfg.setCacheConfiguration(ccfg);
cfg.setMarshaller(new BinaryMarshaller());
cfg.setPeerClassLoadingEnabled(false);
return cfg;
}