Skip to content

Commit

Permalink
Rename ConnectionPoolPartitioning into ChannelPoolPartitioning
Browse files Browse the repository at this point in the history
  • Loading branch information
slandelle committed Nov 24, 2015
1 parent 3574ecf commit fa69571
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 26 deletions.
12 changes: 6 additions & 6 deletions client/src/main/java/org/asynchttpclient/DefaultRequest.java
Expand Up @@ -26,7 +26,7 @@
import java.util.List;
import java.util.Map;

import org.asynchttpclient.channel.pool.ConnectionPoolPartitioning;
import org.asynchttpclient.channel.pool.ChannelPoolPartitioning;
import org.asynchttpclient.cookie.Cookie;
import org.asynchttpclient.proxy.ProxyServer;
import org.asynchttpclient.request.body.generator.BodyGenerator;
Expand Down Expand Up @@ -59,7 +59,7 @@ public class DefaultRequest implements Request {
private final int requestTimeout;
private final long rangeOffset;
private final Charset charset;
private final ConnectionPoolPartitioning connectionPoolPartitioning;
private final ChannelPoolPartitioning channelPoolPartitioning;
private final NameResolver nameResolver;
// lazily loaded
private List<Param> queryParams;
Expand Down Expand Up @@ -87,7 +87,7 @@ public DefaultRequest(String method,//
int requestTimeout,//
long rangeOffset,//
Charset charset,//
ConnectionPoolPartitioning connectionPoolPartitioning,//
ChannelPoolPartitioning channelPoolPartitioning,//
NameResolver nameResolver) {
this.method = method;
this.uri = uri;
Expand All @@ -112,7 +112,7 @@ public DefaultRequest(String method,//
this.requestTimeout = requestTimeout;
this.rangeOffset = rangeOffset;
this.charset = charset;
this.connectionPoolPartitioning = connectionPoolPartitioning;
this.channelPoolPartitioning = channelPoolPartitioning;
this.nameResolver = nameResolver;
}

Expand Down Expand Up @@ -237,8 +237,8 @@ public Charset getCharset() {
}

@Override
public ConnectionPoolPartitioning getConnectionPoolPartitioning() {
return connectionPoolPartitioning;
public ChannelPoolPartitioning getChannelPoolPartitioning() {
return channelPoolPartitioning;
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions client/src/main/java/org/asynchttpclient/Request.java
Expand Up @@ -26,7 +26,7 @@
import java.util.Collection;
import java.util.List;

import org.asynchttpclient.channel.pool.ConnectionPoolPartitioning;
import org.asynchttpclient.channel.pool.ChannelPoolPartitioning;
import org.asynchttpclient.cookie.Cookie;
import org.asynchttpclient.proxy.ProxyServer;
import org.asynchttpclient.request.body.generator.BodyGenerator;
Expand Down Expand Up @@ -203,7 +203,7 @@ public interface Request {
*/
Charset getCharset();

ConnectionPoolPartitioning getConnectionPoolPartitioning();
ChannelPoolPartitioning getChannelPoolPartitioning();

NameResolver getNameResolver();
}
14 changes: 7 additions & 7 deletions client/src/main/java/org/asynchttpclient/RequestBuilderBase.java
Expand Up @@ -31,7 +31,7 @@
import java.util.List;
import java.util.Map;

import org.asynchttpclient.channel.pool.ConnectionPoolPartitioning;
import org.asynchttpclient.channel.pool.ChannelPoolPartitioning;
import org.asynchttpclient.cookie.Cookie;
import org.asynchttpclient.proxy.ProxyServer;
import org.asynchttpclient.request.body.generator.BodyGenerator;
Expand Down Expand Up @@ -85,7 +85,7 @@ public abstract class RequestBuilderBase<T extends RequestBuilderBase<T>> {
protected int requestTimeout;
protected long rangeOffset;
protected Charset charset;
protected ConnectionPoolPartitioning connectionPoolPartitioning = ConnectionPoolPartitioning.PerHostConnectionPoolPartitioning.INSTANCE;
protected ChannelPoolPartitioning channelPoolPartitioning = ChannelPoolPartitioning.PerHostChannelPoolPartitioning.INSTANCE;
protected NameResolver nameResolver = JdkNameResolver.INSTANCE;

protected RequestBuilderBase(String method, boolean disableUrlEncoding) {
Expand Down Expand Up @@ -134,7 +134,7 @@ protected RequestBuilderBase(Request prototype, boolean disableUrlEncoding, bool
this.requestTimeout = prototype.getRequestTimeout();
this.rangeOffset = prototype.getRangeOffset();
this.charset = prototype.getCharset();
this.connectionPoolPartitioning = prototype.getConnectionPoolPartitioning();
this.channelPoolPartitioning = prototype.getChannelPoolPartitioning();
this.nameResolver = prototype.getNameResolver();
}

Expand Down Expand Up @@ -421,8 +421,8 @@ public T setCharset(Charset charset) {
return asDerivedType();
}

public T setConnectionPoolPartitioning(ConnectionPoolPartitioning connectionPoolPartitioning) {
this.connectionPoolPartitioning = connectionPoolPartitioning;
public T setChannelPoolPartitioning(ChannelPoolPartitioning channelPoolPartitioning) {
this.channelPoolPartitioning = channelPoolPartitioning;
return asDerivedType();
}

Expand Down Expand Up @@ -476,7 +476,7 @@ private RequestBuilderBase<?> executeSignatureCalculator() {
rb.requestTimeout = this.requestTimeout;
rb.rangeOffset = this.rangeOffset;
rb.charset = this.charset;
rb.connectionPoolPartitioning = this.connectionPoolPartitioning;
rb.channelPoolPartitioning = this.channelPoolPartitioning;
rb.nameResolver = this.nameResolver;
Request unsignedRequest = rb.build();
signatureCalculator.calculateAndAddSignature(unsignedRequest, rb);
Expand Down Expand Up @@ -567,7 +567,7 @@ public Request build() {
rb.requestTimeout,//
rb.rangeOffset,//
finalCharset,//
rb.connectionPoolPartitioning,//
rb.channelPoolPartitioning,//
rb.nameResolver);
}
}
Expand Up @@ -16,7 +16,7 @@
import org.asynchttpclient.uri.Uri;
import org.asynchttpclient.util.HttpUtils;

public interface ConnectionPoolPartitioning {
public interface ChannelPoolPartitioning {

class ProxyPartitionKey {
private final String proxyHost;
Expand Down Expand Up @@ -44,7 +44,7 @@ public String toString() {

Object getPartitionKey(Uri uri, String virtualHost, ProxyServer proxyServer);

enum PerHostConnectionPoolPartitioning implements ConnectionPoolPartitioning {
enum PerHostChannelPoolPartitioning implements ChannelPoolPartitioning {

INSTANCE;

Expand Down
Expand Up @@ -34,7 +34,7 @@
import org.asynchttpclient.AsyncHandler;
import org.asynchttpclient.Realm;
import org.asynchttpclient.Request;
import org.asynchttpclient.channel.pool.ConnectionPoolPartitioning;
import org.asynchttpclient.channel.pool.ChannelPoolPartitioning;
import org.asynchttpclient.future.AbstractListenableFuture;
import org.asynchttpclient.netty.channel.ChannelState;
import org.asynchttpclient.netty.channel.Channels;
Expand All @@ -55,7 +55,7 @@ public final class NettyResponseFuture<V> extends AbstractListenableFuture<V> {
private static final Logger LOGGER = LoggerFactory.getLogger(NettyResponseFuture.class);

private final long start = millisTime();
private final ConnectionPoolPartitioning connectionPoolPartitioning;
private final ChannelPoolPartitioning connectionPoolPartitioning;
private final ProxyServer proxyServer;
private final int maxRetry;
private final CountDownLatch latch = new CountDownLatch(1);
Expand Down Expand Up @@ -96,7 +96,7 @@ public NettyResponseFuture(Request originalRequest,//
AsyncHandler<V> asyncHandler,//
NettyRequest nettyRequest,//
int maxRetry,//
ConnectionPoolPartitioning connectionPoolPartitioning,//
ChannelPoolPartitioning connectionPoolPartitioning,//
ProxyServer proxyServer) {

this.asyncHandler = asyncHandler;
Expand Down Expand Up @@ -272,7 +272,7 @@ public Uri getUri() {
return targetRequest.getUri();
}

public ConnectionPoolPartitioning getConnectionPoolPartitioning() {
public ChannelPoolPartitioning getConnectionPoolPartitioning() {
return connectionPoolPartitioning;
}

Expand Down
Expand Up @@ -49,7 +49,7 @@
import org.asynchttpclient.AsyncHandler;
import org.asynchttpclient.AsyncHttpClientConfig;
import org.asynchttpclient.SslEngineFactory;
import org.asynchttpclient.channel.pool.ConnectionPoolPartitioning;
import org.asynchttpclient.channel.pool.ChannelPoolPartitioning;
import org.asynchttpclient.handler.AsyncHandlerExtensions;
import org.asynchttpclient.netty.Callback;
import org.asynchttpclient.netty.NettyResponseFuture;
Expand Down Expand Up @@ -287,7 +287,7 @@ public final void tryToOfferChannelToPool(Channel channel, AsyncHandler<?> async
}
}

public Channel poll(Uri uri, String virtualHost, ProxyServer proxy, ConnectionPoolPartitioning connectionPoolPartitioning) {
public Channel poll(Uri uri, String virtualHost, ProxyServer proxy, ChannelPoolPartitioning connectionPoolPartitioning) {
Object partitionKey = connectionPoolPartitioning.getPartitionKey(uri, virtualHost, proxy);
return channelPool.poll(partitionKey);
}
Expand Down
Expand Up @@ -123,7 +123,7 @@ protected boolean exitAfterHandlingRedirect(//

final RequestBuilder requestBuilder = new RequestBuilder(switchToGet ? GET : originalMethod)//
.setCookies(request.getCookies())//
.setConnectionPoolPartitioning(request.getConnectionPoolPartitioning())//
.setChannelPoolPartitioning(request.getChannelPoolPartitioning())//
.setFollowRedirect(true)//
.setLocalAddress(request.getLocalAddress())//
.setNameResolver(request.getNameResolver())//
Expand Down
Expand Up @@ -300,7 +300,7 @@ private <T> NettyResponseFuture<T> newNettyResponseFuture(Request request, Async
asyncHandler,//
nettyRequest,//
config.getMaxRequestRetry(),//
request.getConnectionPoolPartitioning(),//
request.getChannelPoolPartitioning(),//
proxyServer);

String expectHeader = request.getHeaders().get(HttpHeaders.Names.EXPECT);
Expand Down Expand Up @@ -468,7 +468,7 @@ private Channel pollPooledChannel(Request request, ProxyServer proxy, AsyncHandl

Uri uri = request.getUri();
String virtualHost = request.getVirtualHost();
final Channel channel = channelManager.poll(uri, virtualHost, proxy, request.getConnectionPoolPartitioning());
final Channel channel = channelManager.poll(uri, virtualHost, proxy, request.getChannelPoolPartitioning());

if (channel != null) {
LOGGER.debug("Using polled Channel {}\n for uri {}\n", channel, uri);
Expand Down

0 comments on commit fa69571

Please sign in to comment.