本文整理汇总了Java中org.apache.http.util.Args.notNegative方法的典型用法代码示例。如果您正苦于以下问题:Java Args.notNegative方法的具体用法?Java Args.notNegative怎么用?Java Args.notNegative使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.http.util.Args
的用法示例。
在下文中一共展示了Args.notNegative方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AbstractConnPool
import org.apache.http.util.Args; //导入方法依赖的package包/类
public AbstractConnPool(
final ConnFactory<T, C> connFactory,
final int defaultMaxPerRoute,
final int maxTotal) {
super();
this.connFactory = Args.notNull(connFactory, "Connection factory");
this.defaultMaxPerRoute = Args.notNegative(defaultMaxPerRoute, "Max per route value");
this.maxTotal = Args.notNegative(maxTotal, "Max total value");
this.lock = new ReentrantLock();
this.routeToPool = new HashMap<T, RouteSpecificPool<T, C, E>>();
this.leased = new HashSet<E>();
this.available = new LinkedList<E>();
this.pending = new LinkedList<PoolEntryFuture<E>>();
this.maxPerRoute = new HashMap<T, Integer>();
}
示例2: setMaxTotal
import org.apache.http.util.Args; //导入方法依赖的package包/类
public void setMaxTotal(final int max) {
Args.notNegative(max, "Max value");
this.lock.lock();
try {
this.maxTotal = max;
} finally {
this.lock.unlock();
}
}
示例3: setDefaultMaxPerRoute
import org.apache.http.util.Args; //导入方法依赖的package包/类
public void setDefaultMaxPerRoute(final int max) {
Args.notNegative(max, "Max per route value");
this.lock.lock();
try {
this.defaultMaxPerRoute = max;
} finally {
this.lock.unlock();
}
}
示例4: setMaxPerRoute
import org.apache.http.util.Args; //导入方法依赖的package包/类
public void setMaxPerRoute(final T route, final int max) {
Args.notNull(route, "Route");
Args.notNegative(max, "Max per route value");
this.lock.lock();
try {
this.maxPerRoute.put(route, Integer.valueOf(max));
} finally {
this.lock.unlock();
}
}
示例5: ExponentialBackOffSchedulingStrategy
import org.apache.http.util.Args; //导入方法依赖的package包/类
ExponentialBackOffSchedulingStrategy(
final ScheduledExecutorService executor,
final long backOffRate,
final long initialExpiryInMillis,
final long maxExpiryInMillis) {
this.executor = Args.notNull(executor, "Executor");
this.backOffRate = Args.notNegative(backOffRate, "BackOffRate");
this.initialExpiryInMillis = Args.notNegative(initialExpiryInMillis, "InitialExpiryInMillis");
this.maxExpiryInMillis = Args.notNegative(maxExpiryInMillis, "MaxExpiryInMillis");
}
示例6: CookieOrigin
import org.apache.http.util.Args; //导入方法依赖的package包/类
public CookieOrigin(final String host, final int port, final String path, final boolean secure) {
super();
Args.notBlank(host, "Host");
Args.notNegative(port, "Port");
Args.notNull(path, "Path");
this.host = host.toLowerCase(Locale.ROOT);
this.port = port;
if (!TextUtils.isBlank(path)) {
this.path = path;
} else {
this.path = "/";
}
this.secure = secure;
}
示例7: getHopTarget
import org.apache.http.util.Args; //导入方法依赖的package包/类
@Override
public final HttpHost getHopTarget(final int hop) {
Args.notNegative(hop, "Hop index");
final int hopcount = getHopCount();
Args.check(hop < hopcount, "Hop index exceeds tracked route length");
if (hop < hopcount - 1) {
return this.proxyChain.get(hop);
} else {
return this.targetHost;
}
}
示例8: getHopTarget
import org.apache.http.util.Args; //导入方法依赖的package包/类
@Override
public final HttpHost getHopTarget(final int hop) {
Args.notNegative(hop, "Hop index");
final int hopcount = getHopCount();
Args.check(hop < hopcount, "Hop index exceeds tracked route length");
HttpHost result = null;
if (hop < hopcount-1) {
result = this.proxyChain[hop];
} else {
result = this.targetHost;
}
return result;
}
示例9: lineLen
import org.apache.http.util.Args; //导入方法依赖的package包/类
public static MessageConstraints lineLen(final int max) {
return new MessageConstraints(Args.notNegative(max, "Max line length"), -1);
}
示例10: ContentLengthInputStreamHC4
import org.apache.http.util.Args; //导入方法依赖的package包/类
/**
* Wraps a session input buffer and cuts off output after a defined number
* of bytes.
*
* @param in The session input buffer
* @param contentLength The maximum number of bytes that can be read from
* the stream. Subsequent read operations will return -1.
*/
public ContentLengthInputStreamHC4(final SessionInputBuffer in, final long contentLength) {
super();
this.in = Args.notNull(in, "Session input buffer");
this.contentLength = Args.notNegative(contentLength, "Content length");
}
示例11: ContentLengthOutputStreamHC4
import org.apache.http.util.Args; //导入方法依赖的package包/类
/**
* Wraps a session output buffer and cuts off output after a defined number
* of bytes.
*
* @param out The session output buffer
* @param contentLength The maximum number of bytes that can be written to
* the stream. Subsequent write operations will be ignored.
*
* @since 4.0
*/
public ContentLengthOutputStreamHC4(final SessionOutputBuffer out, final long contentLength) {
super();
this.out = Args.notNull(out, "Session output buffer");
this.contentLength = Args.notNegative(contentLength, "Content length");
}