Skip to content

Commit 47ae1e3

Browse files
committed
Stick to POJO convention
1 parent b0c1470 commit 47ae1e3

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public class AsyncHttpClientConfig {
9494

9595
protected boolean compressionEnforced;
9696
protected String userAgent;
97-
protected ExecutorService applicationThreadPool;
97+
protected ExecutorService executorService;
9898
protected Realm realm;
9999
protected List<RequestFilter> requestFilters;
100100
protected List<ResponseFilter> responseFilters;
@@ -137,7 +137,7 @@ private AsyncHttpClientConfig(String name,//
137137
boolean followRedirect, //
138138
int maxRedirects, //
139139
boolean strict302Handling, //
140-
ExecutorService applicationThreadPool,//
140+
ExecutorService executorService,//
141141
ProxyServerSelector proxyServerSelector, //
142142
boolean compressionEnforced, //
143143
String userAgent,//
@@ -184,12 +184,12 @@ private AsyncHttpClientConfig(String name,//
184184
this.compressionEnforced = compressionEnforced;
185185
this.userAgent = userAgent;
186186

187-
if (applicationThreadPool != null) {
188-
this.applicationThreadPool = applicationThreadPool;
187+
if (executorService != null) {
188+
this.executorService = executorService;
189189
} else {
190190
PrefixIncrementThreadFactory threadFactory = new PrefixIncrementThreadFactory(
191191
getNameOrDefault() + "-");
192-
this.applicationThreadPool = Executors.newCachedThreadPool(threadFactory);
192+
this.executorService = Executors.newCachedThreadPool(threadFactory);
193193
}
194194

195195
this.realm = realm;
@@ -375,8 +375,8 @@ public boolean isCompressionEnforced() {
375375
* If no {@link ExecutorService} has been explicitly provided, this
376376
* method will return <code>null</code>
377377
*/
378-
public ExecutorService executorService() {
379-
return applicationThreadPool;
378+
public ExecutorService getExecutorService() {
379+
return executorService;
380380
}
381381

382382
/**
@@ -494,7 +494,7 @@ public boolean isDisableUrlEncodingForBoundRequests() {
494494
public boolean isValid() {
495495
boolean atpRunning = true;
496496
try {
497-
atpRunning = applicationThreadPool.isShutdown();
497+
atpRunning = executorService.isShutdown();
498498
} catch (Exception ignore) {
499499
// isShutdown() will thrown an exception in an EE7 environment
500500
// when using a ManagedExecutorService.
@@ -1179,7 +1179,7 @@ public Builder(AsyncHttpClientConfig prototype) {
11791179
userAgent = prototype.getUserAgent();
11801180
followRedirect = prototype.isFollowRedirect();
11811181
compressionEnforced = prototype.isCompressionEnforced();
1182-
applicationThreadPool = prototype.executorService();
1182+
applicationThreadPool = prototype.getExecutorService();
11831183

11841184
requestFilters.clear();
11851185
responseFilters.clear();

api/src/main/java/org/asynchttpclient/config/AsyncHttpClientConfigBean.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void configureDefaults() {
8080
}
8181

8282
void configureExecutors() {
83-
applicationThreadPool = Executors.newCachedThreadPool(new ThreadFactory() {
83+
executorService = Executors.newCachedThreadPool(new ThreadFactory() {
8484
public Thread newThread(Runnable r) {
8585
Thread t = new Thread(r, "AsyncHttpClient-Callback");
8686
t.setDaemon(true);
@@ -160,10 +160,10 @@ public AsyncHttpClientConfigBean setAllowPoolingConnections(boolean allowPooling
160160
}
161161

162162
public AsyncHttpClientConfigBean setApplicationThreadPool(ExecutorService applicationThreadPool) {
163-
if (this.applicationThreadPool != null) {
164-
this.applicationThreadPool.shutdownNow();
163+
if (this.executorService != null) {
164+
this.executorService.shutdownNow();
165165
}
166-
this.applicationThreadPool = applicationThreadPool;
166+
this.executorService = applicationThreadPool;
167167
return this;
168168
}
169169

providers/netty3/src/main/java/org/asynchttpclient/netty/NettyAsyncHttpProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public void close() {
7070
channelManager.close();
7171

7272
// FIXME shouldn't close if not allowed
73-
config.executorService().shutdown();
73+
config.getExecutorService().shutdown();
7474

7575
if (allowStopNettyTimer)
7676
nettyTimer.stop();

providers/netty3/src/main/java/org/asynchttpclient/netty/channel/ChannelManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public Semaphore apply(Object partitionKey) {
195195
int numWorkers = config.getIoThreadMultiplier() * Runtime.getRuntime().availableProcessors();
196196
LOGGER.trace("Number of application's worker threads is {}", numWorkers);
197197
NioClientBossPool nioClientBossPool = new NioClientBossPool(e, 1, new HashedWheelTimer(), ThreadNameDeterminer.CURRENT);
198-
NioWorkerPool nioWorkerPool = new NioWorkerPool(config.executorService(), numWorkers, ThreadNameDeterminer.CURRENT);
198+
NioWorkerPool nioWorkerPool = new NioWorkerPool(config.getExecutorService(), numWorkers, ThreadNameDeterminer.CURRENT);
199199
socketChannelFactory = new NioClientSocketChannelFactory(nioClientBossPool, nioWorkerPool);
200200
allowReleaseSocketChannelFactory = true;
201201
}
@@ -330,7 +330,7 @@ public void close() {
330330
}
331331

332332
// FIXME also shutdown in provider
333-
config.executorService().shutdown();
333+
config.getExecutorService().shutdown();
334334
if (allowReleaseSocketChannelFactory) {
335335
socketChannelFactory.releaseExternalResources();
336336
httpBootstrap.releaseExternalResources();

0 commit comments

Comments
 (0)