本文整理了Java中org.apache.ignite.internal.util.typedef.F.contains()
方法的一些代码示例,展示了F.contains()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。F.contains()
方法的具体详情如下:
包路径:org.apache.ignite.internal.util.typedef.F
类名称:F
方法名:contains
暂无
代码示例来源:origin: apache/ignite
/**
* Checks whether or not this event is an internal event.
* <p>
* Internal event types are always recordable for notification purposes
* but may not be sent down to SPI level for storage and subsequent querying.
*
* @param type Event type.
* @return {@code true} if this is an internal event.
*/
private boolean isInternalEvent(int type) {
return type == EVT_DISCOVERY_CUSTOM_EVT || F.contains(EVTS_DISCOVERY_ALL, type);
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public boolean hasKey(KeyCacheObject key) {
return F.contains(keys, key);
}
代码示例来源:origin: apache/ignite
/**
* @param arr Sorted array to search in.
* @param val Value.
* @return {@code True} if value has been found.
*/
private boolean binarySearch(@Nullable int[] arr, int val) {
if (F.isEmpty(arr))
return false;
// If length is relatively small, full iteration is faster.
return arr.length <= 128 ? F.contains(arr, val) : Arrays.binarySearch(arr, val) >= 0;
}
代码示例来源:origin: apache/ignite
/**
* @param failedNodes Node failed as result of resolve process.
*/
void onFinishResolve(Set<Long> failedNodes) {
Map<Long, GridFutureAdapter<Boolean>> futs;
synchronized (this) {
if (state == State.DONE) {
assert resErr != null;
return;
}
assert state == State.RESOLVE_STARTED : state;
state = State.DONE;
resFailedNodes = failedNodes;
futs = nodeFuts; // nodeFuts should not be modified after state changed to DONE.
}
for (Map.Entry<Long, GridFutureAdapter<Boolean>> e : futs.entrySet()) {
Boolean res = !F.contains(resFailedNodes, e.getKey());
e.getValue().onDone(res);
}
onDone();
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public ClientProtocol create(Configuration conf) throws IOException {
if (FRAMEWORK_NAME.equals(conf.get(MRConfig.FRAMEWORK_NAME))) {
Collection<String> addrs = conf.getTrimmedStringCollection(MRConfig.MASTER_ADDRESS);
if (F.isEmpty(addrs))
throw new IOException("Failed to create client protocol because Ignite node addresses are not " +
"specified (did you set " + MRConfig.MASTER_ADDRESS + " property?).");
if (F.contains(addrs, "local"))
throw new IOException("Local execution mode is not supported, please point " +
MRConfig.MASTER_ADDRESS + " to real Ignite nodes.");
Collection<String> addrs0 = new ArrayList<>(addrs.size());
// Set up port by default if need
for (String addr : addrs) {
if (!addr.contains(":"))
addrs0.add(addr + ':' + ConnectorConfiguration.DFLT_TCP_PORT);
else
addrs0.add(addr);
}
return new HadoopClientProtocol(conf, client(conf.get(MRConfig.MASTER_ADDRESS), addrs0));
}
return null;
}
代码示例来源:origin: apache/ignite
/**
* Checks for explicit events configuration.
*
* @param ignite Grid instance.
* @return {@code true} if all task events explicitly specified in configuration.
*/
public static boolean checkExplicitTaskMonitoring(Ignite ignite) {
int[] evts = ignite.configuration().getIncludeEventTypes();
if (F.isEmpty(evts))
return false;
for (int evt : VISOR_TASK_EVTS) {
if (!F.contains(evts, evt))
return false;
}
return true;
}
代码示例来源:origin: apache/ignite
/**
* @param nodeQueries Active queries map.
* @param nodes Cluster nodes.
* @param mgr Discovery manager.
*/
void init(GridLongList nodeQueries, Collection<ClusterNode> nodes, GridDiscoveryManager mgr) {
synchronized (this) {
assert !initDone;
assert waitNodes == null;
waitNodes = new HashSet<>();
for (ClusterNode node : nodes) {
if (!node.isLocal() && mgr.alive(node) && !F.contains(rcvd, node.id()))
waitNodes.add(node.id());
}
initDone = waitNodes.isEmpty();
if (nodeQueries != null)
mergeToActiveQueries(mgr.localNode().id(), nodeQueries);
if (initDone && !prevQueriesDone)
prevQueriesDone = activeQueries.isEmpty() && rcvdAcks.isEmpty();
}
}
代码示例来源:origin: apache/ignite
/**
* @param arr Array.
* @param sort {@code True} to sort.
*/
private static void doArray(long[] arr, boolean sort) {
int lim = 10000;
for (int i = 0; i < arr.length; i++)
arr[i] = ThreadLocalRandom.current().nextLong(lim);
Arrays.sort(arr);
long start = System.currentTimeMillis();
for (int i = 0; i < MAX; i++) {
if (sort)
Arrays.binarySearch(arr, ThreadLocalRandom.current().nextInt(lim));
else
F.contains(arr, ThreadLocalRandom.current().nextInt(lim));
}
long time = System.currentTimeMillis() - start;
X.println("Array long test time [time=" + time + ", len=" + arr.length + ", sort=" + sort + ']');
}
代码示例来源:origin: apache/ignite
/**
* @param arr Array.
* @param sort {@code True} to sort.
*/
private static void doArray(int[] arr, boolean sort) {
int lim = 10000;
for (int i = 0; i < arr.length; i++)
arr[i] = ThreadLocalRandom.current().nextInt(lim);
Arrays.sort(arr);
long start = System.currentTimeMillis();
for (int i = 0; i < MAX; i++) {
if (sort)
Arrays.binarySearch(arr, ThreadLocalRandom.current().nextInt(lim));
else
F.contains(arr, ThreadLocalRandom.current().nextInt(lim));
}
long time = System.currentTimeMillis() - start;
X.println("Array test time [time=" + time + ", len=" + arr.length + ", sort=" + sort + ']');
}
代码示例来源:origin: apache/ignite
if (topVer.topologyVersion() > 0 && !F.contains(allIds, id))
continue;
代码示例来源:origin: apache/ignite
/**
* @param node Node.
* @return Future finished when communication error resolve is done or {@code null} if another
* resolve process should be started.
*/
@Nullable IgniteInternalFuture<Boolean> nodeStatusFuture(ClusterNode node) {
GridFutureAdapter<Boolean> fut;
synchronized (this) {
if (state == State.DONE) {
if (resolveTopVer != 0 && node.order() <= resolveTopVer) {
Boolean res = !F.contains(resFailedNodes, node.order());
return new GridFinishedFuture<>(res);
}
else
return null;
}
fut = nodeFuts.get(node.order());
if (fut == null)
nodeFuts.put(node.order(), fut = new GridFutureAdapter<>());
}
if (impl.node(node.order()) == null)
fut.onDone(false);
return fut;
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackC)
throws IgniteSpiException {
if (msg instanceof GridIoMessage) {
Object msg0 = ((GridIoMessage)msg).message();
synchronized (this) {
if (recordCls != null && msg0.getClass().equals(recordCls))
recordedMsgs.add(msg0);
Set<UUID> blockNodes = blockCls.get(msg0.getClass());
if (F.contains(blockNodes, node.id())) {
log.info("Block message [node=" +
node.attribute(IgniteNodeAttributes.ATTR_IGNITE_INSTANCE_NAME) + ", msg=" + msg0 + ']');
blockedMsgs.add(new T2<>(node, (GridIoMessage)msg));
notifyAll();
return;
}
}
}
super.sendMessage(node, msg, ackC);
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackC)
throws IgniteSpiException {
if (msg instanceof GridIoMessage) {
Object msg0 = ((GridIoMessage)msg).message();
synchronized (this) {
Set<UUID> blockNodes = blockCls.get(msg0.getClass());
if (F.contains(blockNodes, node.id())) {
log.info("Block message [node=" +
node.attribute(IgniteNodeAttributes.ATTR_IGNITE_INSTANCE_NAME) + ", msg=" + msg0 + ']');
blockedMsgs.add(new T2<>(node, (GridIoMessage)msg));
return;
}
}
}
super.sendMessage(node, msg, ackC);
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackClosure)
throws IgniteSpiException {
if (msg instanceof GridIoMessage) {
Object msg0 = ((GridIoMessage)msg).message();
synchronized (this) {
Set<UUID> blockNodes = blockCls.get(msg0.getClass());
if (F.contains(blockNodes, node.id())) {
log.info("Block message [node=" +
node.attribute(IgniteNodeAttributes.ATTR_IGNITE_INSTANCE_NAME) + ", msg=" + msg0 + ']');
blockedMsgs.add(new T2<>(node, (GridIoMessage)msg));
return;
}
}
}
super.sendMessage(node, msg, ackClosure);
}
代码示例来源:origin: apache/ignite
@Override public boolean apply(Event evt) {
return evt.localOrder() > startEvtOrder &&
(arg.getTypeArgument() == null || F.contains(arg.getTypeArgument(), evt.type())) &&
(evt.timestamp() >= startEvtTime) &&
(arg.getTaskName() == null || filterByTaskName(evt, arg.getTaskName())) &&
(arg.getTaskSessionId() == null || filterByTaskSessionId(evt, arg.getTaskSessionId()));
}
});
代码示例来源:origin: apache/ignite
if (!F.contains(rmvIdxs, head)) {
GridCacheQueueHeader newHdr = new GridCacheQueueHeader(hdr.id(),
hdr.capacity(),
代码示例来源:origin: apache/ignite
if (parts == null || !F.contains(parts, part.id())) {
代码示例来源:origin: apache/ignite
/**
* @param e Transaction entry.
* @param primaryOnly Flag to include backups into check or not.
* @return {@code True} if entry is locally mapped as a primary or back up node.
*/
protected boolean isNearLocallyMapped(IgniteTxEntry e, boolean primaryOnly) {
GridCacheContext cacheCtx = e.context();
if (!cacheCtx.isNear())
return false;
// Try to take either entry-recorded primary node ID,
// or transaction node ID from near-local transactions.
UUID nodeId = e.nodeId() == null ? local() ? this.nodeId : null : e.nodeId();
if (nodeId != null && nodeId.equals(cctx.localNodeId()))
return true;
GridCacheEntryEx cached = e.cached();
int part = cached != null ? cached.partition() : cacheCtx.affinity().partition(e.key());
List<ClusterNode> affNodes = cacheCtx.affinity().nodesByPartition(part, topologyVersion());
e.locallyMapped(F.contains(affNodes, cctx.localNode()));
if (primaryOnly) {
ClusterNode primary = F.first(affNodes);
if (primary == null && !cacheCtx.affinityNode())
return false;
assert primary != null : "Primary node is null for affinity nodes: " + affNodes;
return primary.isLocal();
}
else
return e.locallyMapped();
}
代码示例来源:origin: apache/ignite
if (F.contains(skipped, i))
continue;
if (F.contains(failed, key))
continue;
if (F.contains(nearValsIdxs, i)) {
val = res.nearValue(nearValIdx);
代码示例来源:origin: apache/ignite
if (F.contains(msg.failedNodes(), msg.creatorNodeId())) {
msg0 = new TcpDiscoveryStatusCheckMessage(msg);
内容来源于网络,如有侵权,请联系作者删除!