本文整理汇总了Java中org.apache.ignite.configuration.CacheConfiguration.getAffinity方法的典型用法代码示例。如果您正苦于以下问题:Java CacheConfiguration.getAffinity方法的具体用法?Java CacheConfiguration.getAffinity怎么用?Java CacheConfiguration.getAffinity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.configuration.CacheConfiguration
的用法示例。
在下文中一共展示了CacheConfiguration.getAffinity方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: lifecycleAwares
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* @param grp Cache group.
* @param ccfg Cache configuration.
* @param objs Extra components.
* @return Components provided in cache configuration which can implement {@link LifecycleAware} interface.
*/
private Iterable<Object> lifecycleAwares(CacheGroupContext grp, CacheConfiguration ccfg, Object... objs) {
Collection<Object> ret = new ArrayList<>(7 + objs.length);
if (grp.affinityFunction() != ccfg.getAffinity())
ret.add(ccfg.getAffinity());
ret.add(ccfg.getAffinityMapper());
ret.add(ccfg.getEvictionFilter());
ret.add(ccfg.getEvictionPolicyFactory());
ret.add(ccfg.getEvictionPolicy());
ret.add(ccfg.getInterceptor());
NearCacheConfiguration nearCfg = ccfg.getNearConfiguration();
if (nearCfg != null) {
ret.add(nearCfg.getNearEvictionPolicyFactory());
ret.add(nearCfg.getNearEvictionPolicy());
}
Collections.addAll(ret, objs);
return ret;
}
示例2: VisorCacheAffinityConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* Create data transfer object for affinity configuration properties.
*
* @param ccfg Cache configuration.
*/
public VisorCacheAffinityConfiguration(CacheConfiguration ccfg) {
AffinityFunction aff = ccfg.getAffinity();
function = compactClass(aff);
mapper = compactClass(ccfg.getAffinityMapper());
partitions = aff.partitions();
partitionedBackups = ccfg.getBackups();
Method mthd = findNonPublicMethod(aff.getClass(), "isExcludeNeighbors");
if (mthd != null) {
try {
exclNeighbors = (Boolean)mthd.invoke(aff);
}
catch (InvocationTargetException | IllegalAccessException ignored) {
// No-op.
}
}
}
示例3: configure
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected void configure(IgniteConfiguration cfg) {
super.configure(cfg);
for (CacheConfiguration ccfg : cfg.getCacheConfiguration()) {
AffinityFunction aff = ccfg.getAffinity();
int parts = aff != null ? aff.partitions() : RendezvousAffinityFunction.DFLT_PARTITION_COUNT;
ccfg.setGroupName("testGroup-parts" + parts);
}
}
开发者ID:apache,项目名称:ignite,代码行数:13,代码来源:IgnitePdsSingleNodeWithIndexingAndGroupPutGetPersistenceSelfTest.java
示例4: affinityFunctions
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* Find .NET affinity functions in configuration.
*
* @param cfg Configuration.
* @return affinity functions.
*/
private static List<PlatformDotNetAffinityFunction> affinityFunctions(IgniteConfiguration cfg) {
List<PlatformDotNetAffinityFunction> res = new ArrayList<>();
CacheConfiguration[] cacheCfg = cfg.getCacheConfiguration();
if (cacheCfg != null) {
for (CacheConfiguration ccfg : cacheCfg) {
if (ccfg.getAffinity() instanceof PlatformDotNetAffinityFunction)
res.add((PlatformDotNetAffinityFunction)ccfg.getAffinity());
}
}
return res;
}
示例5: suggestOptimizations
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* @param cfg Configuration to check for possible performance issues.
* @param hasStore {@code True} if store is configured.
*/
private void suggestOptimizations(CacheConfiguration cfg, boolean hasStore) {
GridPerformanceSuggestions perf = ctx.performance();
String msg = "Disable eviction policy (remove from configuration)";
if (cfg.getEvictionPolicyFactory() != null || cfg.getEvictionPolicy() != null)
perf.add(msg, false);
else
perf.add(msg, true);
if (cfg.getCacheMode() == PARTITIONED) {
perf.add("Disable near cache (set 'nearConfiguration' to null)", cfg.getNearConfiguration() == null);
if (cfg.getAffinity() != null)
perf.add("Decrease number of backups (set 'backups' to 0)", cfg.getBackups() == 0);
}
// Suppress warning if at least one ATOMIC cache found.
perf.add("Enable ATOMIC mode if not using transactions (set 'atomicityMode' to ATOMIC)",
cfg.getAtomicityMode() == ATOMIC);
// Suppress warning if at least one non-FULL_SYNC mode found.
perf.add("Disable fully synchronous writes (set 'writeSynchronizationMode' to PRIMARY_SYNC or FULL_ASYNC)",
cfg.getWriteSynchronizationMode() != FULL_SYNC);
if (hasStore && cfg.isWriteThrough())
perf.add("Enable write-behind to persistent store (set 'writeBehindEnabled' to true)",
cfg.isWriteBehindEnabled());
}
示例6: validateHashIdResolvers
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* @param node Joining node.
* @return Validation result or {@code null} in case of success.
*/
@Nullable private IgniteNodeValidationResult validateHashIdResolvers(ClusterNode node) {
if (!node.isClient()) {
for (DynamicCacheDescriptor desc : cacheDescriptors().values()) {
CacheConfiguration cfg = desc.cacheConfiguration();
if (cfg.getAffinity() instanceof RendezvousAffinityFunction) {
RendezvousAffinityFunction aff = (RendezvousAffinityFunction)cfg.getAffinity();
Object nodeHashObj = aff.resolveNodeHash(node);
for (ClusterNode topNode : ctx.discovery().allNodes()) {
Object topNodeHashObj = aff.resolveNodeHash(topNode);
if (nodeHashObj.hashCode() == topNodeHashObj.hashCode()) {
String errMsg = "Failed to add node to topology because it has the same hash code for " +
"partitioned affinity as one of existing nodes [cacheName=" +
cfg.getName() + ", existingNodeId=" + topNode.id() + ']';
String sndMsg = "Failed to add node to topology because it has the same hash code for " +
"partitioned affinity as one of existing nodes [cacheName=" +
cfg.getName() + ", existingNodeId=" + topNode.id() + ']';
return new IgniteNodeValidationResult(topNode.id(), errMsg, sndMsg);
}
}
}
}
}
return null;
}