本文整理汇总了Java中org.apache.ignite.internal.util.typedef.internal.U.hasAnnotation方法的典型用法代码示例。如果您正苦于以下问题:Java U.hasAnnotation方法的具体用法?Java U.hasAnnotation怎么用?Java U.hasAnnotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.internal.util.typedef.internal.U
的用法示例。
在下文中一共展示了U.hasAnnotation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deploy
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @param cls Class to deploy.
* @param clsLdr Class loader.
* @throws IgniteCheckedException If deployment failed.
* @return Grid deployment.
*/
@Nullable public GridDeployment deploy(Class<?> cls, ClassLoader clsLdr) throws IgniteCheckedException {
if (clsLdr == null)
clsLdr = getClass().getClassLoader();
String clsName = cls.getName();
String lambdaParent = U.lambdaEnclosingClassName(clsName);
if (lambdaParent != null) {
clsName = lambdaParent;
// Need to override passed in class if class is Lambda.
try {
cls = Class.forName(clsName, true, clsLdr);
}
catch (ClassNotFoundException e) {
throw new IgniteCheckedException("Cannot deploy parent class for lambda: " + clsName, e);
}
}
if (clsLdr instanceof GridDeploymentClassLoader) {
GridDeploymentInfo ldr = (GridDeploymentInfo)clsLdr;
// Expecting that peer-deploy awareness handled on upper level.
if ((ldr.deployMode() == ISOLATED || ldr.deployMode() == PRIVATE) &&
(ctx.config().getDeploymentMode() == SHARED || ctx.config().getDeploymentMode() == CONTINUOUS) &&
!U.hasAnnotation(cls, GridInternal.class))
throw new IgniteCheckedException("Attempt to deploy class loaded in ISOLATED or PRIVATE mode on node with " +
"SHARED or CONTINUOUS deployment mode [cls=" + cls + ", clsDeployMode=" + ldr.deployMode() +
", localDeployMode=" + ctx.config().getDeploymentMode() + ']');
GridDeploymentMetadata meta = new GridDeploymentMetadata();
meta.alias(clsName);
meta.classLoader(clsLdr);
// Check for nested execution. In that case, if task
// is available locally by name, then we should ignore
// class loader ID.
GridDeployment dep = locStore.getDeployment(meta);
if (dep == null) {
dep = ldrStore.getDeployment(ldr.classLoaderId());
if (dep == null)
dep = verStore.getDeployment(ldr.classLoaderId());
}
return dep;
}
else if (locDep != null) {
if (ComputeTask.class.isAssignableFrom(cls)) {
ComputeTaskName taskNameAnn = locDep.annotation(cls, ComputeTaskName.class);
if (taskNameAnn != null)
locDep.addDeployedClass(cls, taskNameAnn.value());
}
return locDep;
}
else
return locStore.explicitDeploy(cls, clsLdr);
}
示例2: centralizedAffinityFunction
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @return {@code True} if affinity function has {@link AffinityCentralizedFunction} annotation.
*/
public boolean centralizedAffinityFunction() {
return U.hasAnnotation(aff, AffinityCentralizedFunction.class);
}
示例3: async
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @return {@code True} if listener should be executed in non-system thread.
*/
protected boolean async() {
return U.hasAnnotation(impl, IgniteAsyncCallback.class);
}
示例4: initialize
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public void initialize(@Nullable CacheStore cfgStore, Map sesHolders) throws IgniteCheckedException {
GridKernalContext ctx = igniteContext();
CacheConfiguration cfg = cacheConfiguration();
writeThrough = cfg.isWriteThrough();
readThrough = cfg.isReadThrough();
this.cfgStore = cfgStore;
store = cacheStoreWrapper(ctx, cfgStore, cfg);
singleThreadGate = store == null ? null : new CacheStoreBalancingWrapper<>(store,
cfg.getStoreConcurrentLoadAllThreshold());
ThreadLocal<SessionData> sesHolder0 = null;
if (cfgStore != null) {
sesHolder0 = ((Map<CacheStore, ThreadLocal>)sesHolders).get(cfgStore);
if (sesHolder0 == null) {
sesHolder0 = new ThreadLocal<>();
locSes = new ThreadLocalSession(sesHolder0);
if (ctx.resource().injectStoreSession(cfgStore, locSes))
sesHolders.put(cfgStore, sesHolder0);
}
else
locSes = new ThreadLocalSession(sesHolder0);
}
sesHolder = sesHolder0;
locStore = U.hasAnnotation(cfgStore, CacheLocalStore.class);
if (cfgStore instanceof CacheJdbcPojoStore)
alwaysKeepBinary = true;
}
示例5: skipDaemon
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @param comp Grid component.
* @return {@code true} if node running in daemon mode and component marked by {@code SkipDaemon} annotation.
*/
private boolean skipDaemon(GridComponent comp) {
return ctx.isDaemon() && U.hasAnnotation(comp.getClass(), SkipDaemon.class);
}