本文整理汇总了Java中org.apache.ignite.configuration.IgniteConfiguration.setCacheKeyConfiguration方法的典型用法代码示例。如果您正苦于以下问题:Java IgniteConfiguration.setCacheKeyConfiguration方法的具体用法?Java IgniteConfiguration.setCacheKeyConfiguration怎么用?Java IgniteConfiguration.setCacheKeyConfiguration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.configuration.IgniteConfiguration
的用法示例。
在下文中一共展示了IgniteConfiguration.setCacheKeyConfiguration方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
CacheKeyConfiguration keyCfg = new CacheKeyConfiguration("MyCache", "affKey");
cfg.setCacheKeyConfiguration(keyCfg);
cfg.setPeerClassLoadingEnabled(false);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
cfg.setDiscoverySpi(disco);
return cfg;
}
示例2: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
CacheKeyConfiguration keyCfg = new CacheKeyConfiguration(TestKey.class.getName(), "affKey");
cfg.setCacheKeyConfiguration(keyCfg);
cfg.setPeerClassLoadingEnabled(false);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
cfg.setDiscoverySpi(disco);
return cfg;
}
示例3: 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);
CacheKeyConfiguration keyCfg = new CacheKeyConfiguration();
keyCfg.setTypeName(TestKeyWithAffinity.class.getName());
keyCfg.setAffinityKeyFieldName("affKey");
cfg.setCacheKeyConfiguration(keyCfg);
cfg.setClientMode(client);
return cfg;
}
示例4: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
if (customWorkSubDir != null)
cfg.setWorkDirectory(Paths.get(U.defaultWorkDirectory(), customWorkSubDir).toString());
cfg.setClientMode(clientMode);
cfg.setDataStorageConfiguration(
new DataStorageConfiguration()
.setWalMode(WALMode.LOG_ONLY)
.setDefaultDataRegionConfiguration(new DataRegionConfiguration()
.setPersistenceEnabled(true)
.setMaxSize(100 * 1024 * 1024))
);
BinaryConfiguration bCfg = new BinaryConfiguration();
BinaryTypeConfiguration binaryEnumCfg = new BinaryTypeConfiguration(EnumType.class.getName());
binaryEnumCfg.setEnum(true);
binaryEnumCfg.setEnumValues(F.asMap(EnumType.ENUM_VAL_0.name(),
EnumType.ENUM_VAL_0.ordinal(),
EnumType.ENUM_VAL_1.name(),
EnumType.ENUM_VAL_1.ordinal()));
bCfg.setTypeConfigurations(Arrays.asList(binaryEnumCfg));
cfg.setBinaryConfiguration(bCfg);
CacheKeyConfiguration dynamicMetaKeyCfg = new CacheKeyConfiguration(DYNAMIC_TYPE_NAME, DYNAMIC_INT_FIELD_NAME);
cfg.setCacheKeyConfiguration(dynamicMetaKeyCfg);
cfg.setCacheConfiguration(new CacheConfiguration()
.setName(CACHE_NAME)
.setAffinity(new RendezvousAffinityFunction())
.setCacheMode(CacheMode.REPLICATED));
return cfg;
}
示例5: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration();
typeCfg.setTypeName(AffinityTestKey.class.getName());
CacheKeyConfiguration keyCfg = new CacheKeyConfiguration(AffinityTestKey.class.getName(), "affKey");
cfg.setCacheKeyConfiguration(keyCfg);
BinaryConfiguration bCfg = new BinaryConfiguration();
bCfg.setTypeConfigurations(Collections.singleton(typeCfg));
cfg.setBinaryConfiguration(bCfg);
cfg.setMarshaller(new BinaryMarshaller());
return cfg;
}
示例6: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration c = super.getConfiguration(gridName);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(IP_FINDER);
c.setDiscoverySpi(disco);
c.setMarshaller(new BinaryMarshaller());
List<CacheConfiguration> ccfgs = new ArrayList<>();
CacheConfiguration ccfg = buildCacheConfiguration(gridName);
if (ccfg != null)
ccfgs.add(ccfg);
ccfgs.add(buildCacheConfiguration(CACHE_PERSON));
ccfgs.add(buildCacheConfiguration(CACHE_CALL));
c.setCacheConfiguration(ccfgs.toArray(new CacheConfiguration[ccfgs.size()]));
if (gridName.equals(NODE_CLIENT))
c.setClientMode(true);
c.setCacheKeyConfiguration(new CacheKeyConfiguration(CallKey.class));
return c;
}
示例7: 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;
}
示例8: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
BinaryTypeConfiguration typeCfg = new BinaryTypeConfiguration();
typeCfg.setTypeName(TestObject.class.getName());
BinaryConfiguration bCfg = new BinaryConfiguration();
bCfg.setTypeConfigurations(Collections.singleton(typeCfg));
cfg.setBinaryConfiguration(bCfg);
CacheKeyConfiguration keyCfg = new CacheKeyConfiguration(TestObject.class.getName(), "affKey");
CacheKeyConfiguration keyCfg2 = new CacheKeyConfiguration("TestObject2", "affKey");
cfg.setCacheKeyConfiguration(keyCfg, keyCfg2);
cfg.setMarshaller(new BinaryMarshaller());
if (!igniteInstanceName.equals(getTestIgniteInstanceName(GRID_CNT))) {
CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
cacheCfg.setCacheMode(PARTITIONED);
cfg.setCacheConfiguration(cacheCfg);
}
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
return cfg;
}
示例9: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(disco);
CacheConfiguration cacheCfg = createCacheConfig();
cacheCfg.setCacheStoreFactory(singletonFactory(new TestStore()));
CacheConfiguration binKeysCacheCfg = createCacheConfig();
binKeysCacheCfg.setCacheStoreFactory(singletonFactory(new MapCacheStoreStrategy.MapCacheStore()));
binKeysCacheCfg.setStoreKeepBinary(true);
binKeysCacheCfg.setName("BinKeysCache");
cfg.setCacheConfiguration(cacheCfg, binKeysCacheCfg);
cfg.setMarshaller(new BinaryMarshaller());
List<BinaryTypeConfiguration> binTypes = new ArrayList<>();
binTypes.add(new BinaryTypeConfiguration() {{
setTypeName("ArrayHashedKey");
}});
BinaryConfiguration binCfg = new BinaryConfiguration();
binCfg.setTypeConfigurations(binTypes);
cfg.setBinaryConfiguration(binCfg);
CacheKeyConfiguration arrayHashCfg = new CacheKeyConfiguration("ArrayHashedKey", "fld1");
cfg.setCacheKeyConfiguration(arrayHashCfg);
GridCacheBinaryObjectsAbstractSelfTest.cfg = cfg;
return cfg;
}