From 2ee9dcfeb246e6bb52a75d4456a615b43ee0c587 Mon Sep 17 00:00:00 2001 From: redkale Date: Mon, 10 Jun 2024 13:21:43 +0800 Subject: [PATCH] =?UTF-8?q?AsyncConnection=E7=A7=BB=E9=99=A4=E8=B6=85?= =?UTF-8?q?=E6=97=B6=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/redkale/net/AsyncConnection.java | 12 +- src/main/java/org/redkale/net/AsyncGroup.java | 32 ++--- .../java/org/redkale/net/AsyncIOGroup.java | 14 +-- .../net/AsyncNioCompletionHandler.java | 3 + .../org/redkale/net/AsyncNioConnection.java | 115 ++++-------------- src/main/java/org/redkale/net/Transport.java | 32 ++--- .../java/org/redkale/net/client/Client.java | 27 +--- .../org/redkale/net/client/ClientCodec.java | 2 +- .../redkale/net/client/ClientConnection.java | 49 ++++---- .../redkale/net/client/ClientResponse.java | 4 +- .../java/org/redkale/net/http/WebClient.java | 9 +- 11 files changed, 90 insertions(+), 209 deletions(-) diff --git a/src/main/java/org/redkale/net/AsyncConnection.java b/src/main/java/org/redkale/net/AsyncConnection.java index fb835fb6a..a2b94ceb6 100644 --- a/src/main/java/org/redkale/net/AsyncConnection.java +++ b/src/main/java/org/redkale/net/AsyncConnection.java @@ -217,14 +217,6 @@ public abstract class AsyncConnection implements Channel, AutoCloseable { public abstract SocketAddress getLocalAddress(); - public abstract int getReadTimeoutSeconds(); - - public abstract int getWriteTimeoutSeconds(); - - public abstract void setReadTimeoutSeconds(int readTimeoutSeconds); - - public abstract void setWriteTimeoutSeconds(int writeTimeoutSeconds); - // public abstract AsyncConnection fastHandler(CompletionHandler handler); // // public abstract void fastWrite(byte[] data); @@ -430,8 +422,8 @@ public abstract class AsyncConnection implements Channel, AutoCloseable { }; write(buffer, handlerAttachment, newHandler); } else { - ByteBufferWriter writer = ByteBufferWriter.create( - sslEngine == null ? writeBufferSupplier : () -> pollWriteSSLBuffer(), buffer); + ByteBufferWriter writer = + ByteBufferWriter.create(sslEngine == null ? writeBufferSupplier : this::pollWriteSSLBuffer, buffer); writer.put(headerContent, headerOffset, headerLength); if (bodyLength > 0) { writer.put(bodyContent, bodyOffset, bodyLength); diff --git a/src/main/java/org/redkale/net/AsyncGroup.java b/src/main/java/org/redkale/net/AsyncGroup.java index 970b131fa..7c5fc0803 100644 --- a/src/main/java/org/redkale/net/AsyncGroup.java +++ b/src/main/java/org/redkale/net/AsyncGroup.java @@ -35,60 +35,44 @@ public abstract class AsyncGroup { } public CompletableFuture createTCPClient(final SocketAddress address) { - return createTCPClient(address, 0, 0, 0); + return createTCPClient(address, 0); } /** * 创建TCP连接 * - * @see org.redkale.net.AsyncIOGroup#createTCPClient(java.net.SocketAddress, int, int, int) + * @see org.redkale.net.AsyncIOGroup#createTCPClient(java.net.SocketAddress, int) * * @param address 地址 * @param connectTimeoutSeconds 连接超时 - * @param readTimeoutSeconds 读超时 - * @param writeTimeoutSeconds 写超时 * @return AsyncConnection */ public abstract CompletableFuture createTCPClient( - final SocketAddress address, - final int connectTimeoutSeconds, - final int readTimeoutSeconds, - final int writeTimeoutSeconds); + SocketAddress address, int connectTimeoutSeconds); public CompletableFuture createUDPClient(final SocketAddress address) { - return createUDPClient(address, 0, 0, 0); + return createUDPClient(address, 0); } /** * 创建UDP连接 * - * @see org.redkale.net.AsyncIOGroup#createUDPClient(java.net.SocketAddress, int, int, int) + * @see org.redkale.net.AsyncIOGroup#createUDPClient(java.net.SocketAddress, int) * * @param address 地址 * @param connectTimeoutSeconds 连接超时 - * @param readTimeoutSeconds 读超时 - * @param writeTimeoutSeconds 写超时 * @return AsyncConnection */ public abstract CompletableFuture createUDPClient( - final SocketAddress address, - final int connectTimeoutSeconds, - final int readTimeoutSeconds, - final int writeTimeoutSeconds); + SocketAddress address, int connectTimeoutSeconds); public CompletableFuture createClient(final boolean tcp, final SocketAddress address) { return tcp ? createTCPClient(address) : createUDPClient(address); } public CompletableFuture createClient( - final boolean tcp, - final SocketAddress address, - final int connectTimeoutSeconds, - final int readTimeoutSeconds, - final int writeTimeoutSeconds) { - return tcp - ? createTCPClient(address, connectTimeoutSeconds, readTimeoutSeconds, writeTimeoutSeconds) - : createUDPClient(address, connectTimeoutSeconds, readTimeoutSeconds, writeTimeoutSeconds); + boolean tcp, SocketAddress address, int connectTimeoutSeconds) { + return tcp ? createTCPClient(address, connectTimeoutSeconds) : createUDPClient(address, connectTimeoutSeconds); } /** diff --git a/src/main/java/org/redkale/net/AsyncIOGroup.java b/src/main/java/org/redkale/net/AsyncIOGroup.java index c6bc994cd..27275cf28 100644 --- a/src/main/java/org/redkale/net/AsyncIOGroup.java +++ b/src/main/java/org/redkale/net/AsyncIOGroup.java @@ -246,11 +246,7 @@ public class AsyncIOGroup extends AsyncGroup { } @Override - public CompletableFuture createTCPClient( - final SocketAddress address, - final int connectTimeoutSeconds, - final int readTimeoutSeconds, - final int writeTimeoutSeconds) { + public CompletableFuture createTCPClient(SocketAddress address, int connectTimeoutSeconds) { Objects.requireNonNull(address); AsyncNioTcpConnection conn; try { @@ -262,8 +258,6 @@ public class AsyncIOGroup extends AsyncGroup { conn.connect(address, null, new CompletionHandler() { @Override public void completed(Void result, Void attachment) { - conn.setReadTimeoutSeconds(readTimeoutSeconds); - conn.setWriteTimeoutSeconds(writeTimeoutSeconds); connCreateCounter.increment(); connLivingCounter.increment(); if (conn.sslEngine == null) { @@ -328,11 +322,7 @@ public class AsyncIOGroup extends AsyncGroup { } @Override - public CompletableFuture createUDPClient( - final SocketAddress address, - final int connectTimeoutSeconds, - final int readTimeoutSeconds, - final int writeTimeoutSeconds) { + public CompletableFuture createUDPClient(SocketAddress address, int connectTimeoutSeconds) { AsyncNioUdpConnection conn; try { conn = newUDPClientConnection(address); diff --git a/src/main/java/org/redkale/net/AsyncNioCompletionHandler.java b/src/main/java/org/redkale/net/AsyncNioCompletionHandler.java index ee6a637a1..0f92f4760 100644 --- a/src/main/java/org/redkale/net/AsyncNioCompletionHandler.java +++ b/src/main/java/org/redkale/net/AsyncNioCompletionHandler.java @@ -12,9 +12,12 @@ import java.util.concurrent.*; /** * 详情见: https://redkale.org * + * @deprecated + * * @author zhangjx * @since 2.1.0 */ +@Deprecated(since = "2.8.0") class AsyncNioCompletionHandler implements CompletionHandler, Runnable { private final AsyncNioConnection conn; diff --git a/src/main/java/org/redkale/net/AsyncNioConnection.java b/src/main/java/org/redkale/net/AsyncNioConnection.java index c3e63367d..f1d68d48e 100644 --- a/src/main/java/org/redkale/net/AsyncNioConnection.java +++ b/src/main/java/org/redkale/net/AsyncNioConnection.java @@ -36,12 +36,6 @@ abstract class AsyncNioConnection extends AsyncConnection { protected SelectionKey connectKey; // -------------------------------- 读操作 -------------------------------------- - protected final AsyncNioCompletionHandler readTimeoutCompletionHandler = - new AsyncNioCompletionHandler<>(true, this); - - // 值大于0才有效 - protected int readTimeoutSeconds; - protected ByteBuffer readByteBuffer; protected CompletionHandler readCompletionHandler; @@ -49,12 +43,6 @@ abstract class AsyncNioConnection extends AsyncConnection { protected SelectionKey readKey; // -------------------------------- 写操作 -------------------------------------- - protected final AsyncNioCompletionHandler writeTimeoutCompletionHandler = - new AsyncNioCompletionHandler<>(false, this); - - // 值大于0才有效 - protected int writeTimeoutSeconds; - protected byte[] writeByteTuple1Array; protected int writeByteTuple1Offset; @@ -101,26 +89,6 @@ abstract class AsyncNioConnection extends AsyncConnection { return remoteAddress; } - @Override - public void setReadTimeoutSeconds(int readTimeoutSeconds) { - this.readTimeoutSeconds = readTimeoutSeconds; - } - - @Override - public void setWriteTimeoutSeconds(int writeTimeoutSeconds) { - this.writeTimeoutSeconds = writeTimeoutSeconds; - } - - @Override - public int getReadTimeoutSeconds() { - return this.readTimeoutSeconds; - } - - @Override - public int getWriteTimeoutSeconds() { - return this.writeTimeoutSeconds; - } - // @Override // public AsyncConnection fastHandler(CompletionHandler handler) { // Objects.requireNonNull(handler); @@ -144,22 +112,13 @@ abstract class AsyncNioConnection extends AsyncConnection { handler.failed(new NotYetConnectedException(), null); return; } - if (handler != readCompletionHandler && handler != readTimeoutCompletionHandler.handler) { + if (handler != readCompletionHandler) { // 如果是Codec无需重复赋值 if (this.readPending) { handler.failed(new ReadPendingException(), null); return; } this.readPending = true; - if (this.readTimeoutSeconds > 0) { - AsyncNioCompletionHandler newHandler = this.readTimeoutCompletionHandler; - newHandler.handler( - handler, this.readByteBuffer); // new AsyncNioCompletionHandler(handler, this.readByteBuffer); - this.readCompletionHandler = newHandler; - newHandler.timeoutFuture = - ioGroup.scheduleTimeout(newHandler, this.readTimeoutSeconds, TimeUnit.SECONDS); - } else { - this.readCompletionHandler = handler; - } + this.readCompletionHandler = handler; } else { this.readPending = true; } @@ -200,15 +159,7 @@ abstract class AsyncNioConnection extends AsyncConnection { return; } this.readPending = true; - if (this.readTimeoutSeconds > 0) { - AsyncNioCompletionHandler newHandler = this.readTimeoutCompletionHandler; - newHandler.handler( - handler, this.readByteBuffer); // new AsyncNioCompletionHandler(handler, this.readByteBuffer); - this.readCompletionHandler = newHandler; - newHandler.timeoutFuture = ioGroup.scheduleTimeout(newHandler, this.readTimeoutSeconds, TimeUnit.SECONDS); - } else { - this.readCompletionHandler = handler; - } + this.readCompletionHandler = handler; doRead(this.ioReadThread.inCurrThread()); } @@ -244,16 +195,28 @@ abstract class AsyncNioConnection extends AsyncConnection { this.writeByteTuple2Offset = bodyOffset; this.writeByteTuple2Length = bodyLength; this.writeAttachment = null; - if (this.writeTimeoutSeconds > 0) { - AsyncNioCompletionHandler newHandler = this.writeTimeoutCompletionHandler; - newHandler.handler(handler, null); // new AsyncNioCompletionHandler(handler, null); - this.writeCompletionHandler = newHandler; - newHandler.timeoutFuture = ioGroup.scheduleTimeout(newHandler, this.writeTimeoutSeconds, TimeUnit.SECONDS); - } else { - AsyncNioCompletionHandler newHandler = this.writeTimeoutCompletionHandler; - newHandler.handler(handler, null); // new AsyncNioCompletionHandler(handler, null); - this.writeCompletionHandler = newHandler; - } + CompletionHandler newHandler = new CompletionHandler() { + @Override + public void completed(Integer result, Void attachment) { + if (writeByteBuffers != null) { + offerWriteBuffers(writeByteBuffers); + } else { + offerWriteBuffer(writeByteBuffer); + } + handler.completed(result, attachment); + } + + @Override + public void failed(Throwable exc, Void attachment) { + if (writeByteBuffers != null) { + offerWriteBuffers(writeByteBuffers); + } else { + offerWriteBuffer(writeByteBuffer); + } + handler.failed(exc, attachment); + } + }; + this.writeCompletionHandler = (CompletionHandler) newHandler; doWrite(); // 如果不是true,则bodyCallback的执行可能会切换线程 } @@ -272,14 +235,7 @@ abstract class AsyncNioConnection extends AsyncConnection { this.writePending = true; this.writeByteBuffer = src; this.writeAttachment = attachment; - if (this.writeTimeoutSeconds > 0) { - AsyncNioCompletionHandler newHandler = this.writeTimeoutCompletionHandler; - newHandler.handler(handler, attachment); // new AsyncNioCompletionHandler(handler, attachment); - this.writeCompletionHandler = newHandler; - newHandler.timeoutFuture = ioGroup.scheduleTimeout(newHandler, this.writeTimeoutSeconds, TimeUnit.SECONDS); - } else { - this.writeCompletionHandler = (CompletionHandler) handler; - } + this.writeCompletionHandler = (CompletionHandler) handler; doWrite(); } @@ -301,14 +257,7 @@ abstract class AsyncNioConnection extends AsyncConnection { this.writeBuffersOffset = offset; this.writeBuffersLength = length; this.writeAttachment = attachment; - if (this.writeTimeoutSeconds > 0) { - AsyncNioCompletionHandler newHandler = this.writeTimeoutCompletionHandler; - newHandler.handler(handler, attachment); // new AsyncNioCompletionHandler(handler, attachment); - this.writeCompletionHandler = newHandler; - newHandler.timeoutFuture = ioGroup.scheduleTimeout(newHandler, this.writeTimeoutSeconds, TimeUnit.SECONDS); - } else { - this.writeCompletionHandler = (CompletionHandler) handler; - } + this.writeCompletionHandler = (CompletionHandler) handler; doWrite(); } @@ -357,9 +306,6 @@ abstract class AsyncNioConnection extends AsyncConnection { if (direct) { if (this.readByteBuffer == null) { this.readByteBuffer = sslEngine == null ? pollReadBuffer() : pollReadSSLBuffer(); - if (this.readTimeoutSeconds > 0) { - this.readTimeoutCompletionHandler.attachment(this.readByteBuffer); - } } readCount = implRead(readByteBuffer); } @@ -465,13 +411,6 @@ abstract class AsyncNioConnection extends AsyncConnection { this.writeByteTuple2Offset = 0; this.writeByteTuple2Length = 0; } - if (this.writeCompletionHandler == this.writeTimeoutCompletionHandler) { - if (writeByteBuffer == null) { - this.writeTimeoutCompletionHandler.buffers(writeByteBuffers); - } else { - this.writeTimeoutCompletionHandler.buffer(writeByteBuffer); - } - } } int writeCount; if (writeByteBuffer != null) { diff --git a/src/main/java/org/redkale/net/Transport.java b/src/main/java/org/redkale/net/Transport.java index 0c91dbbc0..ce4b95a29 100644 --- a/src/main/java/org/redkale/net/Transport.java +++ b/src/main/java/org/redkale/net/Transport.java @@ -289,18 +289,14 @@ public final class Transport { try { if (!tcp) { // UDP SocketAddress udpaddr = rand ? nodes[0].address : addr; - return asyncGroup.createUDPClient(udpaddr, 6, factory.readTimeoutSeconds, factory.writeTimeoutSeconds); + return asyncGroup.createUDPClient(udpaddr, 6); } if (!rand) { // 指定地址 TransportNode node = findTransportNode(addr); if (node == null) { - return asyncGroup.createTCPClient(addr, 6, factory.readTimeoutSeconds, factory.writeTimeoutSeconds); + return asyncGroup.createTCPClient(addr, 6); } - return pollAsync( - node, - addr, - () -> asyncGroup.createTCPClient( - addr, 6, factory.readTimeoutSeconds, factory.writeTimeoutSeconds)); + return pollAsync(node, addr, () -> asyncGroup.createTCPClient(addr, 6)); } // ---------------------随机取地址------------------------ @@ -327,11 +323,9 @@ public final class Transport { } } return pollAsync(one, one.getAddress(), () -> { - return asyncGroup - .createTCPClient(one.address, 6, factory.readTimeoutSeconds, factory.writeTimeoutSeconds) - .whenComplete((c, t) -> { - one.disabletime = t == null ? 0 : System.currentTimeMillis(); - }); + return asyncGroup.createTCPClient(one.address, 6).whenComplete((c, t) -> { + one.disabletime = t == null ? 0 : System.currentTimeMillis(); + }); }); } return pollConnection0(nodes, null, now); @@ -351,14 +345,12 @@ public final class Transport { if (future.isDone()) { return future; } - asyncGroup - .createTCPClient(node.address, 6, factory.readTimeoutSeconds, factory.writeTimeoutSeconds) - .whenComplete((c, t) -> { - if (c != null && !future.complete(c)) { - node.connQueue.offer(c); - } - node.disabletime = t == null ? 0 : System.currentTimeMillis(); - }); + asyncGroup.createTCPClient(node.address, 6).whenComplete((c, t) -> { + if (c != null && !future.complete(c)) { + node.connQueue.offer(c); + } + node.disabletime = t == null ? 0 : System.currentTimeMillis(); + }); } return future; } diff --git a/src/main/java/org/redkale/net/client/Client.java b/src/main/java/org/redkale/net/client/Client.java index b32e11edf..1a6d8ae31 100644 --- a/src/main/java/org/redkale/net/client/Client.java +++ b/src/main/java/org/redkale/net/client/Client.java @@ -333,15 +333,6 @@ public abstract class Client, R extends ClientR return connect(addr, WorkThread.currentWorkThread(), false); } - public final CompletableFuture newConnection(int readTimeout, int writeTimeout) { - return connect(getAddress(null), WorkThread.currentWorkThread(), false, readTimeout, writeTimeout); - } - - // 指定地址获取连接 - public final CompletableFuture newConnection(SocketAddress addr, int readTimeout, int writeTimeout) { - return connect(addr, WorkThread.currentWorkThread(), false, readTimeout, writeTimeout); - } - public final CompletableFuture connect() { return connect(getAddress(null), WorkThread.currentWorkThread(), true); } @@ -361,18 +352,7 @@ public abstract class Client, R extends ClientR } // 指定地址获取连接 - private CompletableFuture connect( - @Nonnull final SocketAddress addr, @Nullable final WorkThread workThread, final boolean pool) { - return connect(addr, workThread, pool, readTimeoutSeconds, writeTimeoutSeconds); - } - - // 指定地址获取连接 - private CompletableFuture connect( - @Nonnull final SocketAddress addr, - @Nullable final WorkThread workThread, - final boolean pool, - final int readTimeout, - final int writeTimeout) { + private CompletableFuture connect(@Nonnull SocketAddress addr, @Nullable WorkThread workThread, boolean pool) { if (addr == null) { return CompletableFuture.failedFuture(new NullPointerException("address is empty")); } @@ -384,8 +364,7 @@ public abstract class Client, R extends ClientR } final Queue> waitQueue = entry.connAcquireWaitings; if (!pool || entry.connOpenState.compareAndSet(false, true)) { - CompletableFuture future = group.createClient( - tcp, addr, connectTimeoutSeconds, readTimeout, writeTimeout) + CompletableFuture future = group.createClient(tcp, addr, connectTimeoutSeconds) .thenApply(c -> (C) createClientConnection(c).setConnEntry(entry).setMaxPipelines(maxPipelines)); R virtualReq = createVirtualRequestAfterConnect(); @@ -433,7 +412,7 @@ public abstract class Client, R extends ClientR } }); } else { - int seconds = connectTimeoutSeconds > 0 ? connectTimeoutSeconds : 6; + int seconds = connectTimeoutSeconds > 0 ? connectTimeoutSeconds : 3; CompletableFuture rs = new CompletableFuture(); waitQueue.offer(rs); return Utility.orTimeout(rs, () -> addr + " connect timeout", seconds, TimeUnit.SECONDS); diff --git a/src/main/java/org/redkale/net/client/ClientCodec.java b/src/main/java/org/redkale/net/client/ClientCodec.java index 01b23e8ab..651e016b4 100644 --- a/src/main/java/org/redkale/net/client/ClientCodec.java +++ b/src/main/java/org/redkale/net/client/ClientCodec.java @@ -81,7 +81,7 @@ public abstract class ClientCodec CompletableFuture writeChannel(R request, Function respTransfer) { - // if (client.debug) { - // client.logger.log(Level.FINEST, Utility.nowMillis() + ": " + Thread.currentThread().getName() + ": - // " - // + this + ", 发送请求: " + request); - // } request.respTransfer = respTransfer; ClientFuture respFuture = createClientFuture(request); - int rts = this.channel.getReadTimeoutSeconds(); - if (rts > 0 && !request.isCloseType()) { - respFuture.setTimeout(client.timeoutScheduler.schedule(respFuture, rts, TimeUnit.SECONDS)); + if (client.debug) { + client.logger.log( + Level.FINEST, + Times.nowMillis() + ": " + Thread.currentThread().getName() + ": " + this + ", sendRequest: " + + request + ", respFuture: " + respFuture); } respWaitingCounter.increment(); // 放在writeChannelInWriteThread计数会延迟,导致不准确 writeLock.lock(); @@ -142,6 +140,14 @@ public abstract class ClientConnection { + client.logger.log( + Level.FINEST, + Times.nowMillis() + ": " + Thread.currentThread().getName() + ": " + this + ", respResult: " + + (t != null ? t : v)); + }); + } return respFuture; } @@ -169,22 +175,18 @@ public abstract class ClientConnection CompletableFuture> writeChannel(R[] requests, Function respTransfer) { - // if (client.debug) { - // client.logger.log(Level.FINEST, Utility.nowMillis() + ": " + Thread.currentThread().getName() + ": - // " - // + this + ", 发送请求: " + Arrays.toString(requests) + ", readTimeoutSeconds: " + - // this.channel.getReadTimeoutSeconds()); - // } + if (client.debug) { + client.logger.log( + Level.FINEST, + Times.nowMillis() + ": " + Thread.currentThread().getName() + ": " + this + ", 发送请求: " + + Arrays.toString(requests)); + } ClientFuture[] respFutures = new ClientFuture[requests.length]; - int rts = this.channel.getReadTimeoutSeconds(); + int rts = this.client.getReadTimeoutSeconds(); for (int i = 0; i < respFutures.length; i++) { R request = requests[i]; request.respTransfer = respTransfer; - ClientFuture respFuture = createClientFuture(requests[i]); - respFutures[i] = respFuture; - if (rts > 0 && !request.isCloseType()) { - respFuture.setTimeout(client.timeoutScheduler.schedule(respFuture, rts, TimeUnit.SECONDS)); - } + respFutures[i] = createClientFuture(requests[i]); } respWaitingCounter.add(respFutures.length); // 放在writeChannelInWriteThread计数会延迟,导致不准确 @@ -310,7 +312,12 @@ public abstract class ClientConnection createClientFuture(R request) { - return new ClientFuture(this, request); + ClientFuture respFuture = new ClientFuture(this, request); + int rts = this.client.getReadTimeoutSeconds(); + if (rts > 0 && !request.isCloseType()) { + respFuture.setTimeout(client.timeoutScheduler.schedule(respFuture, rts, TimeUnit.SECONDS)); + } + return respFuture; } @Override // AsyncConnection.beforeCloseListener diff --git a/src/main/java/org/redkale/net/client/ClientResponse.java b/src/main/java/org/redkale/net/client/ClientResponse.java index fd4f459c5..b4e4559d7 100644 --- a/src/main/java/org/redkale/net/client/ClientResponse.java +++ b/src/main/java/org/redkale/net/client/ClientResponse.java @@ -93,9 +93,9 @@ public class ClientResponse { @Override public String toString() { if (cause != null) { - return "{\"exc\":" + cause + "}"; + return "{\"request\":" + request + ",\"exc\":" + cause + "}"; } - return "{\"message\":" + message + "}"; + return "{\"request\":" + request + ",\"message\":" + message + "}"; } boolean isError() { diff --git a/src/main/java/org/redkale/net/http/WebClient.java b/src/main/java/org/redkale/net/http/WebClient.java index d5f7893a8..431cbb3a0 100644 --- a/src/main/java/org/redkale/net/http/WebClient.java +++ b/src/main/java/org/redkale/net/http/WebClient.java @@ -5,8 +5,6 @@ */ package org.redkale.net.http; -import static org.redkale.net.http.HttpRequest.parseHeaderName; - import java.lang.reflect.Type; import java.net.*; import java.nio.*; @@ -19,6 +17,7 @@ import org.redkale.net.*; import org.redkale.net.client.Client; import org.redkale.net.client.ClientAddress; import org.redkale.net.client.ClientConnection; +import static org.redkale.net.http.HttpRequest.parseHeaderName; import org.redkale.util.*; /** @@ -315,11 +314,7 @@ public class WebClient extends Client { protected CompletableFuture createConnection(String host, int port) { return asyncGroup - .createTCPClient( - new InetSocketAddress(host, port), - connectTimeoutSeconds, - readTimeoutSeconds, - writeTimeoutSeconds) + .createTCPClient(new InetSocketAddress(host, port), connectTimeoutSeconds) .thenApply(conn -> new HttpConnection(conn)); }