/** * Creates new set based on the given map. * * @param map Map to be used for set implementation. */ public GridSetWrapper(Map<E, ?> map) { A.notNull(map, "map"); this.map = (Map<E, Object>)map; }
/** * Sets key manager algorithm that will be used to create a key manager. Notice that in most cased default value * suites well, however, on Android platform this value need to be set to <tt>X509<tt/>. * * @param keyAlgorithm Key algorithm name. */ public void setKeyAlgorithm(String keyAlgorithm) { A.notNull(keyAlgorithm, "keyAlgorithm"); this.keyAlgorithm = keyAlgorithm; }
/** * Sets SQL clause. * * @param sql SQL clause. * @return {@code this} For chaining. */ public SqlQuery<K, V> setSql(String sql) { A.notNull(sql, "sql"); this.sql = sql; return this; }
/** * Sets path to the key store file. This is a mandatory parameter since * ssl context could not be initialized without key manager. * * @param keyStoreFilePath Path to key store file. */ public void setKeyStoreFilePath(String keyStoreFilePath) { A.notNull(keyStoreFilePath, "keyStoreFilePath"); this.keyStoreFilePath = keyStoreFilePath; }
/** * Removes lsnr added by {@link #addListener(IgnitionListener)} method. * * @param lsnr Listener to remove. * @return {@code true} if lsnr was added before, {@code false} otherwise. */ public static boolean removeListener(IgnitionListener lsnr) { A.notNull(lsnr, "lsnr"); return lsnrs.remove(lsnr); }
/** {@inheritDoc} */ @Override public IgfsMode mode(IgfsPath path) { A.notNull(path, "path"); return modeRslvr.resolveMode(path); }
/** * Creates dense local on heap vector based on array of doubles. * * @param values Values. */ public static Vector of(double ... values) { A.notNull(values, "values"); return new DenseVector(values); }
/** {@inheritDoc} */ @Override public String typeName(String clsName) { A.notNull(clsName, "clsName"); return isSimpleName ? simpleName(clsName) : clsName; }
/** {@inheritDoc} */ @Override public <K, V> V getAttribute(K key) { A.notNull(key, "key"); checkFullSupport(); synchronized (mux) { return attrs != null ? (V)attrs.get(key) : null; } }
/** {@inheritDoc} */ @Override public final ClusterGroup forAttribute(String name, @Nullable final Object val) { A.notNull(name, "n"); return forPredicate(new AttributeFilter(name, val)); }
/** {@inheritDoc} */ @Override public void unlock(K key) throws IgniteCheckedException { A.notNull(key, "key"); if (keyCheck) validateCacheKey(key); unlockAll(Collections.singletonList(key)); }
/** * Converts given closure with arguments to grid job. * @param job Job. * @param arg Optional argument. * @return Job. */ private static <T, R> ComputeJob job(final IgniteClosure<T, R> job, @Nullable final T arg) { A.notNull(job, "job"); return job instanceof ComputeJobMasterLeaveAware ? new C1MLA<>(job, arg) : new C1<>(job, arg); }
/** {@inheritDoc} */ @Override public boolean contains(Object o) { A.notNull(o, "o"); for (Cache.Entry<K, V> e : map.values()) if (F.isAll(e, filter) && F.eq(e.getValue(), o)) return true; return false; } }
/** {@inheritDoc} */ @Nullable @Override public V getAndRemove(final K key) throws IgniteCheckedException { boolean statsEnabled = ctx.statisticsEnabled(); long start = statsEnabled ? System.nanoTime() : 0L; A.notNull(key, "key"); if (keyCheck) validateCacheKey(key); V prevVal = getAndRemove0(key); if (statsEnabled) metrics0().addRemoveAndGetTimeNanos(System.nanoTime() - start); return prevVal; }
/** {@inheritDoc} */ @Override public IgniteFuture<Void> cancelAsync(String name) { A.notNull(name, "name"); guard(); try { return (IgniteFuture<Void>)new IgniteFutureImpl<>(ctx.service().cancel(name)); } finally { unguard(); } }
/** {@inheritDoc} */ @Override public int[] backupPartitions(ClusterNode n) { A.notNull(n, "n"); Set<Integer> parts = cctx.affinity().backupPartitions(n.id(), topologyVersion()); return U.toIntArray(parts); }
/** {@inheritDoc} */ @Override public IgniteFuture<Void> stopRemoteListenAsync(UUID opId) throws IgniteException { A.notNull(opId, "opId"); guard(); try { return (IgniteFuture<Void>)new IgniteFutureImpl<>(ctx.continuous().stopRoutine(opId)); } finally { unguard(); } }
/** {@inheritDoc} */ @Override public IgniteFuture<Void> stopRemoteListenAsync(UUID opId) throws IgniteException { A.notNull(opId, "consumeId"); guard(); try { return (IgniteFuture<Void>)new IgniteFutureImpl<>(ctx.continuous().stopRoutine(opId)); } finally { unguard(); } }
/** {@inheritDoc} */ @Override protected Object executeJob(int gridSize, String arg) { A.notNull(arg, "task argument"); String[] split = arg.split(":", 2); A.ensure(split.length == 2, "Task argument should have format 'cacheName:affinityKey'."); String cacheName = split[0]; String affKey = split[1]; if ("null".equals(cacheName)) cacheName = null; ClusterNode node = ignite.affinity(cacheName).mapKeyToNode(affKey); return node.id().toString(); }
/** {@inheritDoc} */ @Override public long size(final IgfsPath path) { A.notNull(path, "path"); if (meta.isClient()) return meta.runClientTask(new IgfsClientSizeCallable(cfg.getName(), IgfsUserContext.currentUser(), path)); return safeOp(new Callable<Long>() { @Override public Long call() throws Exception { return summary0(path).totalLength(); } }); }