Skip to content

Commit 661ec72

Browse files
authored
Cleanup (#1963)
1 parent 954acb1 commit 661ec72

23 files changed

+243
-198
lines changed

client/src/main/java/org/asynchttpclient/AsyncHandler.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ default State onTrailingHeadersReceived(HttpHeaders headers) throws Exception {
116116
* @return T Value that will be returned by the associated {@link Future}
117117
* @throws Exception if something wrong happens
118118
*/
119-
@Nullable T onCompleted() throws Exception;
119+
@Nullable
120+
T onCompleted() throws Exception;
120121

121122
/**
122123
* Notify the callback before hostname resolution

client/src/main/java/org/asynchttpclient/AsyncHttpClientConfig.java

+26-13
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ public interface AsyncHttpClientConfig {
160160
* @return the {@link ThreadFactory} an {@link AsyncHttpClient} use for handling asynchronous response. If no {@link ThreadFactory} has been explicitly
161161
* provided, this method will return {@code null}
162162
*/
163-
@Nullable ThreadFactory getThreadFactory();
163+
@Nullable
164+
ThreadFactory getThreadFactory();
164165

165166
/**
166167
* An instance of {@link ProxyServer} used by an {@link AsyncHttpClient}
@@ -174,14 +175,16 @@ public interface AsyncHttpClientConfig {
174175
*
175176
* @return an instance of {@link SslContext} used for SSL connection.
176177
*/
177-
@Nullable SslContext getSslContext();
178+
@Nullable
179+
SslContext getSslContext();
178180

179181
/**
180182
* Return the current {@link Realm}
181183
*
182184
* @return the current {@link Realm}
183185
*/
184-
@Nullable Realm getRealm();
186+
@Nullable
187+
Realm getRealm();
185188

186189
/**
187190
* Return the list of {@link RequestFilter}
@@ -260,12 +263,14 @@ public interface AsyncHttpClientConfig {
260263
/**
261264
* @return the array of enabled protocols
262265
*/
263-
@Nullable String[] getEnabledProtocols();
266+
@Nullable
267+
String[] getEnabledProtocols();
264268

265269
/**
266270
* @return the array of enabled cipher suites
267271
*/
268-
@Nullable String[] getEnabledCipherSuites();
272+
@Nullable
273+
String[] getEnabledCipherSuites();
269274

270275
/**
271276
* @return if insecure cipher suites must be filtered out (only used when not explicitly passing enabled cipher suites)
@@ -294,7 +299,8 @@ public interface AsyncHttpClientConfig {
294299

295300
int getHandshakeTimeout();
296301

297-
@Nullable SslEngineFactory getSslEngineFactory();
302+
@Nullable
303+
SslEngineFactory getSslEngineFactory();
298304

299305
int getChunkedFileChunkSize();
300306

@@ -310,23 +316,29 @@ public interface AsyncHttpClientConfig {
310316

311317
Map<ChannelOption<Object>, Object> getChannelOptions();
312318

313-
@Nullable EventLoopGroup getEventLoopGroup();
319+
@Nullable
320+
EventLoopGroup getEventLoopGroup();
314321

315322
boolean isUseNativeTransport();
316323

317324
boolean isUseOnlyEpollNativeTransport();
318325

319-
@Nullable Consumer<Channel> getHttpAdditionalChannelInitializer();
326+
@Nullable
327+
Consumer<Channel> getHttpAdditionalChannelInitializer();
320328

321-
@Nullable Consumer<Channel> getWsAdditionalChannelInitializer();
329+
@Nullable
330+
Consumer<Channel> getWsAdditionalChannelInitializer();
322331

323332
ResponseBodyPartFactory getResponseBodyPartFactory();
324333

325-
@Nullable ChannelPool getChannelPool();
334+
@Nullable
335+
ChannelPool getChannelPool();
326336

327-
@Nullable ConnectionSemaphoreFactory getConnectionSemaphoreFactory();
337+
@Nullable
338+
ConnectionSemaphoreFactory getConnectionSemaphoreFactory();
328339

329-
@Nullable Timer getNettyTimer();
340+
@Nullable
341+
Timer getNettyTimer();
330342

331343
/**
332344
* @return the duration between tick of {@link HashedWheelTimer}
@@ -358,7 +370,8 @@ public interface AsyncHttpClientConfig {
358370

359371
int getSoRcvBuf();
360372

361-
@Nullable ByteBufAllocator getAllocator();
373+
@Nullable
374+
ByteBufAllocator getAllocator();
362375

363376
int getIoThreadsCount();
364377

client/src/main/java/org/asynchttpclient/DefaultAsyncHttpClient.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
import org.asynchttpclient.channel.ChannelPool;
2525
import org.asynchttpclient.cookie.CookieEvictionTask;
2626
import org.asynchttpclient.cookie.CookieStore;
27-
import org.asynchttpclient.filter.FilterContext;
2827
import org.asynchttpclient.exception.FilterException;
28+
import org.asynchttpclient.filter.FilterContext;
2929
import org.asynchttpclient.filter.RequestFilter;
3030
import org.asynchttpclient.handler.resumable.ResumableAsyncHandler;
3131
import org.asynchttpclient.netty.channel.ChannelManager;

client/src/main/java/org/asynchttpclient/HttpResponseBodyPart.java

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package org.asynchttpclient;
1717

1818
import io.netty.buffer.ByteBuf;
19+
1920
import java.nio.ByteBuffer;
2021

2122
/**

client/src/main/java/org/asynchttpclient/Request.java

+28-14
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,14 @@ public interface Request {
6767
/**
6868
* @return the InetAddress to be used to bypass uri's hostname resolution
6969
*/
70-
@Nullable InetAddress getAddress();
70+
@Nullable
71+
InetAddress getAddress();
7172

7273
/**
7374
* @return the local address to bind from
7475
*/
75-
@Nullable InetAddress getLocalAddress();
76+
@Nullable
77+
InetAddress getLocalAddress();
7678

7779
/**
7880
* @return the HTTP headers
@@ -92,32 +94,38 @@ public interface Request {
9294
/**
9395
* @return the request's body array of byte arrays (only non-null if it was set this way)
9496
*/
95-
@Nullable List<byte[]> getCompositeByteData();
97+
@Nullable
98+
List<byte[]> getCompositeByteData();
9699

97100
/**
98101
* @return the request's body string (only non-null if it was set this way)
99102
*/
100-
@Nullable String getStringData();
103+
@Nullable
104+
String getStringData();
101105

102106
/**
103107
* @return the request's body ByteBuffer (only non-null if it was set this way)
104108
*/
105-
@Nullable ByteBuffer getByteBufferData();
109+
@Nullable
110+
ByteBuffer getByteBufferData();
106111

107112
/**
108113
* @return the request's body ByteBuf (only non-null if it was set this way)
109114
*/
110-
@Nullable ByteBuf getByteBufData();
115+
@Nullable
116+
ByteBuf getByteBufData();
111117

112118
/**
113119
* @return the request's body InputStream (only non-null if it was set this way)
114120
*/
115-
@Nullable InputStream getStreamData();
121+
@Nullable
122+
InputStream getStreamData();
116123

117124
/**
118125
* @return the request's body BodyGenerator (only non-null if it was set this way)
119126
*/
120-
@Nullable BodyGenerator getBodyGenerator();
127+
@Nullable
128+
BodyGenerator getBodyGenerator();
121129

122130
/**
123131
* @return the request's form parameters
@@ -132,7 +140,8 @@ public interface Request {
132140
/**
133141
* @return the virtual host to connect to
134142
*/
135-
@Nullable String getVirtualHost();
143+
@Nullable
144+
String getVirtualHost();
136145

137146
/**
138147
* @return the query params resolved from the url/uri
@@ -142,22 +151,26 @@ public interface Request {
142151
/**
143152
* @return the proxy server to be used to perform this request (overrides the one defined in config)
144153
*/
145-
@Nullable ProxyServer getProxyServer();
154+
@Nullable
155+
ProxyServer getProxyServer();
146156

147157
/**
148158
* @return the realm to be used to perform this request (overrides the one defined in config)
149159
*/
150-
@Nullable Realm getRealm();
160+
@Nullable
161+
Realm getRealm();
151162

152163
/**
153164
* @return the file to be uploaded
154165
*/
155-
@Nullable File getFile();
166+
@Nullable
167+
File getFile();
156168

157169
/**
158170
* @return if this request is to follow redirects. Non null values means "override config value".
159171
*/
160-
@Nullable Boolean getFollowRedirect();
172+
@Nullable
173+
Boolean getFollowRedirect();
161174

162175
/**
163176
* @return the request timeout. Non zero values means "override config value".
@@ -177,7 +190,8 @@ public interface Request {
177190
/**
178191
* @return the charset value used when decoding the request's body.
179192
*/
180-
@Nullable Charset getCharset();
193+
@Nullable
194+
Charset getCharset();
181195

182196
/**
183197
* @return the strategy to compute ChannelPool's keys

client/src/main/java/org/asynchttpclient/channel/ChannelPool.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ public interface ChannelPool {
3838
* @param partitionKey the partition used when invoking offer
3939
* @return the channel associated with the uri
4040
*/
41-
@Nullable Channel poll(Object partitionKey);
41+
@Nullable
42+
Channel poll(Object partitionKey);
4243

4344
/**
4445
* Remove all channels from the cache. A channel might have been associated

client/src/main/java/org/asynchttpclient/channel/NoopChannelPool.java

-7
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ public enum NoopChannelPool implements ChannelPool {
3030
INSTANCE;
3131

3232
/**
33-
*
3433
* @return always false since this is a {@link NoopChannelPool}
3534
*/
3635
@Override
@@ -39,7 +38,6 @@ public boolean offer(Channel channel, Object partitionKey) {
3938
}
4039

4140
/**
42-
*
4341
* @return always null since this is a {@link NoopChannelPool}
4442
*/
4543
@Override
@@ -48,7 +46,6 @@ public boolean offer(Channel channel, Object partitionKey) {
4846
}
4947

5048
/**
51-
*
5249
* @return always false since this is a {@link NoopChannelPool}
5350
*/
5451
@Override
@@ -57,7 +54,6 @@ public boolean removeAll(Channel channel) {
5754
}
5855

5956
/**
60-
*
6157
* @return always true since this is a {@link NoopChannelPool}
6258
*/
6359
@Override
@@ -66,23 +62,20 @@ public boolean isOpen() {
6662
}
6763

6864
/**
69-
*
7065
* Does nothing since this is a {@link NoopChannelPool}
7166
*/
7267
@Override
7368
public void destroy() {
7469
}
7570

7671
/**
77-
*
7872
* Does nothing since this is a {@link NoopChannelPool}
7973
*/
8074
@Override
8175
public void flushPartitions(Predicate<Object> predicate) {
8276
}
8377

8478
/**
85-
*
8679
* @return always {@link Collections#emptyMap()} since this is a {@link NoopChannelPool}
8780
*/
8881
@Override

client/src/main/java/org/asynchttpclient/cookie/ThreadSafeCookieStore.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ private void removeExpired() {
229229

230230
cookieJar.values()
231231
.forEach(cookieMap -> removed[0] |= cookieMap.entrySet()
232-
.removeIf(v -> hasCookieExpired(v.getValue().cookie, v.getValue().createdAt)));
232+
.removeIf(v -> hasCookieExpired(v.getValue().cookie, v.getValue().createdAt)));
233233

234234
if (removed[0]) {
235235
cookieJar.entrySet().removeIf(entry -> entry.getValue() == null || entry.getValue().isEmpty());

client/src/main/java/org/asynchttpclient/netty/handler/intercept/ResponseFiltersInterceptor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
import org.asynchttpclient.AsyncHandler;
2121
import org.asynchttpclient.AsyncHttpClientConfig;
2222
import org.asynchttpclient.HttpResponseStatus;
23-
import org.asynchttpclient.filter.FilterContext;
2423
import org.asynchttpclient.exception.FilterException;
24+
import org.asynchttpclient.filter.FilterContext;
2525
import org.asynchttpclient.filter.ResponseFilter;
2626
import org.asynchttpclient.netty.NettyResponseFuture;
2727
import org.asynchttpclient.netty.request.NettyRequestSender;

client/src/main/java/org/asynchttpclient/netty/request/NettyRequestSender.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636
import org.asynchttpclient.Realm;
3737
import org.asynchttpclient.Realm.AuthScheme;
3838
import org.asynchttpclient.Request;
39+
import org.asynchttpclient.exception.FilterException;
3940
import org.asynchttpclient.exception.PoolAlreadyClosedException;
4041
import org.asynchttpclient.exception.RemotelyClosedException;
4142
import org.asynchttpclient.filter.FilterContext;
42-
import org.asynchttpclient.exception.FilterException;
4343
import org.asynchttpclient.filter.IOExceptionFilter;
4444
import org.asynchttpclient.handler.TransferCompletionHandler;
4545
import org.asynchttpclient.netty.NettyResponseFuture;

client/src/main/java/org/asynchttpclient/ntlm/NtlmEngine.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,8 @@ byte[] getChallenge() {
10831083
/**
10841084
* Retrieve the target
10851085
*/
1086-
@Nullable String getTarget() {
1086+
@Nullable
1087+
String getTarget() {
10871088
return target;
10881089
}
10891090

client/src/main/java/org/asynchttpclient/proxy/ProxyServerSelector.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,6 @@ public interface ProxyServerSelector {
3535
* @param uri The URI to select a proxy server for.
3636
* @return The proxy server to use, if any. May return null.
3737
*/
38-
@Nullable ProxyServer select(Uri uri);
38+
@Nullable
39+
ProxyServer select(Uri uri);
3940
}

client/src/test/java/org/asynchttpclient/AbstractBasicTest.java

-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
import org.eclipse.jetty.server.ServerConnector;
2222
import org.eclipse.jetty.server.handler.AbstractHandler;
2323
import org.junit.jupiter.api.AfterAll;
24-
import org.junit.jupiter.api.AfterEach;
2524
import org.junit.jupiter.api.BeforeAll;
26-
import org.junit.jupiter.api.BeforeEach;
2725
import org.junit.jupiter.api.TestInstance;
2826
import org.junit.jupiter.api.extension.ExtendWith;
2927
import org.slf4j.Logger;

0 commit comments

Comments
 (0)