update to netty 4.1.63

This commit is contained in:
Jörg Prante 2021-04-15 17:14:22 +02:00
parent ffb4491f5e
commit de0c798c45
4 changed files with 24 additions and 12 deletions

View file

@ -1,10 +1,10 @@
group = org.xbib
name = netty-http
version = 4.1.60.0
version = 4.1.63.0
gradle.wrapper.version = 6.6.1
netty.version = 4.1.60.Final
tcnative.version = 2.0.36.Final
netty.version = 4.1.63.Final
tcnative.version = 2.0.38.Final
bouncycastle.version = 1.68
reactivestreams.version = 1.0.2
reactivex.version = 1.3.8

View file

@ -30,6 +30,7 @@ task sourcesJar(type: Jar, dependsOn: classes) {
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier 'javadoc'
from javadoc.destinationDir
}
artifacts {
@ -37,7 +38,7 @@ artifacts {
}
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:all,-exports'
options.compilerArgs << '-Xlint:all'
}
javadoc {

View file

@ -210,6 +210,10 @@ public final class Client implements AutoCloseable {
return byteBufAllocator;
}
public boolean isPooled() {
return pool != null;
}
public boolean hasPooledConnections() {
return pool != null && !clientConfig.getPoolNodes().isEmpty();
}
@ -266,7 +270,6 @@ public final class Client implements AutoCloseable {
}
public Channel newChannel(HttpAddress httpAddress) throws IOException {
Channel channel;
if (httpAddress != null) {
HttpVersion httpVersion = httpAddress.getVersion();
SslContext sslContext = newSslContext(clientConfig, httpAddress.getVersion());
@ -276,7 +279,7 @@ public final class Client implements AutoCloseable {
HttpChannelInitializer initializer =
findChannelInitializer(httpVersion.majorVersion(), httpAddress, sslHandlerFactory, initializerTwo);
try {
channel = bootstrap.handler(initializer)
return bootstrap.handler(initializer)
.connect(httpAddress.getInetSocketAddress()).sync().await().channel();
} catch (InterruptedException e) {
throw new IOException(e);
@ -284,7 +287,12 @@ public final class Client implements AutoCloseable {
} else {
if (hasPooledConnections()) {
try {
channel = pool.acquire();
if (pool != null) {
return pool.acquire();
} else {
logger.log(Level.SEVERE, "no pool prsent");
return null;
}
} catch (Exception e) {
throw new IOException(e);
}
@ -292,7 +300,6 @@ public final class Client implements AutoCloseable {
throw new UnsupportedOperationException();
}
}
return channel;
}
public void releaseChannel(Channel channel, boolean close) throws IOException{
@ -301,7 +308,9 @@ public final class Client implements AutoCloseable {
}
if (hasPooledConnections()) {
try {
pool.release(channel, close);
if (pool != null) {
pool.release(channel, close);
}
} catch (Exception e) {
throw new IOException(e);
}

View file

@ -173,9 +173,11 @@ public class BoundedChannelPool<K extends PoolKey> implements Pool<Channel> {
if (channel != null) {
if (channel.isActive()) {
K key = channel.attr(attributeKey).get();
Queue<Channel> channelQueue = availableChannels.get(key);
if (channelQueue != null) {
channelQueue.add(channel);
if (key != null) {
Queue<Channel> channelQueue = availableChannels.get(key);
if (channelQueue != null) {
channelQueue.add(channel);
}
}
} else if (channel.isOpen() && close) {
logger.log(Level.FINE, "closing channel " + channel);