/** * Upcasts collection type. * * @param c Initial collection. * @return Resulting collection. */ private static <T extends R, R> Collection<R> upcast(Collection<T> c) { A.notNull(c, "c"); return (Collection<R>)c; }
/** * Sets the number of pre-fetched blocks if specific file's chunk is requested. * * @param prefetchBlocks New number of pre-fetched blocks. * @return {@code this} for chaining. */ public FileSystemConfiguration setPrefetchBlocks(int prefetchBlocks) { A.ensure(prefetchBlocks >= 0, "prefetchBlocks >= 0"); this.prefetchBlocks = prefetchBlocks; return this; }
/** * @param futId Future ID. * @param txKeys Target tx keys. */ public TxLocksRequest(long futId, Set<IgniteTxKey> txKeys) { A.notEmpty(txKeys, "txKeys"); this.futId = futId; this.txKeys = txKeys; }
/** {@inheritDoc} */ @Override public BinaryType registerEnum(String typeName, Map<String, Integer> vals) throws BinaryObjectException { A.notNullOrEmpty(typeName, "enum type name"); int typeId = binaryCtx.typeId(typeName); typeName = binaryCtx.userTypeName(typeName); BinaryUtils.validateEnumValues(typeName, vals); updateMetadata(typeId, typeName, null, null, true, vals); return binaryCtx.metadata(typeId); }
/** * 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 max size. Default value {@link #DEFAULT_QUEUE_SIZE} * * @param maxSize Max size. */ public void setMaxSize(int maxSize) { A.ensure(maxSize > 0, "Max queue size must be greater than 0."); this.maxSize = maxSize; }
/** * Validates config at start. */ protected void validateConfig() { A.notNull(getStreamer(), "Streamer"); A.notNull(getIgnite(), "Ignite"); A.notNull(endpointUrl, "Twitter Streaming API endpoint"); A.ensure(getSingleTupleExtractor() != null || getMultipleTupleExtractor() != null, "Twitter extractor"); String followParam = apiParams.get(SITE_USER_ID_KEY); A.ensure(followParam != null && followParam.matches("^(\\d+,? ?)+$"), "Site streaming endpoint must provide 'follow' param with value as comma separated numbers"); }
/** * Create an intance of ParametricVectorGenerator. * * @param paramGenerator Parameter generator. * @param perDimensionGenerators Per dimension generators. */ public ParametricVectorGenerator(RandomProducer paramGenerator, IgniteFunction<Double, Double>... perDimensionGenerators) { A.notEmpty(perDimensionGenerators, "perDimensionGenerators.length != 0"); this.perDimensionGenerators = Arrays.asList(perDimensionGenerators); this.randomProducer = paramGenerator; }
/** * Setter for set service permission map. * * @param servicePermissions Service permissions. */ public void setServicePermissions(Map<String, Collection<SecurityPermission>> servicePermissions) { A.notNull(taskPermissions, "servicePermissions"); this.servicePermissions = servicePermissions; }
/** * Sets the polling timeout for Kafka tasks. * * @param timeout Timeout. */ public void setTimeout(long timeout) { A.ensure(timeout > 0, "timeout > 0"); this.timeout = timeout; }
/** {@inheritDoc} */ @Override public IgniteFuture<?> addData(Collection<? extends Map.Entry<K, V>> entries) { A.notEmpty(entries, "entries"); checkSecurityPermission(SecurityPermission.CACHE_PUT); Collection<DataStreamerEntry> batch = new ArrayList<>(entries.size()); for (Map.Entry<K, V> entry : entries) { KeyCacheObject key = cacheObjProc.toCacheKeyObject(cacheObjCtx, null, entry.getKey(), true); CacheObject val = cacheObjProc.toCacheObject(cacheObjCtx, entry.getValue(), true); batch.add(new DataStreamerEntry(key, val)); } return addDataInternal(batch); }
/** * 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; }
/** * @param p1 Part 1. * @param p2 Part 2. */ private void validateDups(int p1, int p2) { A.ensure(p1 != p2, "Partition duplicates are not allowed: " + p1); }
/** {@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 void enableLocal(int[] types) { A.notEmpty(types, "types"); guard(); try { ctx.event().enableEvents(types); } finally { unguard(); } }
/** * 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; }