/** * Sets the durability of the executor * * @param durability the durability of the executor * @return this executor config instance */ public DurableExecutorConfig setDurability(int durability) { this.durability = checkNotNegative(durability, "durability can't be smaller than 0"); return this; }
/** * Sets the minimum number of delay seconds which an event waits in the buffer of node * before sending to a {@code QueryCache} * * @param delaySeconds the delay seconds * @return this {@code QueryCacheConfig} instance */ public QueryCacheConfig setDelaySeconds(int delaySeconds) { this.delaySeconds = checkNotNegative(delaySeconds, "delaySeconds"); return this; }
/** * Sets the maximum number of times the IP Datagram (ping) can be forwarded, in most cases * all Hazelcast cluster members would be within one network switch/router therefore * * @param ttl the new time-to-live value * @return this {@link IcmpFailureDetectorConfig} instance */ public IcmpFailureDetectorConfig setTtl(int ttl) { checkNotNegative(ttl, "TTL must not be a negative value"); this.ttl = ttl; return this; }
/** * Set the max ping attempts before suspecting a member * * @param maxAttempts the max attempts before suspecting a member * @return this {@link IcmpFailureDetectorConfig} instance */ public IcmpFailureDetectorConfig setMaxAttempts(int maxAttempts) { checkNotNegative(maxAttempts, "Max attempts must not be a negative value"); this.maxAttempts = maxAttempts; 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); }
private int getMaxToleratedMissCount(HazelcastProperties properties) { int maxToleratedMissCount = properties.getInteger(MAX_TOLERATED_MISS_COUNT); return checkNotNegative(maxToleratedMissCount, format("max-tolerated-miss-count cannot be < 0 but found %d", maxToleratedMissCount)); }
public BatchEventData(Collection<QueryCacheEventData> events, String source, int partitionId) { this.events = checkNotNull(events, "events cannot be null"); this.source = checkNotNull(source, "source cannot be null"); this.partitionId = checkNotNegative(partitionId, "partitionId cannot be negative"); }
@Override public Future invokeOnPartitionOwner(Object operation, int partitionId) { checkNotNull(operation, "operation cannot be null"); checkNotNegative(partitionId, "partitionId"); Operation op = (Operation) operation; return operationService.invokeOnPartition(MapService.SERVICE_NAME, op, partitionId); }
@Override public boolean tryAcquire(int permits, long timeout, TimeUnit unit) throws InterruptedException { checkNotNegative(permits, "permits can't be negative"); try { Operation operation = new AcquireOperation(name, permits, unit.toMillis(timeout)) .setPartitionId(partitionId); Future<Boolean> future = invokeOnPartition(operation); return future.get(); } catch (Throwable t) { throw rethrowAllowInterrupted(t); } }
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; }
@Override public boolean trySetCount(int count) { checkNotNegative(count, "count can't be negative"); Operation op = new SetCountOperation(name, count) .setPartitionId(partitionId); InternalCompletableFuture<Boolean> f = invokeOnPartition(op); return f.join(); }
@Override public boolean trySetCount(int count) { checkNotNegative(count, "count can't be negative"); Operation op = new SetCountOperation(name, count) .setPartitionId(partitionId); InternalCompletableFuture<Boolean> f = invokeOnPartition(op); return f.join(); }
@Override public boolean init(int permits) { checkNotNegative(permits, "permits can't be negative"); Operation operation = new InitOperation(name, permits) .setPartitionId(partitionId); InternalCompletableFuture<Boolean> future = invokeOnPartition(operation); return future.join(); }
@Override public InvocationBuilder createInvocationBuilder(String serviceName, Operation op, int partitionId) { checkNotNegative(partitionId, "Partition ID cannot be negative!"); return new InvocationBuilderImpl(invocationContext, serviceName, op, partitionId) .setTryCount(invocationMaxRetryCount) .setTryPauseMillis(invocationRetryPauseMillis) .setFailOnIndeterminateOperationState(failOnIndeterminateOperationState); }
@Override public void reducePermits(int reduction) { checkNotNegative(reduction, "reduction can't be negative"); Operation operation = new ReduceOperation(name, reduction) .setPartitionId(partitionId); InternalCompletableFuture<Object> future = invokeOnPartition(operation); future.join(); }
@Override public Future invokeOnPartitionOwner(Object request, int partitionId) { checkNotNull(request, "request cannot be null"); checkNotNegative(partitionId, "partitionId"); ClientMessage clientRequest = (ClientMessage) request; ClientInvocation clientInvocation = new ClientInvocation(getClient(), clientRequest, null, partitionId); return clientInvocation.invoke(); }
@Override public Future invokeOnPartitionOwner(Object request, int partitionId) { checkNotNull(request, "request cannot be null"); checkNotNegative(partitionId, "partitionId"); ClientMessage clientRequest = (ClientMessage) request; ClientInvocation clientInvocation = new ClientInvocation(getClient(), clientRequest, null, partitionId); return clientInvocation.invoke(); }
@Override public void acquire(int permits) throws InterruptedException { checkNotNegative(permits, "permits can't be negative"); try { Operation operation = new AcquireOperation(name, permits, -1) .setPartitionId(partitionId); InternalCompletableFuture<Object> future = invokeOnPartition(operation); future.get(); } catch (Throwable t) { throw rethrowAllowInterrupted(t); } }
@Override public void acquire(int permits) throws InterruptedException { checkNotNegative(permits, "permits can't be negative"); try { Operation operation = new AcquireOperation(name, permits, -1) .setPartitionId(partitionId); InternalCompletableFuture<Object> future = invokeOnPartition(operation); future.get(); } catch (Throwable t) { throw rethrowAllowInterrupted(t); } }
@Override public void increasePermits(int increase) { if (getNodeEngine().getClusterService().getClusterVersion().isLessThan(Versions.V3_10)) { throw new UnsupportedOperationException("Increasing permits is available when cluster version is 3.10 or higher"); } checkNotNegative(increase, "increase can't be negative"); Operation operation = new IncreaseOperation(name, increase) .setPartitionId(partitionId); InternalCompletableFuture<Object> future = invokeOnPartition(operation); future.join(); }