Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8276401: Use blessed modifier order in java.net.http
Reviewed-by: prappo, rriggs
  • Loading branch information
dfuch committed Nov 3, 2021
1 parent 0ef8cbe commit 7115892
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 31 deletions.
Expand Up @@ -117,7 +117,7 @@ public String toString() {
* concrete implementations: {@link Http1Request.StreamSubscriber}, and
* {@link Http1Request.FixedContentSubscriber}, for receiving chunked and
* fixed length bodies, respectively. */
static abstract class Http1BodySubscriber implements Flow.Subscriber<ByteBuffer> {
abstract static class Http1BodySubscriber implements Flow.Subscriber<ByteBuffer> {
final MinimalFuture<Flow.Subscription> whenSubscribed = new MinimalFuture<>();
private volatile Flow.Subscription subscription;
volatile boolean complete;
Expand Down
Expand Up @@ -71,14 +71,14 @@ class Http1Response<T> {
private volatile EOFException eof;
private volatile BodyParser bodyParser;
// max number of bytes of (fixed length) body to ignore on redirect
private final static int MAX_IGNORE = 1024;
private static final int MAX_IGNORE = 1024;

// Revisit: can we get rid of this?
static enum State {INITIAL, READING_HEADERS, READING_BODY, DONE}
private volatile State readProgress = State.INITIAL;

final Logger debug = Utils.getDebugLogger(this::dbgString, Utils.DEBUG);
final static AtomicLong responseCount = new AtomicLong();
static final AtomicLong responseCount = new AtomicLong();
final long id = responseCount.incrementAndGet();
private Http1HeaderParser hd;

Expand Down Expand Up @@ -294,7 +294,7 @@ public void cancel() { }
* subscribed.
* @param <U> The type of response.
*/
final static class Http1BodySubscriber<U> implements TrustedSubscriber<U> {
static final class Http1BodySubscriber<U> implements TrustedSubscriber<U> {
final HttpResponse.BodySubscriber<U> userSubscriber;
final AtomicBoolean completed = new AtomicBoolean();
volatile Throwable withError;
Expand Down Expand Up @@ -585,7 +585,7 @@ Receiver<?> receiver(State state) {

}

static abstract class Receiver<T>
abstract static class Receiver<T>
implements Http1AsyncReceiver.Http1AsyncDelegate {
abstract void start(T parser);
abstract CompletableFuture<State> completion();
Expand Down
Expand Up @@ -54,7 +54,7 @@
*/
class Http2ClientImpl {

final static Logger debug =
static final Logger debug =
Utils.getDebugLogger("Http2ClientImpl"::toString, Utils.DEBUG);

private final HttpClientImpl client;
Expand Down
Expand Up @@ -113,14 +113,14 @@
class Http2Connection {

final Logger debug = Utils.getDebugLogger(this::dbgString, Utils.DEBUG);
final static Logger DEBUG_LOGGER =
static final Logger DEBUG_LOGGER =
Utils.getDebugLogger("Http2Connection"::toString, Utils.DEBUG);
private final Logger debugHpack =
Utils.getHpackLogger(this::dbgString, Utils.DEBUG_HPACK);
static final ByteBuffer EMPTY_TRIGGER = ByteBuffer.allocate(0);

static private final int MAX_CLIENT_STREAM_ID = Integer.MAX_VALUE; // 2147483647
static private final int MAX_SERVER_STREAM_ID = Integer.MAX_VALUE - 1; // 2147483646
private static final int MAX_CLIENT_STREAM_ID = Integer.MAX_VALUE; // 2147483647
private static final int MAX_SERVER_STREAM_ID = Integer.MAX_VALUE - 1; // 2147483646

/**
* Flag set when no more streams to be opened on this connection.
Expand Down
Expand Up @@ -135,7 +135,7 @@ public Thread newThread(Runnable r) {
* is the SelectorManager thread. If the current thread is not
* the selector manager thread the given task is executed inline.
*/
final static class DelegatingExecutor implements Executor {
static final class DelegatingExecutor implements Executor {
private final BooleanSupplier isInSelectorThread;
private final Executor delegate;
DelegatingExecutor(BooleanSupplier isInSelectorThread, Executor delegate) {
Expand Down Expand Up @@ -436,7 +436,7 @@ final long referenceCount() {
return pendingOperationCount.get();
}

final static class HttpClientTracker implements Tracker {
static final class HttpClientTracker implements Tracker {
final AtomicLong httpCount;
final AtomicLong http2Count;
final AtomicLong websocketCount;
Expand Down Expand Up @@ -670,7 +670,7 @@ private void debugCompleted(String tag, long startNanos, HttpRequest req) {
}

// Main loop for this client's selector
private final static class SelectorManager extends Thread {
private static final class SelectorManager extends Thread {

// For testing purposes we have an internal System property that
// can control the frequency at which the selector manager will wake
Expand Down Expand Up @@ -1007,7 +1007,7 @@ private static class SelectorAttachment {
private final SelectableChannel chan;
private final Selector selector;
private final Set<AsyncEvent> pending;
private final static Logger debug =
private static final Logger debug =
Utils.getDebugLogger("SelectorAttachment"::toString, Utils.DEBUG);
private int interestOps;

Expand Down
Expand Up @@ -67,7 +67,7 @@
abstract class HttpConnection implements Closeable {

final Logger debug = Utils.getDebugLogger(this::dbgString, Utils.DEBUG);
final static Logger DEBUG_LOGGER = Utils.getDebugLogger(
static final Logger DEBUG_LOGGER = Utils.getDebugLogger(
() -> "HttpConnection(SocketTube(?))", Utils.DEBUG);

/** The address this connection is connected to. Could be a server or a proxy. */
Expand Down
Expand Up @@ -362,7 +362,7 @@ public void onError(Throwable throwable) {
result.completeExceptionally(throwable);
}

static private byte[] join(List<ByteBuffer> bytes) {
private static byte[] join(List<ByteBuffer> bytes) {
int size = Utils.remaining(bytes, Integer.MAX_VALUE);
byte[] res = new byte[size];
int from = 0;
Expand Down Expand Up @@ -396,7 +396,7 @@ public CompletionStage<T> getBody() {
public static class HttpResponseInputStream extends InputStream
implements TrustedSubscriber<InputStream>
{
final static int MAX_BUFFERS_IN_QUEUE = 1; // lock-step with the producer
static final int MAX_BUFFERS_IN_QUEUE = 1; // lock-step with the producer

// An immutable ByteBuffer sentinel to mark that the last byte was received.
private static final ByteBuffer LAST_BUFFER = ByteBuffer.wrap(new byte[0]);
Expand Down Expand Up @@ -882,7 +882,7 @@ Flow.Subscriber<? super List<ByteBuffer>> clear() {
// A subscription that wraps an upstream subscription and
// holds a reference to a subscriber. The subscriber reference
// is cleared when the subscription is cancelled
final static class SubscriptionRef implements Flow.Subscription {
static final class SubscriptionRef implements Flow.Subscription {
final Flow.Subscription subscription;
final SubscriberRef subscriberRef;
SubscriptionRef(Flow.Subscription subscription,
Expand Down
Expand Up @@ -226,7 +226,7 @@ void debugState(String when) {
* signaled. It is the responsibility of the code triggered by
* {@code signalEvent} to resume the event if required.
*/
private static abstract class SocketFlowEvent extends AsyncEvent {
private abstract static class SocketFlowEvent extends AsyncEvent {
final SocketChannel channel;
final int defaultInterest;
volatile int interestOps;
Expand Down
Expand Up @@ -46,19 +46,19 @@
*/
final class DebugLogger implements Logger {
// deliberately not in the same subtree than standard loggers.
final static String HTTP_NAME = "jdk.internal.httpclient.debug";
final static String WS_NAME = "jdk.internal.httpclient.websocket.debug";
final static String HPACK_NAME = "jdk.internal.httpclient.hpack.debug";
final static System.Logger HTTP = System.getLogger(HTTP_NAME);
final static System.Logger WS = System.getLogger(WS_NAME);
final static System.Logger HPACK = System.getLogger(HPACK_NAME);
static final String HTTP_NAME = "jdk.internal.httpclient.debug";
static final String WS_NAME = "jdk.internal.httpclient.websocket.debug";
static final String HPACK_NAME = "jdk.internal.httpclient.hpack.debug";
static final System.Logger HTTP = System.getLogger(HTTP_NAME);
static final System.Logger WS = System.getLogger(WS_NAME);
static final System.Logger HPACK = System.getLogger(HPACK_NAME);
private static final DebugLogger NO_HTTP_LOGGER =
new DebugLogger(HTTP, "HTTP"::toString, Level.OFF, Level.OFF);
private static final DebugLogger NO_WS_LOGGER =
new DebugLogger(HTTP, "WS"::toString, Level.OFF, Level.OFF);
private static final DebugLogger NO_HPACK_LOGGER =
new DebugLogger(HTTP, "HPACK"::toString, Level.OFF, Level.OFF);
final static long START_NANOS = System.nanoTime();
static final long START_NANOS = System.nanoTime();

private final Supplier<String> dbgTag;
private final Level errLevel;
Expand Down
Expand Up @@ -138,7 +138,7 @@ static TubePublisher asTubePublisher(Flow.Publisher<List<ByteBuffer>> p) {
* It is not required that a {@code TubePublisher} implementation extends
* this class.
*/
static abstract class AbstractTubePublisher implements TubePublisher {
abstract static class AbstractTubePublisher implements TubePublisher {
static final class TubePublisherWrapper extends AbstractTubePublisher {
final Flow.Publisher<List<ByteBuffer>> delegate;
public TubePublisherWrapper(Flow.Publisher<List<ByteBuffer>> delegate) {
Expand All @@ -156,7 +156,7 @@ public void subscribe(Flow.Subscriber<? super List<ByteBuffer>> subscriber) {
* It is not required that a {@code TubeSubscriber} implementation extends
* this class.
*/
static abstract class AbstractTubeSubscriber implements TubeSubscriber {
abstract static class AbstractTubeSubscriber implements TubeSubscriber {
static final class TubeSubscriberWrapper extends AbstractTubeSubscriber {
final Flow.Subscriber<? super List<ByteBuffer>> delegate;
TubeSubscriberWrapper(Flow.Subscriber<? super List<ByteBuffer>> delegate) {
Expand Down
Expand Up @@ -42,7 +42,7 @@ public interface ExceptionalSupplier<U> {
U get() throws Throwable;
}

private final static AtomicLong TOKENS = new AtomicLong();
private static final AtomicLong TOKENS = new AtomicLong();
private final long id;
private final Cancelable cancelable;

Expand Down
Expand Up @@ -184,7 +184,7 @@ public boolean isFinished() {
// The DelegateWrapper wraps a subscribed {@code Flow.Subscriber} and
// tracks the subscriber's state. In particular it makes sure that
// onComplete/onError are not called before onSubscribed.
final static class DelegateWrapper implements FlowTube.TubeSubscriber {
static final class DelegateWrapper implements FlowTube.TubeSubscriber {
private final FlowTube.TubeSubscriber delegate;
private final Logger debug;
volatile boolean subscribedCalled;
Expand Down
Expand Up @@ -111,7 +111,7 @@ TryEndDeferredCompleter that this ("parent") TryEndDeferredCompleter is
* later time, and maybe in different thread. This type exists for
* readability purposes at use-sites only.
*/
public static abstract class DeferredCompleter {
public abstract static class DeferredCompleter {

/** Extensible from this (outer) class ONLY. */
private DeferredCompleter() { }
Expand Down Expand Up @@ -140,7 +140,7 @@ public interface RestartableTask {
* A simple and self-contained task that completes once its {@code run}
* method returns.
*/
public static abstract class CompleteRestartableTask
public abstract static class CompleteRestartableTask
implements RestartableTask
{
@Override
Expand Down

1 comment on commit 7115892

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.