update to netty 4.1.63
This commit is contained in:
parent
ffb4491f5e
commit
de0c798c45
4 changed files with 24 additions and 12 deletions
|
@ -1,10 +1,10 @@
|
||||||
group = org.xbib
|
group = org.xbib
|
||||||
name = netty-http
|
name = netty-http
|
||||||
version = 4.1.60.0
|
version = 4.1.63.0
|
||||||
|
|
||||||
gradle.wrapper.version = 6.6.1
|
gradle.wrapper.version = 6.6.1
|
||||||
netty.version = 4.1.60.Final
|
netty.version = 4.1.63.Final
|
||||||
tcnative.version = 2.0.36.Final
|
tcnative.version = 2.0.38.Final
|
||||||
bouncycastle.version = 1.68
|
bouncycastle.version = 1.68
|
||||||
reactivestreams.version = 1.0.2
|
reactivestreams.version = 1.0.2
|
||||||
reactivex.version = 1.3.8
|
reactivex.version = 1.3.8
|
||||||
|
|
|
@ -30,6 +30,7 @@ task sourcesJar(type: Jar, dependsOn: classes) {
|
||||||
|
|
||||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||||
classifier 'javadoc'
|
classifier 'javadoc'
|
||||||
|
from javadoc.destinationDir
|
||||||
}
|
}
|
||||||
|
|
||||||
artifacts {
|
artifacts {
|
||||||
|
@ -37,7 +38,7 @@ artifacts {
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
options.compilerArgs << '-Xlint:all,-exports'
|
options.compilerArgs << '-Xlint:all'
|
||||||
}
|
}
|
||||||
|
|
||||||
javadoc {
|
javadoc {
|
||||||
|
|
|
@ -210,6 +210,10 @@ public final class Client implements AutoCloseable {
|
||||||
return byteBufAllocator;
|
return byteBufAllocator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isPooled() {
|
||||||
|
return pool != null;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasPooledConnections() {
|
public boolean hasPooledConnections() {
|
||||||
return pool != null && !clientConfig.getPoolNodes().isEmpty();
|
return pool != null && !clientConfig.getPoolNodes().isEmpty();
|
||||||
}
|
}
|
||||||
|
@ -266,7 +270,6 @@ public final class Client implements AutoCloseable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Channel newChannel(HttpAddress httpAddress) throws IOException {
|
public Channel newChannel(HttpAddress httpAddress) throws IOException {
|
||||||
Channel channel;
|
|
||||||
if (httpAddress != null) {
|
if (httpAddress != null) {
|
||||||
HttpVersion httpVersion = httpAddress.getVersion();
|
HttpVersion httpVersion = httpAddress.getVersion();
|
||||||
SslContext sslContext = newSslContext(clientConfig, httpAddress.getVersion());
|
SslContext sslContext = newSslContext(clientConfig, httpAddress.getVersion());
|
||||||
|
@ -276,7 +279,7 @@ public final class Client implements AutoCloseable {
|
||||||
HttpChannelInitializer initializer =
|
HttpChannelInitializer initializer =
|
||||||
findChannelInitializer(httpVersion.majorVersion(), httpAddress, sslHandlerFactory, initializerTwo);
|
findChannelInitializer(httpVersion.majorVersion(), httpAddress, sslHandlerFactory, initializerTwo);
|
||||||
try {
|
try {
|
||||||
channel = bootstrap.handler(initializer)
|
return bootstrap.handler(initializer)
|
||||||
.connect(httpAddress.getInetSocketAddress()).sync().await().channel();
|
.connect(httpAddress.getInetSocketAddress()).sync().await().channel();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new IOException(e);
|
throw new IOException(e);
|
||||||
|
@ -284,7 +287,12 @@ public final class Client implements AutoCloseable {
|
||||||
} else {
|
} else {
|
||||||
if (hasPooledConnections()) {
|
if (hasPooledConnections()) {
|
||||||
try {
|
try {
|
||||||
channel = pool.acquire();
|
if (pool != null) {
|
||||||
|
return pool.acquire();
|
||||||
|
} else {
|
||||||
|
logger.log(Level.SEVERE, "no pool prsent");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new IOException(e);
|
throw new IOException(e);
|
||||||
}
|
}
|
||||||
|
@ -292,7 +300,6 @@ public final class Client implements AutoCloseable {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return channel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void releaseChannel(Channel channel, boolean close) throws IOException{
|
public void releaseChannel(Channel channel, boolean close) throws IOException{
|
||||||
|
@ -301,7 +308,9 @@ public final class Client implements AutoCloseable {
|
||||||
}
|
}
|
||||||
if (hasPooledConnections()) {
|
if (hasPooledConnections()) {
|
||||||
try {
|
try {
|
||||||
|
if (pool != null) {
|
||||||
pool.release(channel, close);
|
pool.release(channel, close);
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new IOException(e);
|
throw new IOException(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,10 +173,12 @@ public class BoundedChannelPool<K extends PoolKey> implements Pool<Channel> {
|
||||||
if (channel != null) {
|
if (channel != null) {
|
||||||
if (channel.isActive()) {
|
if (channel.isActive()) {
|
||||||
K key = channel.attr(attributeKey).get();
|
K key = channel.attr(attributeKey).get();
|
||||||
|
if (key != null) {
|
||||||
Queue<Channel> channelQueue = availableChannels.get(key);
|
Queue<Channel> channelQueue = availableChannels.get(key);
|
||||||
if (channelQueue != null) {
|
if (channelQueue != null) {
|
||||||
channelQueue.add(channel);
|
channelQueue.add(channel);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (channel.isOpen() && close) {
|
} else if (channel.isOpen() && close) {
|
||||||
logger.log(Level.FINE, "closing channel " + channel);
|
logger.log(Level.FINE, "closing channel " + channel);
|
||||||
channel.close();
|
channel.close();
|
||||||
|
|
Loading…
Reference in a new issue