本文整理汇总了Java中org.apache.ignite.configuration.IgniteConfiguration.setBinaryConfiguration方法的典型用法代码示例。如果您正苦于以下问题:Java IgniteConfiguration.setBinaryConfiguration方法的具体用法?Java IgniteConfiguration.setBinaryConfiguration怎么用?Java IgniteConfiguration.setBinaryConfiguration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.configuration.IgniteConfiguration
的用法示例。
在下文中一共展示了IgniteConfiguration.setBinaryConfiguration方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
cacheCfg.setCacheMode(cacheMode());
cacheCfg.setAtomicityMode(atomicityMode());
cacheCfg.setNearConfiguration(nearConfiguration());
cacheCfg.setWriteSynchronizationMode(writeSynchronizationMode());
cfg.setCacheConfiguration(cacheCfg);
BinaryConfiguration bCfg = new BinaryConfiguration();
bCfg.setTypeConfigurations(Arrays.asList(
new BinaryTypeConfiguration(TestObject.class.getName())));
cfg.setBinaryConfiguration(bCfg);
cfg.setMarshaller(new BinaryMarshaller());
return cfg;
}
示例2: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
cfg.setMarshaller(new BinaryMarshaller());
cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(IP_FINDER));
cfg.setCacheConfiguration(
new CacheConfiguration(cacheName)
.setCopyOnRead(true)
);
BinaryConfiguration bcfg = new BinaryConfiguration()
.setNameMapper(new BinaryBasicNameMapper(false));
cfg.setBinaryConfiguration(bcfg);
return cfg;
}
示例3: apply
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
@Override
public Ignite apply(ExtendedActorSystem system) {
final IgniteProperties properties = igniteConfigProvider.apply(system);
final IgniteConfiguration igniteConfiguration = new IgniteConfiguration();
igniteConfiguration.setClientMode(properties.isClientNode());
// durable file memory persistence
if (properties.isEnableFilePersistence()) {
DataStorageConfiguration persistentStoreConfiguration = new DataStorageConfiguration();
persistentStoreConfiguration.setStoragePath(properties.getIgnitePersistenceFilePath() + "/data/store");
persistentStoreConfiguration.setWalArchivePath(properties.getIgnitePersistenceFilePath() + "./data/walArchive");
igniteConfiguration.setDataStorageConfiguration(persistentStoreConfiguration);
}
// connector configuration
final ConnectorConfiguration connectorConfiguration = new ConnectorConfiguration();
connectorConfiguration.setPort(properties.getIgniteConnectorPort());
// common ignite configuration
igniteConfiguration.setMetricsLogFrequency(properties.getMetricsLogFrequency());
igniteConfiguration.setQueryThreadPoolSize(properties.getQueryThreadPoolSize());
igniteConfiguration.setDataStreamerThreadPoolSize(properties.getDataStreamerThreadPoolSize());
igniteConfiguration.setManagementThreadPoolSize(properties.getManagementThreadPoolSize());
igniteConfiguration.setPublicThreadPoolSize(properties.getPublicThreadPoolSize());
igniteConfiguration.setSystemThreadPoolSize(properties.getSystemThreadPoolSize());
igniteConfiguration.setRebalanceThreadPoolSize(properties.getRebalanceThreadPoolSize());
igniteConfiguration.setAsyncCallbackPoolSize(properties.getAsyncCallbackPoolSize());
igniteConfiguration.setPeerClassLoadingEnabled(properties.isPeerClassLoadingEnabled());
final BinaryConfiguration binaryConfiguration = new BinaryConfiguration();
binaryConfiguration.setCompactFooter(false);
igniteConfiguration.setBinaryConfiguration(binaryConfiguration);
// cluster tcp configuration
final TcpDiscoverySpi tcpDiscoverySpi = new TcpDiscoverySpi();
final TcpDiscoveryVmIpFinder tcpDiscoveryVmIpFinder = new TcpDiscoveryVmIpFinder();
// need to be changed when it come to real cluster configuration
tcpDiscoveryVmIpFinder.setAddresses(Arrays.asList(properties.getTcpDiscoveryAddresses() + properties.getIgniteServerPortRange()));
tcpDiscoverySpi.setIpFinder(tcpDiscoveryVmIpFinder);
igniteConfiguration.setDiscoverySpi(new TcpDiscoverySpi());
final Ignite ignite = Ignition.start(igniteConfiguration);
Runtime.getRuntime().addShutdownHook(new Thread(ignite::close));
return ignite;
}
示例4: createConfig
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
private IgniteConfiguration createConfig() {
IgniteConfiguration config = new IgniteConfiguration();
config.setClientMode( false );
BinaryConfiguration binaryConfiguration = new BinaryConfiguration();
binaryConfiguration.setNameMapper( new BinaryBasicNameMapper( true ) );
binaryConfiguration.setCompactFooter( false ); // it is necessary only for embedded collections (@ElementCollection)
config.setBinaryConfiguration( binaryConfiguration );
TransactionConfiguration transactionConfiguration = new TransactionConfiguration();
transactionConfiguration.setDefaultTxConcurrency( TransactionConcurrency.OPTIMISTIC );
transactionConfiguration.setDefaultTxIsolation( TransactionIsolation.READ_COMMITTED );
config.setTransactionConfiguration( transactionConfiguration );
return config;
}
示例5: binaryMarshaller
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
*
*/
protected BinaryMarshaller binaryMarshaller(
BinaryNameMapper nameMapper,
BinaryIdMapper mapper,
BinarySerializer serializer,
Collection<BinaryTypeConfiguration> cfgs
) throws IgniteCheckedException {
IgniteConfiguration iCfg = new IgniteConfiguration();
BinaryConfiguration bCfg = new BinaryConfiguration();
bCfg.setNameMapper(nameMapper);
bCfg.setIdMapper(mapper);
bCfg.setSerializer(serializer);
bCfg.setTypeConfigurations(cfgs);
iCfg.setBinaryConfiguration(bCfg);
BinaryContext ctx = new BinaryContext(BinaryNoopMetadataHandler.instance(), iCfg, new NullLogger());
BinaryMarshaller marsh = new BinaryMarshaller();
marsh.setContext(new MarshallerContextTestImpl(null));
IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg);
return marsh;
}
示例6: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
if (register) {
BinaryConfiguration bCfg = new BinaryConfiguration();
BinaryTypeConfiguration enumCfg = new BinaryTypeConfiguration(EnumType.class.getName());
enumCfg.setEnum(true);
if (igniteInstanceName.equals(WRONG_CONF_NODE_NAME))
enumCfg.setEnumValues(F.asMap(EnumType.ONE.name(),
EnumType.ONE.ordinal(),
EnumType.TWO.name(),
EnumType.ONE.ordinal()));
else
enumCfg.setEnumValues(F.asMap(EnumType.ONE.name(),
EnumType.ONE.ordinal(),
EnumType.TWO.name(),
EnumType.TWO.ordinal()));
bCfg.setTypeConfigurations(Arrays.asList(enumCfg, new BinaryTypeConfiguration(EnumHolder.class.getName())));
cfg.setBinaryConfiguration(bCfg);
}
cfg.setMarshaller(new BinaryMarshaller());
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setName(CACHE_NAME);
ccfg.setCacheMode(CacheMode.PARTITIONED);
cfg.setCacheConfiguration(ccfg);
return cfg;
}
示例7: 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;
}
示例8: config
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* @return Grid configuration.
*/
private IgniteConfiguration config() {
IgniteConfiguration cfg = new IgniteConfiguration();
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(disco);
cfg.setUserAttributes(F.asMap(ATTR_KEY, true));
cfg.setConnectorConfiguration(null);
cfg.setIgniteInstanceName(getTestIgniteInstanceName());
cfg.setBinaryConfiguration(new BinaryConfiguration());
return cfg;
}
示例9: beforeTest
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
super.beforeTest();
ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), new IgniteConfiguration(), new NullLogger());
marsh = new BinaryMarshaller();
IgniteConfiguration iCfg = new IgniteConfiguration();
BinaryConfiguration bCfg = new BinaryConfiguration();
bCfg.setTypeConfigurations(Arrays.asList(new BinaryTypeConfiguration(TestObject.class.getName())));
bCfg.setCompactFooter(compactFooter());
iCfg.setBinaryConfiguration(bCfg);
marsh.setContext(new MarshallerContextTestImpl(null));
IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg);
}
示例10: createMarshaller
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* Create marshaller.
*
* @return Binary marshaller.
* @throws Exception If failed.
*/
protected BinaryMarshaller createMarshaller() throws Exception {
BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), new IgniteConfiguration(),
log());
BinaryMarshaller marsh = new BinaryMarshaller();
BinaryConfiguration bCfg = new BinaryConfiguration();
IgniteConfiguration iCfg = new IgniteConfiguration();
iCfg.setBinaryConfiguration(bCfg);
marsh.setContext(new MarshallerContextTestImpl(null));
IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg);
return marsh;
}
示例11: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
cacheCfg.setCacheMode(cacheMode());
cacheCfg.setAtomicityMode(atomicityMode());
cacheCfg.setNearConfiguration(nearConfiguration());
cacheCfg.setWriteSynchronizationMode(writeSynchronizationMode());
cfg.setCacheConfiguration(cacheCfg);
BinaryConfiguration bCfg = new BinaryConfiguration();
bCfg.setTypeConfigurations(Arrays.asList(
new BinaryTypeConfiguration(TestObject.class.getName())));
cfg.setBinaryConfiguration(bCfg);
cfg.setMarshaller(new BinaryMarshaller());
return cfg;
}
示例12: binaryMarshaller
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* @return Binary marshaller.
* @throws IgniteCheckedException if failed.
*/
private BinaryMarshaller binaryMarshaller() throws IgniteCheckedException {
IgniteConfiguration iCfg = new IgniteConfiguration();
BinaryConfiguration bCfg = new BinaryConfiguration();
iCfg.setBinaryConfiguration(bCfg);
BinaryContext ctx = new BinaryContext(BinaryCachingMetadataHandler.create(), iCfg, new NullLogger());
BinaryMarshaller marsh = new BinaryMarshaller();
marsh.setContext(new MarshallerContextTestImpl(null));
IgniteUtils.invoke(BinaryMarshaller.class, marsh, "setBinaryContext", ctx, iCfg);
return marsh;
}
示例13: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setClientMode(isClient);
cfg.setMarshaller(new BinaryMarshaller());
cfg.setBinaryConfiguration(binaryCfg);
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);
BinaryMarshaller marsh = new BinaryMarshaller();
BinaryConfiguration bCfg = new BinaryConfiguration();
bCfg.setClassNames(Arrays.asList(TestObject1.class.getName(), TestObject2.class.getName()));
BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration();
typeCfg.setTypeName(TestObject1.class.getName());
CacheKeyConfiguration keyCfg = new CacheKeyConfiguration(TestObject1.class.getName(), "val2");
cfg.setCacheKeyConfiguration(keyCfg);
bCfg.setTypeConfigurations(Arrays.asList(typeCfg));
cfg.setBinaryConfiguration(bCfg);
if (igniteInstanceName.equals(getTestIgniteInstanceName(gridCount() - 1)))
cfg.setClientMode(true);
cfg.setMarshaller(marsh);
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true);
return cfg;
}
示例15: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(final String igniteInstanceName) throws Exception {
final IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
final ServiceConfiguration scfg = new ServiceConfiguration();
if (igniteInstanceName.endsWith("0")) {
scfg.setName("testService");
scfg.setService(srvc);
scfg.setMaxPerNodeCount(1);
scfg.setTotalCount(1);
scfg.setNodeFilter(new NodeFilter());
final Map<String, String> attrs = new HashMap<>();
attrs.put("clusterGroup", "0");
cfg.setUserAttributes(attrs);
cfg.setServiceConfiguration(scfg);
}
cfg.setMarshaller(null);
final BinaryConfiguration binCfg = new BinaryConfiguration();
// Despite defaults explicitly set to lower case.
binCfg.setIdMapper(new BinaryBasicIdMapper(true));
cfg.setBinaryConfiguration(binCfg);
return cfg;
}