Skip to content

Commit 5b5bafe

Browse files
committed
add io thread config param
1 parent d6e5a0f commit 5b5bafe

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/main/java/com/ning/http/client/AsyncHttpClientConfig.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ public class AsyncHttpClientConfig {
7979
private final boolean allowSslConnectionPool;
8080
private final boolean useRawUrl;
8181
private final boolean removeQueryParamOnRedirect;
82-
private final int ioThreadMultiplier;
8382
private final HostnameVerifier hostnameVerifier;
83+
private final int ioThreadMultiplier;
8484

8585
private AsyncHttpClientConfig(int maxTotalConnections,
8686
int maxConnectionPerHost,
@@ -107,8 +107,8 @@ private AsyncHttpClientConfig(int maxTotalConnections,
107107
boolean allowSslConnectionCaching,
108108
boolean useRawUrl,
109109
boolean removeQueryParamOnRedirect,
110-
int ioThreadMultiplier,
111-
HostnameVerifier hostnameVerifier) {
110+
HostnameVerifier hostnameVerifier,
111+
int ioThreadMultiplier) {
112112

113113
this.maxTotalConnections = maxTotalConnections;
114114
this.maxConnectionPerHost = maxConnectionPerHost;
@@ -133,8 +133,8 @@ private AsyncHttpClientConfig(int maxTotalConnections,
133133
this.reaper = reaper;
134134
this.allowSslConnectionPool = allowSslConnectionCaching;
135135
this.removeQueryParamOnRedirect = removeQueryParamOnRedirect;
136-
this.ioThreadMultiplier = ioThreadMultiplier;
137136
this.hostnameVerifier = hostnameVerifier;
137+
this.ioThreadMultiplier = ioThreadMultiplier;
138138

139139
if (applicationThreadPool == null) {
140140
this.applicationThreadPool = Executors.newCachedThreadPool();
@@ -414,14 +414,6 @@ public boolean isRemoveQueryParamOnRedirect() {
414414
return removeQueryParamOnRedirect;
415415
}
416416

417-
/***
418-
*
419-
* @return number to multiply by availableProcessors() that will determine # of NioWorkers to use
420-
*/
421-
public int getIoThreadMultiplier() {
422-
return ioThreadMultiplier;
423-
}
424-
425417
/**
426418
* Return true if one of the {@link java.util.concurrent.ExecutorService} has been shutdown.
427419
* @return true if one of the {@link java.util.concurrent.ExecutorService} has been shutdown.
@@ -438,6 +430,14 @@ public HostnameVerifier getHostnameVerifier() {
438430
return hostnameVerifier;
439431
}
440432

433+
/***
434+
*
435+
* @return number to multiply by availableProcessors() that will determine # of NioWorkers to use
436+
*/
437+
public int getIoThreadMultiplier() {
438+
return ioThreadMultiplier;
439+
}
440+
441441
/**
442442
* Builder for an {@link AsyncHttpClient}
443443
*/
@@ -481,13 +481,13 @@ public Thread newThread(Runnable r) {
481481
private boolean allowSslConnectionPool = true;
482482
private boolean useRawUrl = false;
483483
private boolean removeQueryParamOnRedirect = true;
484-
private int ioThreadMultiplier = 2;
485484
private HostnameVerifier hostnameVerifier = new HostnameVerifier() {
486485

487486
public boolean verify( String s, SSLSession sslSession ) {
488487
return true;
489488
}
490489
};
490+
private int ioThreadMultiplier = 2;
491491

492492
public Builder() {
493493
}
@@ -877,11 +877,6 @@ public Builder setUseProxyProperties(boolean useProxyProperties) {
877877
return this;
878878
}
879879

880-
public Builder setIOThreadMultiplier(int multiplier){
881-
this.ioThreadMultiplier = multiplier;
882-
return this;
883-
}
884-
885880
/**
886881
* Set the {@link HostnameVerifier}
887882
* @param hostnameVerifier {@link HostnameVerifier}
@@ -892,6 +887,11 @@ public Builder setHostnameVerifier(HostnameVerifier hostnameVerifier){
892887
return this;
893888
}
894889

890+
public Builder setIOThreadMultiplier(int multiplier){
891+
this.ioThreadMultiplier = multiplier;
892+
return this;
893+
}
894+
895895
/**
896896
* Create a config builder with values taken from the given prototype configuration.
897897
*
@@ -964,8 +964,8 @@ public AsyncHttpClientConfig build() {
964964
allowSslConnectionPool,
965965
useRawUrl,
966966
removeQueryParamOnRedirect,
967-
ioThreadMultiplier,
968-
hostnameVerifier);
967+
hostnameVerifier,
968+
ioThreadMultiplier);
969969
}
970970
}
971971
}

0 commit comments

Comments
 (0)