Skip to content
Permalink
Browse files

Align names of utility classes FooUtil vs FooUtils (#872)

__Motivation__

Align names of utility classes FooUtil vs FooUtils

__Modifications__

Rename classes:

./servicetalk-http-api/src/main/java/io/servicetalk/http/api/StringUtil.java
./servicetalk-http-api/src/main/java/io/servicetalk/http/api/NetUtil.java
./servicetalk-concurrent-internal/src/main/java/io/servicetalk/concurrent/internal/ThrowableUtil.java
./servicetalk-concurrent-internal/src/main/java/io/servicetalk/concurrent/internal/FlowControlUtil.java
./servicetalk-transport-netty-internal/src/main/java/io/servicetalk/transport/netty/internal/NativeTransportUtil.java
./servicetalk-buffer-netty/src/main/java/io/servicetalk/buffer/netty/BufferUtil.java
./servicetalk-utils-internal/src/main/java/io/servicetalk/utils/internal/MathUtil.java
./servicetalk-concurrent-api/src/main/java/io/servicetalk/concurrent/api/ContextAwareExecutorUtil.java
./servicetalk-opentracing-internal/src/main/java/io/servicetalk/opentracing/internal/HexUtil.java

__Result__

Resolves: Align names of utility classes FooUtil vs FooUtils #869
  • Loading branch information
volyx authored and idelpivnitskiy committed Nov 28, 2019
1 parent 5ae6a1b commit 3a67c9ff8e4a1999e45d0e0fa8458d958671f9f0
Showing with 124 additions and 124 deletions.
  1. +1 −1 servicetalk-benchmarks/src/jmh/java/io/servicetalk/http/netty/HttpResponseDecoderBenchmark.java
  2. +3 −3 servicetalk-buffer-netty/src/main/java/io/servicetalk/buffer/netty/BufferAllocators.java
  3. +2 −2 ...etalk-buffer-netty/src/main/java/io/servicetalk/buffer/netty/{BufferUtil.java → BufferUtils.java}
  4. +1 −1 servicetalk-buffer-netty/src/main/java/io/servicetalk/buffer/netty/NettyBuffer.java
  5. +1 −1 servicetalk-buffer-netty/src/main/java/io/servicetalk/buffer/netty/NettyCompositeBuffer.java
  6. +1 −1 servicetalk-buffer-netty/src/test/java/io/servicetalk/buffer/netty/BufferAllocatorsTest.java
  7. +1 −1 servicetalk-buffer-netty/src/test/java/io/servicetalk/buffer/netty/BufferUtilTest.java
  8. +1 −1 ...t-api-internal/src/main/java/io/servicetalk/concurrent/api/internal/ConnectablePayloadWriter.java
  9. +4 −4 ...ent-api-internal/src/main/java/io/servicetalk/concurrent/api/internal/SpScPublisherProcessor.java
  10. +2 −2 servicetalk-concurrent-api/src/main/java/io/servicetalk/concurrent/api/AbstractPublisherGroupBy.java
  11. +1 −1 ...etalk-concurrent-api/src/main/java/io/servicetalk/concurrent/api/CancellableThenSubscription.java
  12. +2 −2 ...va/io/servicetalk/concurrent/api/{ContextAwareExecutorUtil.java → ContextAwareExecutorUtils.java}
  13. +4 −4 ...-concurrent-api/src/main/java/io/servicetalk/concurrent/api/ContextPreservingExecutorService.java
  14. +1 −1 servicetalk-concurrent-api/src/main/java/io/servicetalk/concurrent/api/FromArrayPublisher.java
  15. +1 −1 servicetalk-concurrent-api/src/main/java/io/servicetalk/concurrent/api/FromInputStreamPublisher.java
  16. +1 −1 servicetalk-concurrent-api/src/main/java/io/servicetalk/concurrent/api/FromIterablePublisher.java
  17. +2 −2 servicetalk-concurrent-api/src/main/java/io/servicetalk/concurrent/api/MulticastUtils.java
  18. +3 −3 ...cetalk-concurrent-api/src/main/java/io/servicetalk/concurrent/api/PublisherConcatMapIterable.java
  19. +2 −2 ...icetalk-concurrent-api/src/main/java/io/servicetalk/concurrent/api/PublisherConcatWithSingle.java
  20. +2 −2 servicetalk-concurrent-api/src/main/java/io/servicetalk/concurrent/api/PublisherFlatMapSingle.java
  21. +2 −2 servicetalk-concurrent-api/src/main/java/io/servicetalk/concurrent/api/SequentialSubscription.java
  22. +2 −2 ...cetalk-concurrent-api/src/test/java/io/servicetalk/concurrent/api/SequentialSubscriptionTest.java
  23. +2 −2 ...-api/src/test/java/io/servicetalk/concurrent/internal/SignalOffloaderConcurrentPublisherTest.java
  24. +1 −1 ...icetalk-concurrent-api/src/testFixtures/java/io/servicetalk/concurrent/api/BlockingTestUtils.java
  25. +3 −3 ...-concurrent-api/src/testFixtures/java/io/servicetalk/concurrent/api/DemandCheckingSubscriber.java
  26. +1 −1 servicetalk-concurrent-api/src/testFixtures/java/io/servicetalk/concurrent/api/TestSubscription.java
  27. +2 −2 ...-concurrent-internal/src/main/java/io/servicetalk/concurrent/internal/ConcurrentSubscription.java
  28. +1 −1 ...alk-concurrent-internal/src/main/java/io/servicetalk/concurrent/internal/DelayedSubscription.java
  29. +4 −4 ...l/src/main/java/io/servicetalk/concurrent/internal/{FlowControlUtil.java → FlowControlUtils.java}
  30. +1 −1 ...oncurrent-internal/src/main/java/io/servicetalk/concurrent/internal/TaskBasedSignalOffloader.java
  31. +1 −1 ...current-internal/src/main/java/io/servicetalk/concurrent/internal/ThreadBasedSignalOffloader.java
  32. +2 −2 ...ernal/src/main/java/io/servicetalk/concurrent/internal/{ThrowableUtil.java → ThrowableUtils.java}
  33. +1 −1 ...k-concurrent-internal/src/test/java/io/servicetalk/concurrent/internal/FlowControlUtilsTests.java
  34. +1 −1 ...etalk-concurrent-internal/src/test/java/io/servicetalk/concurrent/internal/ThrowableUtilTest.java
  35. +2 −2 ...discovery-netty/src/main/java/io/servicetalk/dns/discovery/netty/DefaultDnsServiceDiscoverer.java
  36. +1 −1 servicetalk-http-api/src/main/java/io/servicetalk/http/api/DefaultHttpRequestMetaData.java
  37. +2 −2 servicetalk-http-api/src/main/java/io/servicetalk/http/api/HeaderUtils.java
  38. +1 −1 servicetalk-http-api/src/main/java/io/servicetalk/http/api/HttpUri.java
  39. +1 −1 servicetalk-http-api/src/main/java/io/servicetalk/http/api/MultiMap.java
  40. +3 −3 servicetalk-http-api/src/main/java/io/servicetalk/http/api/{NetUtil.java → NetUtils.java}
  41. +2 −2 servicetalk-http-api/src/main/java/io/servicetalk/http/api/{StringUtil.java → StringUtils.java}
  42. +2 −2 servicetalk-http-netty/src/main/java/io/servicetalk/http/netty/AbstractH2DuplexHandler.java
  43. +1 −1 servicetalk-http-netty/src/main/java/io/servicetalk/http/netty/H2ParentConnectionContext.java
  44. +1 −1 servicetalk-http-netty/src/main/java/io/servicetalk/http/netty/HttpObjectDecoder.java
  45. +2 −2 servicetalk-http-netty/src/main/java/io/servicetalk/http/netty/HttpObjectEncoder.java
  46. +1 −1 servicetalk-http-netty/src/main/java/io/servicetalk/http/netty/SpliceFlatStreamToMetaSingle.java
  47. +1 −1 servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/RoundRobinLoadBalancer.java
  48. +1 −1 ...k-opentracing-http/src/main/java/io/servicetalk/opentracing/http/TracingHttpHeadersFormatter.java
  49. +1 −1 ...-opentracing-inmemory-api/src/main/java/io/servicetalk/opentracing/inmemory/api/InMemorySpan.java
  50. +1 −1 ...opentracing-inmemory/src/main/java/io/servicetalk/opentracing/inmemory/DefaultInMemoryTracer.java
  51. +1 −1 ...lk-opentracing-inmemory/src/main/java/io/servicetalk/opentracing/inmemory/SamplingStrategies.java
  52. +1 −1 ...k-opentracing-inmemory/src/main/java/io/servicetalk/opentracing/inmemory/SingleLineFormatter.java
  53. +1 −1 ...etalk-opentracing-inmemory/src/main/java/io/servicetalk/opentracing/inmemory/SingleLineValue.java
  54. +1 −1 ...talk-opentracing-inmemory/src/main/java/io/servicetalk/opentracing/inmemory/TextMapFormatter.java
  55. +18 −18 ...tracing-internal/src/main/java/io/servicetalk/opentracing/internal/{HexUtil.java → HexUtils.java}
  56. +3 −3 servicetalk-tcp-netty-internal/src/main/java/io/servicetalk/tcp/netty/internal/TcpConnector.java
  57. +2 −2 servicetalk-tcp-netty-internal/src/main/java/io/servicetalk/tcp/netty/internal/TcpServerBinder.java
  58. +2 −2 ...netty-internal/src/main/java/io/servicetalk/transport/netty/internal/AbstractNettyIoExecutor.java
  59. +2 −2 ...transport-netty-internal/src/main/java/io/servicetalk/transport/netty/internal/BufferHandler.java
  60. +1 −1 ...-netty-internal/src/main/java/io/servicetalk/transport/netty/internal/DefaultNettyConnection.java
  61. +2 −2 ...va/io/servicetalk/transport/netty/internal/{NativeTransportUtil.java → NativeTransportUtils.java}
  62. +2 −2 ...t-netty-internal/src/main/java/io/servicetalk/transport/netty/internal/NettyChannelPublisher.java
  63. +1 −1 ...ernal/src/main/java/io/servicetalk/transport/netty/internal/OverlappingCapacityAwareSupplier.java
  64. +2 −2 ...t-netty-internal/src/main/java/io/servicetalk/transport/netty/internal/WriteStreamSubscriber.java
  65. +2 −2 ...etalk-utils-internal/src/main/java/io/servicetalk/utils/internal/{MathUtil.java → MathUtils.java}
@@ -39,7 +39,7 @@

import static io.netty.handler.codec.http.HttpConstants.SP;
import static io.servicetalk.buffer.netty.BufferAllocators.PREFER_DIRECT_ALLOCATOR;
import static io.servicetalk.buffer.netty.BufferUtil.toByteBuf;
import static io.servicetalk.buffer.netty.BufferUtils.toByteBuf;
import static io.servicetalk.http.api.HttpProtocolVersion.HTTP_1_1;
import static io.servicetalk.http.netty.HttpObjectEncoder.CRLF_SHORT;
import static io.servicetalk.http.netty.HttpUtils.status;
@@ -25,19 +25,19 @@
/**
* Default {@link BufferAllocator} whose {@link Buffer}s are typically backed by Netty buffers.
*/
public static final BufferAllocator DEFAULT_ALLOCATOR = BufferUtil.PREFER_DIRECT_ALLOCATOR_WITHOUT_ZEROING;
public static final BufferAllocator DEFAULT_ALLOCATOR = BufferUtils.PREFER_DIRECT_ALLOCATOR_WITHOUT_ZEROING;

/**
* Default {@link BufferAllocator} whose {@link Buffer}s are typically backed by Netty buffers and prefers direct
* memory allocation when otherwise not specified.
*/
public static final BufferAllocator PREFER_DIRECT_ALLOCATOR = BufferUtil.PREFER_DIRECT_ALLOCATOR;
public static final BufferAllocator PREFER_DIRECT_ALLOCATOR = BufferUtils.PREFER_DIRECT_ALLOCATOR;

/**
* Default {@link BufferAllocator} whose {@link Buffer}s are typically backed by Netty buffers and prefers heap
* memory allocation when otherwise not specified.
*/
public static final BufferAllocator PREFER_HEAP_ALLOCATOR = BufferUtil.PREFER_HEAP_ALLOCATOR;
public static final BufferAllocator PREFER_HEAP_ALLOCATOR = BufferUtils.PREFER_HEAP_ALLOCATOR;

private BufferAllocators() {
// no instances
@@ -32,13 +32,13 @@
/**
* Internal utilities for {@link Buffer}s.
*/
public final class BufferUtil {
public final class BufferUtils {

static final BufferAllocator PREFER_HEAP_ALLOCATOR = new ServiceTalkBufferAllocator(false, false);
static final BufferAllocator PREFER_DIRECT_ALLOCATOR = new ServiceTalkBufferAllocator(true, false);
static final BufferAllocator PREFER_DIRECT_ALLOCATOR_WITHOUT_ZEROING = new ServiceTalkBufferAllocator(true, true);

private BufferUtil() {
private BufferUtils() {
// no instances
}

@@ -26,7 +26,7 @@
import java.nio.ByteBuffer;
import java.nio.charset.Charset;

import static io.servicetalk.buffer.netty.BufferUtil.toByteBufNoThrow;
import static io.servicetalk.buffer.netty.BufferUtils.toByteBufNoThrow;

class NettyBuffer<T extends ByteBuf> implements Buffer {

@@ -30,7 +30,7 @@

@Override
public CompositeBuffer addBuffer(Buffer buf, boolean incrementWriterIndex) {
buffer.addComponent(incrementWriterIndex, BufferUtil.toByteBuf(buf));
buffer.addComponent(incrementWriterIndex, BufferUtils.toByteBuf(buf));
return this;
}

@@ -130,7 +130,7 @@ private static void assertBuffer(Buffer buffer, boolean direct) {
}

private static void assertByteBufIsUnreleasable(Buffer buffer) {
ByteBuf byteBuf = BufferUtil.toByteBuf(buffer);
ByteBuf byteBuf = BufferUtils.toByteBuf(buffer);
assertByteBufIsUnreleasable(byteBuf);
assertByteBufIsUnreleasable(byteBuf.slice());
assertByteBufIsUnreleasable(byteBuf.slice(0, 0));
@@ -20,7 +20,7 @@
import org.junit.Test;

import static io.servicetalk.buffer.api.EmptyBuffer.EMPTY_BUFFER;
import static io.servicetalk.buffer.netty.BufferUtil.toByteBufNoThrow;
import static io.servicetalk.buffer.netty.BufferUtils.toByteBufNoThrow;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.mock;
@@ -32,7 +32,7 @@
import javax.annotation.Nullable;

import static io.servicetalk.concurrent.api.Publisher.failed;
import static io.servicetalk.concurrent.internal.FlowControlUtil.addWithOverflowProtection;
import static io.servicetalk.concurrent.internal.FlowControlUtils.addWithOverflowProtection;
import static io.servicetalk.concurrent.internal.SubscriberUtils.deliverTerminalFromSource;
import static io.servicetalk.concurrent.internal.SubscriberUtils.handleExceptionFromOnSubscribe;
import static io.servicetalk.concurrent.internal.SubscriberUtils.isRequestNValid;
@@ -18,7 +18,7 @@
import io.servicetalk.concurrent.PublisherSource;
import io.servicetalk.concurrent.api.Publisher;
import io.servicetalk.concurrent.internal.DuplicateSubscribeException;
import io.servicetalk.concurrent.internal.FlowControlUtil;
import io.servicetalk.concurrent.internal.FlowControlUtils;
import io.servicetalk.concurrent.internal.QueueFullException;
import io.servicetalk.concurrent.internal.TerminalNotification;

@@ -107,7 +107,7 @@ protected void handleSubscribe(final Subscriber<? super T> s) {
public void request(final long n) {
if (isRequestNValid(n)) {
if (requestedUpdater.getAndAccumulate(SpScPublisherProcessor.this, n,
FlowControlUtil::addWithOverflowProtectionIfNotNegative) == 0) {
FlowControlUtils::addWithOverflowProtectionIfNotNegative) == 0) {
drainQueue();
}
} else {
@@ -210,11 +210,11 @@ private void drainQueue() {
long previousRequested;
// getAndAccumulate because we want to know if before the decrement, the value was positive.
while ((previousRequested = requestedUpdater.getAndAccumulate(this, 1,
FlowControlUtil::subtractIfPositive)) > 0) {
FlowControlUtils::subtractIfPositive)) > 0) {
signal = signalQueue.poll();
if (signal == null) {
previousRequested = requestedUpdater.accumulateAndGet(this, 1,
FlowControlUtil::addWithOverflowProtectionIfNotNegative);
FlowControlUtils::addWithOverflowProtectionIfNotNegative);
break;
} else if (signal instanceof TerminalNotification) {
clearQueueAndTerminate();
@@ -21,7 +21,7 @@
import io.servicetalk.concurrent.api.MulticastUtils.SpscQueue;
import io.servicetalk.concurrent.internal.ConcurrentSubscription;
import io.servicetalk.concurrent.internal.DuplicateSubscribeException;
import io.servicetalk.concurrent.internal.FlowControlUtil;
import io.servicetalk.concurrent.internal.FlowControlUtils;
import io.servicetalk.concurrent.internal.QueueFullException;
import io.servicetalk.concurrent.internal.TerminalNotification;

@@ -284,7 +284,7 @@ public final void request(long n) {
return;
}

groupRequestedUpdater.accumulateAndGet(this, n, FlowControlUtil::addWithOverflowProtection);
groupRequestedUpdater.accumulateAndGet(this, n, FlowControlUtils::addWithOverflowProtection);
SpscQueue<GroupedPublisher<Key, T>> q = groupQueue;
if (q == null) {
s.request(n);
@@ -21,7 +21,7 @@
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import javax.annotation.Nullable;

import static io.servicetalk.concurrent.internal.FlowControlUtil.addWithOverflowProtection;
import static io.servicetalk.concurrent.internal.FlowControlUtils.addWithOverflowProtection;
import static io.servicetalk.concurrent.internal.SubscriberUtils.isRequestNValid;
import static java.util.concurrent.atomic.AtomicReferenceFieldUpdater.newUpdater;

@@ -22,9 +22,9 @@

import static io.servicetalk.concurrent.api.DefaultAsyncContextProvider.INSTANCE;

final class ContextAwareExecutorUtil {
final class ContextAwareExecutorUtils {

private ContextAwareExecutorUtil() {
private ContextAwareExecutorUtils() {
// no instances
}

@@ -80,25 +80,25 @@ public final boolean awaitTermination(long timeout, TimeUnit unit) throws Interr

@Override
public final <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException {
return delegate.invokeAll(ContextAwareExecutorUtil.wrap(tasks));
return delegate.invokeAll(ContextAwareExecutorUtils.wrap(tasks));
}

@Override
public final <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
throws InterruptedException {
return delegate.invokeAll(ContextAwareExecutorUtil.wrap(tasks), timeout, unit);
return delegate.invokeAll(ContextAwareExecutorUtils.wrap(tasks), timeout, unit);
}

@Override
public final <T> T invokeAny(Collection<? extends Callable<T>> tasks)
throws InterruptedException, ExecutionException {
return delegate.invokeAny(ContextAwareExecutorUtil.wrap(tasks));
return delegate.invokeAny(ContextAwareExecutorUtils.wrap(tasks));
}

@Override
public final <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
throws InterruptedException, ExecutionException, TimeoutException {
return delegate.invokeAny(ContextAwareExecutorUtil.wrap(tasks), timeout, unit);
return delegate.invokeAny(ContextAwareExecutorUtils.wrap(tasks), timeout, unit);
}

static ExecutorService of(ExecutorService executor) {
@@ -18,7 +18,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static io.servicetalk.concurrent.internal.FlowControlUtil.addWithOverflowProtection;
import static io.servicetalk.concurrent.internal.FlowControlUtils.addWithOverflowProtection;
import static io.servicetalk.concurrent.internal.SubscriberUtils.deliverTerminalFromSource;
import static io.servicetalk.concurrent.internal.SubscriberUtils.handleExceptionFromOnSubscribe;
import static io.servicetalk.concurrent.internal.SubscriberUtils.isRequestNValid;
@@ -26,7 +26,7 @@
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import javax.annotation.Nullable;

import static io.servicetalk.concurrent.internal.FlowControlUtil.addWithOverflowProtection;
import static io.servicetalk.concurrent.internal.FlowControlUtils.addWithOverflowProtection;
import static io.servicetalk.concurrent.internal.SubscriberUtils.deliverTerminalFromSource;
import static io.servicetalk.concurrent.internal.SubscriberUtils.handleExceptionFromOnSubscribe;
import static io.servicetalk.concurrent.internal.SubscriberUtils.isRequestNValid;
@@ -22,7 +22,7 @@
import java.util.concurrent.TimeoutException;

import static io.servicetalk.concurrent.internal.AutoClosableUtils.closeAndReThrowUnchecked;
import static io.servicetalk.concurrent.internal.FlowControlUtil.addWithOverflowProtection;
import static io.servicetalk.concurrent.internal.FlowControlUtils.addWithOverflowProtection;
import static io.servicetalk.concurrent.internal.SubscriberUtils.handleExceptionFromOnSubscribe;
import static io.servicetalk.concurrent.internal.SubscriberUtils.isRequestNValid;
import static io.servicetalk.concurrent.internal.SubscriberUtils.newExceptionForInvalidRequestN;
@@ -17,7 +17,7 @@

import io.servicetalk.concurrent.PublisherSource.Subscriber;
import io.servicetalk.concurrent.PublisherSource.Subscription;
import io.servicetalk.concurrent.internal.FlowControlUtil;
import io.servicetalk.concurrent.internal.FlowControlUtils;
import io.servicetalk.concurrent.internal.QueueFullException;
import io.servicetalk.concurrent.internal.TerminalNotification;

@@ -318,7 +318,7 @@ public void request(long n) {
handleInvalidRequestN(n);
return;
}
requestedUpdater.accumulateAndGet(this, n, FlowControlUtil::addWithOverflowProtection);
requestedUpdater.accumulateAndGet(this, n, FlowControlUtils::addWithOverflowProtection);

// We have to load the queue variable after we increment the request count in case the queue becomes
// non-null after we increment the request count and we need to drain the queue.
@@ -15,7 +15,7 @@
*/
package io.servicetalk.concurrent.api;

import io.servicetalk.concurrent.internal.FlowControlUtil;
import io.servicetalk.concurrent.internal.FlowControlUtils;
import io.servicetalk.concurrent.internal.TerminalNotification;

import org.slf4j.Logger;
@@ -130,7 +130,7 @@ public void request(long n) {
} else {
tryDrainIterator(currentIterator, sourceSubscription, terminalNotification,
requestNUpdater.accumulateAndGet(this, n,
FlowControlUtil::addWithOverflowProtectionIfNotNegative),
FlowControlUtils::addWithOverflowProtectionIfNotNegative),
ErrorHandlingStrategyInDrain.PropagateAndCancel);
}
}
@@ -205,7 +205,7 @@ private void tryDrainIterator(Iterator<? extends U> currentIterator, Subscriptio
}
} finally {
requestN = requestNUpdater.accumulateAndGet(this, requestN - initialRequestN,
FlowControlUtil::addWithOverflowProtectionIfNotNegative);
FlowControlUtils::addWithOverflowProtectionIfNotNegative);
if (requestN < 0) {
terminated = true;
// We clear out the current iterator to allow for GC, and we don't want to deliver any more data
@@ -17,7 +17,7 @@

import io.servicetalk.concurrent.Cancellable;
import io.servicetalk.concurrent.SingleSource;
import io.servicetalk.concurrent.internal.FlowControlUtil;
import io.servicetalk.concurrent.internal.FlowControlUtils;

import java.util.concurrent.atomic.AtomicLongFieldUpdater;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
@@ -145,7 +145,7 @@ public void request(final long n) {
final long requestNPostUpdate;
if (isRequestNValid(n)) {
requestNPostUpdate = requestNUpdater.accumulateAndGet(this, n,
FlowControlUtil::addWithOverflowProtectionIfGtEqNegativeOne);
FlowControlUtils::addWithOverflowProtectionIfGtEqNegativeOne);
} else {
requestNPostUpdate = sanitizeInvalidRequestN(n);
requestN = requestNPostUpdate;
@@ -18,7 +18,7 @@
import io.servicetalk.concurrent.Cancellable;
import io.servicetalk.concurrent.SingleSource;
import io.servicetalk.concurrent.internal.ConcurrentSubscription;
import io.servicetalk.concurrent.internal.FlowControlUtil;
import io.servicetalk.concurrent.internal.FlowControlUtils;
import io.servicetalk.concurrent.internal.QueueFullException;
import io.servicetalk.concurrent.internal.TerminalNotification;

@@ -146,7 +146,7 @@ public void request(long n) {
return;
}

requestedUpdater.accumulateAndGet(this, n, FlowControlUtil::addWithOverflowProtection);
requestedUpdater.accumulateAndGet(this, n, FlowControlUtils::addWithOverflowProtection);
int actualSourceRequestN = calculateSourceRequested(requestedUpdater, sourceRequestedUpdater,
sourceEmittedUpdater, source.maxConcurrency, this);
if (actualSourceRequestN != 0) {
@@ -18,7 +18,7 @@
import io.servicetalk.concurrent.Cancellable;
import io.servicetalk.concurrent.PublisherSource.Subscriber;
import io.servicetalk.concurrent.PublisherSource.Subscription;
import io.servicetalk.concurrent.internal.FlowControlUtil;
import io.servicetalk.concurrent.internal.FlowControlUtils;

import java.util.concurrent.atomic.AtomicLongFieldUpdater;

@@ -76,7 +76,7 @@ public void request(long n) {
final long currRequested;
if (isRequestNValid(n)) {
currRequested = requestedUpdater.accumulateAndGet(this, n,
FlowControlUtil::addWithOverflowProtectionIfNotNegative);
FlowControlUtils::addWithOverflowProtectionIfNotNegative);
} else {
currRequested = sanitizeInvalidRequestN(n);
requested = currRequested;
@@ -17,7 +17,7 @@

import io.servicetalk.concurrent.PublisherSource.Subscription;
import io.servicetalk.concurrent.internal.DeliberateException;
import io.servicetalk.concurrent.internal.FlowControlUtil;
import io.servicetalk.concurrent.internal.FlowControlUtils;
import io.servicetalk.concurrent.internal.ServiceTalkTestTimeout;

import org.hamcrest.BaseMatcher;
@@ -330,7 +330,7 @@ public void request(long n) {
requestedReceived.set(MAX_VALUE);
throw newExceptionForInvalidRequestN(n);
} else {
requestedReceived.accumulateAndGet(n, FlowControlUtil::addWithOverflowProtection);
requestedReceived.accumulateAndGet(n, FlowControlUtils::addWithOverflowProtection);
}
}

@@ -45,7 +45,7 @@

import static io.servicetalk.concurrent.Cancellable.IGNORE_CANCEL;
import static io.servicetalk.concurrent.api.Completable.completed;
import static io.servicetalk.concurrent.internal.FlowControlUtil.addWithOverflowProtectionIfNotNegative;
import static io.servicetalk.concurrent.internal.FlowControlUtils.addWithOverflowProtectionIfNotNegative;
import static io.servicetalk.concurrent.internal.SubscriberUtils.isRequestNValid;
import static io.servicetalk.concurrent.internal.SubscriberUtils.newExceptionForInvalidRequestN;
import static io.servicetalk.concurrent.internal.TerminalNotification.complete;
@@ -309,7 +309,7 @@ public void request(long n) {
subscriber.onError(newExceptionForInvalidRequestN(n));
} else {
requested = addWithOverflowProtectionIfNotNegative(requested, n);
demand.accumulateAndGet((int) n, FlowControlUtil::addWithOverflowProtectionIfNotNegative);
demand.accumulateAndGet((int) n, FlowControlUtils::addWithOverflowProtectionIfNotNegative);
}
}

@@ -25,7 +25,7 @@
import java.util.concurrent.TimeoutException;
import javax.annotation.Nullable;

import static io.servicetalk.concurrent.internal.ThrowableUtil.unknownStackTrace;
import static io.servicetalk.concurrent.internal.ThrowableUtils.unknownStackTrace;

/**
* Utilities to await results of an asynchronous computation either by blocking the calling thread.
@@ -17,7 +17,7 @@

import io.servicetalk.concurrent.PublisherSource.Subscriber;
import io.servicetalk.concurrent.PublisherSource.Subscription;
import io.servicetalk.concurrent.internal.FlowControlUtil;
import io.servicetalk.concurrent.internal.FlowControlUtils;

import java.util.concurrent.atomic.AtomicLong;

@@ -52,7 +52,7 @@ public void request(final long n) {
// NO_ON_SUBSCRIBE is special value and not eligible to use because it signals a condition.
pending.set(NO_ON_SUBSCRIBE + 1);
} else {
pending.accumulateAndGet(n, FlowControlUtil::addWithOverflowProtectionIfNotNegative);
pending.accumulateAndGet(n, FlowControlUtils::addWithOverflowProtectionIfNotNegative);
}
s.request(n);
}
@@ -66,7 +66,7 @@ public void cancel() {

@Override
public void onNext(final T t) {
long pending = this.pending.getAndAccumulate(-1, FlowControlUtil::addWithOverflowProtectionIfPositive);
long pending = this.pending.getAndAccumulate(-1, FlowControlUtils::addWithOverflowProtectionIfPositive);
if (pending > 0) {
delegate.onNext(t);
} else if (pending == NO_ON_SUBSCRIBE) {

0 comments on commit 3a67c9f

Please sign in to comment.
You can’t perform that action at this time.