本文整理汇总了Java中org.apache.ignite.configuration.IgniteConfiguration.setUserAttributes方法的典型用法代码示例。如果您正苦于以下问题:Java IgniteConfiguration.setUserAttributes方法的具体用法?Java IgniteConfiguration.setUserAttributes怎么用?Java IgniteConfiguration.setUserAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.configuration.IgniteConfiguration
的用法示例。
在下文中一共展示了IgniteConfiguration.setUserAttributes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startIgnite_send
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
public static Ignite startIgnite_send(Map<String, String> group_attrs)
{
IgniteConfiguration cfg = new IgniteConfiguration ();
cfg.setPeerClassLoadingEnabled (true);
// 设置群组
cfg.setUserAttributes(group_attrs);
//配置断点自动重连
TcpDiscoverySpi discoverySpi = new TcpDiscoverySpi();
discoverySpi.setNetworkTimeout (5000);
discoverySpi.setClientReconnectDisabled(true);
cfg.setDiscoverySpi(discoverySpi);
return Ignition.start(cfg);
}
示例2: startDownloadIgnite
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
public static Ignite startDownloadIgnite (Map<String,String> group_attrs,String cachename,String gridName) {
CacheConfiguration cacheCfg = new CacheConfiguration (cachename);
cacheCfg.setCacheMode (CacheMode.PARTITIONED);
IgniteConfiguration cfg = new IgniteConfiguration ();
cfg.setCacheConfiguration (cacheCfg);
cfg.setUserAttributes (group_attrs);
cfg.setPeerClassLoadingEnabled (true);
cfg.setGridName(gridName);
Ignite ignite = Ignition.start (cfg);
// Collection<UUID> node_ids = new ArrayList<> ();
//
// ClusterGroup cg = ignite.cluster ().forRemotes ();
// Collection<ClusterNode> clusterNodes = cg.nodes ();
// for (ClusterNode e : clusterNodes) {
// node_ids.add (e.id ());
// }
// String url = "https://ws1.sinaimg.cn/large/006tNc79ly1fn4o49dqcaj30sg0sgmzo.jpg
// ";
return ignite;
}
示例3: startIgnite_default
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
public static Ignite startIgnite_default(Map<String, String> group_attrs,String group_key,String group_value)
{
IgniteConfiguration cfg = new IgniteConfiguration ();
cfg.setPeerClassLoadingEnabled (true);
cfg.setUserAttributes (group_attrs);
//配置断点自动重连
TcpDiscoverySpi discoverySpi = new TcpDiscoverySpi();
discoverySpi.setNetworkTimeout (5000);
discoverySpi.setClientReconnectDisabled(true);
cfg.setDiscoverySpi(discoverySpi);
Ignite ignite = Ignition.start (cfg);
IgniteMessaging igniteMessaging = ignite.message (ignite.cluster ().forAttribute (group_key,group_value));
//监听的消息是接受方而不是发送方,监听的是接受这个动作而不是发送这个东作,所以其实这里填写local就可以了
igniteMessaging.localListen ("HelloMessageComing", (nodeID, msg) ->
{
try
{
System.out.println (msg);
}
catch (Exception e)
{
e.printStackTrace ();
}
return true;
});
return ignite;
}
示例4: serverConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* Create server configuration.
*
* @param idx Index.
* @param filter Whether to filter the node out of cache.
* @return Configuration.
* @throws Exception If failed.
*/
protected IgniteConfiguration serverConfiguration(int idx, boolean filter) throws Exception {
IgniteConfiguration cfg = commonConfiguration(idx);
if (filter)
cfg.setUserAttributes(Collections.singletonMap(ATTR_FILTERED, true));
return cfg;
}
示例5: serverConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* Create server configuration.
* @param nodeIdx Node index.
* @param filtered Whether this node should not be treated as affinity node.
* @return Configuration.
* @throws Exception if failed.
*/
private IgniteConfiguration serverConfiguration(int nodeIdx, boolean filtered) throws Exception {
IgniteConfiguration cfg = serverConfiguration(nodeIdx);
if (filtered)
cfg.setUserAttributes(Collections.singletonMap(ATTR_FILTERED, true));
return cfg;
}
示例6: 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 spi = new TcpDiscoverySpi();
spi.setIpFinder(ipFinder);
cfg.setFailureDetectionTimeout(Integer.MAX_VALUE);
cfg.setDiscoverySpi(spi);
CacheConfiguration cacheCfg = defaultCacheConfiguration();
cacheCfg.setCacheMode(PARTITIONED);
cacheCfg.setCacheStoreFactory(singletonFactory(store));
cacheCfg.setReadThrough(true);
cacheCfg.setWriteThrough(true);
cacheCfg.setLoadPreviousValue(true);
cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
cacheCfg.setAffinity(aff);
cacheCfg.setAtomicityMode(atomicityMode());
cacheCfg.setBackups(BACKUPS);
cacheCfg.setNearConfiguration(new NearCacheConfiguration());
cfg.setCacheConfiguration(cacheCfg);
cfg.setUserAttributes(F.asMap(GridCacheModuloAffinityFunction.IDX_ATTR, cntr.getAndIncrement()));
return cfg;
}
示例7: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setDiscoverySpi(discoverySpi());
cfg.setCacheConfiguration(cacheConfiguration());
cfg.setUserAttributes(F.asMap(IDX_ATTR, CNT.getAndIncrement()));
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);
cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(IP_FINDER));
if (attrs != null)
cfg.setUserAttributes(attrs);
return cfg;
}
示例9: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
CacheConfiguration cacheCfg = defaultCacheConfiguration();
cacheCfg.setCacheMode(PARTITIONED);
cacheCfg.setBackups(backups);
if (backups < 2)
cacheCfg.setAffinity(affinityFunction());
else
cacheCfg.setAffinity(affinityFunctionWithAffinityBackupFilter());
cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
cacheCfg.setRebalanceMode(SYNC);
cacheCfg.setAtomicityMode(TRANSACTIONAL);
TcpDiscoverySpi spi = new TcpDiscoverySpi();
spi.setIpFinder(IP_FINDER);
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setCacheConfiguration(cacheCfg);
cfg.setDiscoverySpi(spi);
cfg.setUserAttributes(F.asMap(SPLIT_ATTRIBUTE_NAME, splitAttrVal));
return cfg;
}
示例10: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setUserAttributes(F.asMap(TEST_ATTRIBUTE_NAME, testAttribute));
CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
cacheCfg.setCacheMode(CacheMode.REPLICATED);
cacheCfg.setName(STATIC_CACHE_NAME);
cfg.setCacheConfiguration(cacheCfg);
return cfg;
}
示例11: start
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* Start node with the given cache configuration.
*
* @param idx Index.
* @param client Client flag.
* @param clss Key-value classes.
* @return Node.
*/
private IgniteEx start(int idx, boolean client, Class... clss) throws Exception {
String name = getTestIgniteInstanceName(idx);
IgniteConfiguration cfg = getConfiguration(name);
cfg.setClientMode(client);
cfg.setLocalHost("127.0.0.1");
cfg.setDiscoverySpi(new TestTcpDiscoverySpi());
if (filterNodeName != null && F.eq(name, filterNodeName))
cfg.setUserAttributes(Collections.singletonMap("AFF_NODE", true));
IgniteEx res = (IgniteEx)Ignition.start(cfg);
createSqlCache(res, cacheConfiguration(clss));
return res;
}
示例12: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
DataStorageConfiguration memCfg = new DataStorageConfiguration().setDefaultDataRegionConfiguration(
new DataRegionConfiguration().setMaxSize(20 * 1024 * 1024));
cfg.setDataStorageConfiguration(memCfg);
TcpDiscoverySpi spi = (TcpDiscoverySpi)cfg.getDiscoverySpi();
spi.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(spi);
/** Clients cache */
CacheConfiguration<ClientKey, Client> clientCfg = new CacheConfiguration<>();
clientCfg.setName("cl");
clientCfg.setWriteSynchronizationMode(FULL_SYNC);
clientCfg.setAtomicityMode(TRANSACTIONAL);
clientCfg.setRebalanceMode(SYNC);
clientCfg.setBackups(2);
clientCfg.setAffinity(AFFINITY);
clientCfg.setIndexedTypes(ClientKey.class, Client.class);
/** Deposits cache */
CacheConfiguration<DepositKey, Deposit> depoCfg = new CacheConfiguration<>();
depoCfg.setName("de");
depoCfg.setWriteSynchronizationMode(FULL_SYNC);
depoCfg.setAtomicityMode(TRANSACTIONAL);
depoCfg.setRebalanceMode(SYNC);
depoCfg.setBackups(2);
depoCfg.setAffinity(AFFINITY);
depoCfg.setIndexedTypes(DepositKey.class, Deposit.class);
/** Regions cache. Uses default affinity. */
CacheConfiguration<Integer, Region> regionCfg = new CacheConfiguration<>();
regionCfg.setName("re");
regionCfg.setWriteSynchronizationMode(FULL_SYNC);
regionCfg.setAtomicityMode(TRANSACTIONAL);
regionCfg.setRebalanceMode(SYNC);
regionCfg.setCacheMode(CacheMode.REPLICATED);
regionCfg.setIndexedTypes(Integer.class, Region.class);
cfg.setCacheConfiguration(clientCfg, depoCfg, regionCfg);
if ("client".equals(gridName))
cfg.setClientMode(true);
else {
Integer reg = regionForGrid(gridName);
cfg.setUserAttributes(F.asMap(REGION_ATTR_NAME, reg));
log().info("Assigned region " + reg + " to grid " + gridName);
}
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.setPeerClassLoadingEnabled(false);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(discoSpi);
cfg.setMarshaller(marshaller());
cfg.setUserAttributes(Collections.singletonMap(NODE_NAME_ATTR, igniteInstanceName));
if (getTestIgniteInstanceName(CLIENT_NODE_WITH_EXT_CLASS_LOADER).equals(igniteInstanceName)
|| getTestIgniteInstanceName(CLIENT_NODE).equals(igniteInstanceName))
cfg.setClientMode(true);
if (extClsLdrGrids.contains(igniteInstanceName))
cfg.setClassLoader(extClsLdr);
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);
cfg.setPeerClassLoadingEnabled(false);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(discoSpi);
cfg.setMarshaller(marshaller());
cfg.setUserAttributes(Collections.singletonMap(NODE_NAME_ATTR, igniteInstanceName));
if (grp1.contains(igniteInstanceName))
cfg.setClassLoader(extClsLdr1);
if (grp2.contains(igniteInstanceName))
cfg.setClassLoader(extClsLdr2);
cfg.setClientMode(client);
return cfg;
}
开发者ID:apache,项目名称:ignite,代码行数:27,代码来源:IgniteServiceDeployment2ClassLoadersDefaultMarshallerTest.java
示例15: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi disc = new TcpDiscoverySpi();
disc.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(disc);
((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
if (include)
cfg.setUserAttributes(F.asMap("include", true));
return cfg;
}