public LockGuard(Address lockOwner, String lockOwnerId, long leaseTime) { Preconditions.checkNotNull(lockOwner); Preconditions.checkNotNull(lockOwnerId); Preconditions.checkPositive(leaseTime, "Lease time should be positive!"); this.lockOwner = lockOwner; this.lockOwnerId = lockOwnerId; this.lockExpiryTime = toLockExpiry(leaseTime); }
@Override public void publish(String mapName, String cacheId, EventData eventData, int orderKey, Extractors extractors) { checkHasText(mapName, "mapName"); checkHasText(cacheId, "cacheId"); checkNotNull(eventData, "eventData cannot be null"); publishLocalEvent(mapName, cacheId, eventData, extractors); }
SlidingWindowPolicy(long frameSize, long frameOffset, long framesPerWindow) { checkPositive(frameSize, "frameLength must be positive"); checkNotNegative(frameOffset, "frameOffset must not be negative"); checkTrue(frameOffset < frameSize, "frameOffset must be less than frameSize, offset=" + frameOffset + ", size=" + frameSize); checkPositive(framesPerWindow, "framesPerWindow must be positive"); this.frameSize = frameSize; this.frameOffset = frameOffset; this.windowSize = frameSize * framesPerWindow; }
public SetReadCursorOperation(String mapName, String cacheId, long sequence, int ignored) { super(checkHasText(mapName, "mapName")); checkPositive(sequence, "sequence"); this.cacheId = checkHasText(cacheId, "cacheId"); this.sequence = sequence; }
public SingleAttributeProjection(String attributePath) { checkHasText(attributePath, "attributePath must not be null or empty"); checkFalse(attributePath.contains("[any]"), "attributePath must not contain [any] operators"); this.attributePath = attributePath; }
@Override public void loadAll(Set<K> keys, boolean replaceExistingValues) { checkTrue(isMapStoreEnabled(), "First you should configure a map store"); checkNotNull(keys, NULL_KEYS_ARE_NOT_ALLOWED); checkNoNullInside(keys, NULL_KEY_IS_NOT_ALLOWED); loadInternal(keys, null, replaceExistingValues); }
@Override public IScheduledFuture<?> scheduleOnMemberAtFixedRate(Runnable command, Member member, long initialDelay, long period, TimeUnit unit) { checkNotNull(member, "Member is null"); return scheduleOnMembersAtFixedRate(command, Collections.singleton(member), initialDelay, period, unit).get(member); }
/** * Sets the number of executor threads per member for the executor. * * @param poolSize the number of executor threads per member for the executor * @return this executor config instance */ public ScheduledExecutorConfig setPoolSize(int poolSize) { this.poolSize = checkPositive(poolSize, "Pool size should be greater than 0"); return this; }
@Override public ICompletableFuture<Long> addAllAsync(Collection<? extends E> collection, OverflowPolicy overflowPolicy) { checkNotNull(collection, "collection can't be null"); checkNotNull(overflowPolicy, "overflowPolicy can't be null"); checkFalse(collection.isEmpty(), "collection can't be empty"); checkTrue(collection.size() <= MAX_BATCH_SIZE, "collection can't be larger than " + MAX_BATCH_SIZE); Operation op = new AddAllOperation(name, toDataArray(collection), overflowPolicy) .setPartitionId(partitionId); OperationService operationService = getOperationService(); return operationService.createInvocationBuilder(null, op, partitionId) .setCallTimeout(Long.MAX_VALUE) .invoke(); }
@Override public String addEntryListener(EntryListener<K, V> listener, Predicate<K, V> predicate, K key) { checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED); isNotNull(listener, "listener"); isNotNull(predicate, "predicate"); final Data keyData = toData(key); final Data predicateData = toData(predicate); EventHandler<ClientMessage> handler = createHandler(listener); return registerListener(createEntryListenerToKeyWithPredicateCodec(keyData, predicateData), handler); }
/** * Sets the {@link KubernetesConfig} used by the discovery mechanism for this * WAN publisher. * * @param kubernetesConfig the Kubernetes discovery configuration * @return this config * @throws IllegalArgumentException if kubernetesConfig is null */ public WanPublisherConfig setKubernetesConfig(final KubernetesConfig kubernetesConfig) { this.kubernetesConfig = isNotNull(kubernetesConfig, "kubernetesConfig"); return this; }
public OnJoinOp(final Operation... ops) { for (Operation op : ops) { checkNotNull(op, "op can't be null"); checkNegative(op.getPartitionId(), "Post join operation can not have a partition ID!"); } // we may need to do array copy! operations = ops; }
@Override public int drainTo(Collection<? super E> objects, int i) { checkNotNull(objects, "Collection is null"); checkFalse(this.equals(objects), "Can not drain to same Queue"); final NodeEngine nodeEngine = getNodeEngine(); Collection<Data> dataList = drainInternal(i); for (Data data : dataList) { E e = nodeEngine.toObject(data); objects.add(e); } return dataList.size(); }
/** * Sets the name of the CountDownLatch. * * @param name the name of the CountDownLatch * @return the updated CountDownLatchConfig * @throws IllegalArgumentException if name is {@code null} or empty */ public CountDownLatchConfig setName(String name) { this.name = checkHasText(name, "name must contain text"); return this; }
KafkaPartitionAssigner(List<String> topics, int[] partitionCounts, int totalParallelism) { Preconditions.checkTrue(topics.size() == partitionCounts.length, "Different length between topics and partition counts"); this.topics = topics; this.partitionCounts = partitionCounts; this.totalParallelism = totalParallelism; }
/** * Number of synchronous backups. For example, if 1 is set as the backup count, * then all entries of the map will be copied to another JVM for fail-safety. * 0 means no sync backup. * * @param backupCount the number of synchronous backups to set for this {@link com.hazelcast.core.IMap} * @see #setAsyncBackupCount(int) */ public MapConfig setBackupCount(final int backupCount) { this.backupCount = checkBackupCount(backupCount, asyncBackupCount); return this; }
/** * Sets the number of asynchronous backups. 0 means no backups. * * @param asyncBackupCount the number of asynchronous synchronous backups to set * @return the updated CacheConfig * @throws IllegalArgumentException if asyncBackupCount smaller than 0, * or larger than the maximum number of backup * or the sum of the backups and async backups is larger than the maximum number of backups * @see #setBackupCount(int) * @see #getAsyncBackupCount() */ public MapConfig setAsyncBackupCount(int asyncBackupCount) { this.asyncBackupCount = checkAsyncBackupCount(backupCount, asyncBackupCount); return this; }
public SkewReductionPolicy(int numQueues, long maxSkew, long priorityDrainingThreshold, boolean forceAdvanceWm) { checkNotNegative(maxSkew, "maxSkew must not be a negative number"); checkNotNegative(priorityDrainingThreshold, "priorityDrainingThreshold must not be a negative number"); checkTrue(priorityDrainingThreshold <= maxSkew, "priorityDrainingThreshold must be less than maxSkew"); this.maxSkew = maxSkew; this.priorityDrainingThreshold = priorityDrainingThreshold; this.forceAdvanceWm = forceAdvanceWm; queueWms = new long[numQueues]; Arrays.fill(queueWms, Long.MIN_VALUE); drainOrderToQIdx = new int[numQueues]; Arrays.setAll(drainOrderToQIdx, i -> i); }
public CardinalityEstimatorConfig(String name, int backupCount, int asyncBackupCount, String quorumName, MergePolicyConfig mergePolicyConfig) { this.name = name; this.backupCount = checkBackupCount(backupCount, asyncBackupCount); this.asyncBackupCount = checkAsyncBackupCount(backupCount, asyncBackupCount); this.quorumName = quorumName; this.mergePolicyConfig = mergePolicyConfig; validate(); }
/** * Enables / disables throwing {@link IndeterminateOperationStateException} for this invocation. * Can be used only for partition invocations * @see IndeterminateOperationStateException * * @return the InvocationBuilder */ public InvocationBuilder setFailOnIndeterminateOperationState(boolean failOnIndeterminateOperationState) { checkFalse((failOnIndeterminateOperationState && partitionId == GENERIC_PARTITION_ID), "failOnIndeterminateOperationState can be used with only partition invocations"); this.failOnIndeterminateOperationState = failOnIndeterminateOperationState; return this; }