/** {@inheritDoc} */ @Override protected void addNearKey(KeyCacheObject key, GridDhtCacheEntry.ReaderId[] readers) { if (mappings == null) mappings = U.newHashMap(readers.length); }
/** {@inheritDoc} */ @Override protected void addDhtKey(KeyCacheObject key, List<ClusterNode> dhtNodes) { if (mappings == null) { allUpdated = true; mappings = U.newHashMap(dhtNodes.size()); } }
/** * @param ctx Kernal context. * @param jobId Job ID. */ public GridJobContextImpl(@Nullable GridKernalContext ctx, IgniteUuid jobId) { assert jobId != null; this.ctx = ctx; this.jobId = jobId; attrs = U.newHashMap(1); }
/** * @param locInfos Locale infos. */ private Map<UUID, LocalRoutineInfo> copyLocalInfos(Map<UUID, LocalRoutineInfo> locInfos) { Map<UUID, LocalRoutineInfo> res = U.newHashMap(locInfos.size()); for (Map.Entry<UUID, LocalRoutineInfo> e : locInfos.entrySet()) res.put(e.getKey(), e.getValue()); return res; }
/** * @param map Full counters map. * @return Regular java map with counters. */ public static Map<Integer, T2<Long, Long>> toCountersMap(CachePartitionFullCountersMap map) { int partsCnt = map.updCntrs.length; Map<Integer, T2<Long, Long>> map0 = U.newHashMap(partsCnt); for (int p = 0; p < partsCnt; p++) map0.put(p, new T2<>(map.initialUpdCntrs[p], map.updCntrs[p])); return map0; }
/** {@inheritDoc} */ @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, @Nullable Object arg) { assert !subgrid.isEmpty(); Map<ComputeJobAdapter, ClusterNode> map = U.newHashMap(subgrid.size()); // Put all jobs onto one node. for (int i = 0; i < N_JOBS; i++) map.put(new GridJobStealingJob(5000L), subgrid.get(0)); return map; }
/** * @param fields Field infos. */ ClassFields(List<FieldInfo> fields) { this.fields = fields; nameToIndex = U.newHashMap(fields.size()); for (int i = 0; i < fields.size(); ++i) nameToIndex.put(fields.get(i).name(), i); }
/** {@inheritDoc} */ @Override public <K, V> Map<K, V> properties() { if (props == null) props = U.newHashMap(1); return (Map<K, V>)props; }
/** * Maps list by node ID. * * @param subgrid Subgrid. * @return Map. */ private Map<UUID, ClusterNode> mapSubgrid(Collection<ClusterNode> subgrid) { Map<UUID, ClusterNode> res = U.newHashMap(subgrid.size()); for (ClusterNode node : subgrid) res.put(node.id(), node); return res; } }
/** * @param m Map. * @return Converted map. */ private static Map<UUID, int[]> convert(Map<ClusterNode, IntArray> m) { if (m == null) return null; Map<UUID, int[]> res = U.newHashMap(m.size()); for (Map.Entry<ClusterNode,IntArray> entry : m.entrySet()) res.put(entry.getKey().id(), toArray(entry.getValue())); return res; }
/** {@inheritDoc} */ @Override public void collectJoiningNodeData(DiscoveryDataBag dataBag) { Map<Integer, BinaryMetadataHolder> res = U.newHashMap(metadataLocCache.size()); for (Map.Entry<Integer,BinaryMetadataHolder> e : metadataLocCache.entrySet()) res.put(e.getKey(), e.getValue()); dataBag.addJoiningNodeData(BINARY_PROC.ordinal(), (Serializable) res); }
/** * Sets data configurations. * * @param dataCfgs Data configurations. * @return {@code this} for chaining. */ public GridClientConfiguration setDataConfigurations(Collection<? extends GridClientDataConfiguration> dataCfgs) { this.dataCfgs = U.newHashMap(dataCfgs.size()); for (GridClientDataConfiguration dataCfg : dataCfgs) this.dataCfgs.put(dataCfg.getName(), new GridClientDataConfiguration(dataCfg)); return this; }
/** {@inheritDoc} */ @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, Boolean restart) { assert restart != null; this.restart = restart; Map<ComputeJob, ClusterNode> jobs = U.newHashMap(subgrid.size()); for (ClusterNode n : subgrid) if (!daemon(n)) jobs.put(new IgniteKillJob(), n); return jobs; }
/** {@inheritDoc} */ @Override public boolean unregister(String rsrcName) { Collection<ClassLoader> rmvClsLdrs = new LinkedList<>(); Map<String, String> rsrcs = U.newHashMap(1); rsrcs.put(rsrcName, rsrcName); boolean rmv = removeResources(null, rsrcs, rmvClsLdrs); for (ClassLoader cldLdr : rmvClsLdrs) onClassLoaderReleased(cldLdr); return rmv; }
/** {@inheritDoc} */ @Override public Map<Integer, BinaryType> metadata(Collection<Integer> typeIds) throws BinaryObjectException { try { Map<Integer, BinaryType> res = U.newHashMap(metadataLocCache.size()); for (Map.Entry<Integer, BinaryMetadataHolder> e : metadataLocCache.entrySet()) res.put(e.getKey(), e.getValue().metadata().wrap(binaryCtx)); return res; } catch (CacheException e) { throw new BinaryObjectException(e); } }
/** * @param grp Cache group. * @param topNodes Topology nodes. */ public void validate(CacheGroupContext grp, Collection<ClusterNode> topNodes) { grpValidRes = U.newHashMap(1); grpValidRes.put(grp.groupId(), validateCacheGroup(grp,topNodes)); }
/** {@inheritDoc} */ @Override public void collectGridNodeData(DiscoveryDataBag dataBag) { if (!dataBag.commonDataCollectedFor(BINARY_PROC.ordinal())) { Map<Integer, BinaryMetadataHolder> res = U.newHashMap(metadataLocCache.size()); for (Map.Entry<Integer,BinaryMetadataHolder> e : metadataLocCache.entrySet()) res.put(e.getKey(), e.getValue()); dataBag.addGridCommonData(BINARY_PROC.ordinal(), (Serializable) res); } }
/** {@inheritDoc} */ @Override public Map<UUID, Integer> reduce(List<ComputeJobResult> results) { Map<UUID, Integer> ret = U.newHashMap(results.size()); for (ComputeJobResult res : results) { if (log.isInfoEnabled()) log.info("Job result: " + res.getData()); UUID resUuid = (UUID)res.getData(); ret.put(resUuid, ret.containsKey(resUuid) ? ret.get(resUuid) + 1 : 1); } return ret; }
/** * @return Active task futures. */ @SuppressWarnings("unchecked") public <R> Map<IgniteUuid, ComputeTaskFuture<R>> taskFutures() { Map<IgniteUuid, ComputeTaskFuture<R>> res = U.newHashMap(tasks.size()); for (GridTaskWorker taskWorker : tasks.values()) { ComputeTaskInternalFuture<R> fut = taskWorker.getTaskFuture(); res.put(fut.getTaskSession().getId(), fut.publicFuture()); } return res; }
/** {@inheritDoc} */ @Override public Map<String, CacheConfiguration<?, ?>> startedCaches() { Map<Integer, DynamicCacheDescriptor> cachesMap = ctx.affinity().caches(); Map<String, CacheConfiguration<?, ?>> res = U.newHashMap(cachesMap.size()); for (DynamicCacheDescriptor desc : cachesMap.values()) { if (desc.cacheType().userCache()) res.put(desc.cacheName(), desc.cacheConfiguration()); } return res; }