This commit is contained in:
redkale
2024-10-24 16:00:12 +08:00
parent 29ea1eb76b
commit ec17eea1e0
8 changed files with 81 additions and 100 deletions

View File

@@ -470,11 +470,8 @@ public abstract class NodeServer {
} }
protected boolean acceptsComponent(Class<? extends Service> serviceImplClass) { protected boolean acceptsComponent(Class<? extends Service> serviceImplClass) {
if (Modifier.isAbstract(serviceImplClass.getModifiers()) return !(Modifier.isAbstract(serviceImplClass.getModifiers())
|| Modifier.isInterface(serviceImplClass.getModifiers())) { || Modifier.isInterface(serviceImplClass.getModifiers()));
return false;
}
return true;
} }
protected boolean interceptComponent(Service service) { protected boolean interceptComponent(Service service) {

View File

@@ -202,10 +202,7 @@ public abstract class ClusterAgent {
} }
} }
ClusterEntry entry = new ClusterEntry(ns, protocol, service); ClusterEntry entry = new ClusterEntry(ns, protocol, service);
if (entry.serviceName.endsWith(".")) { return !entry.serviceName.endsWith(".");
return false;
}
return true;
} }
protected void afterDeregister(NodeServer ns, String protocol) { protected void afterDeregister(NodeServer ns, String protocol) {

View File

@@ -763,7 +763,7 @@ public abstract class ConvertFactory<R extends Reader, W extends Writer> {
Type[] ts = ((ParameterizedType) type).getActualTypeArguments(); Type[] ts = ((ParameterizedType) type).getActualTypeArguments();
if (ts.length == 1) { if (ts.length == 1) {
Type t = ts[0]; Type t = ts[0];
if (t == Boolean.class return t == Boolean.class
|| t == Byte.class || t == Byte.class
|| t == Short.class || t == Short.class
|| t == Character.class || t == Character.class
@@ -773,10 +773,7 @@ public abstract class ConvertFactory<R extends Reader, W extends Writer> {
|| t == Double.class || t == Double.class
|| t == String.class || t == String.class
|| rootFactory().findEncoder(t) != null || rootFactory().findEncoder(t) != null
|| ((t instanceof Class) && ((Class) t).isEnum())) { || ((t instanceof Class) && ((Class) t).isEnum());
return true;
}
return false;
} }
} }
return false; return false;

View File

@@ -24,8 +24,6 @@ import org.redkale.util.*;
*/ */
public abstract class ProtobufDynEncoder<T> extends ProtobufObjectEncoder<T> { public abstract class ProtobufDynEncoder<T> extends ProtobufObjectEncoder<T> {
protected final Class typeClass;
protected final ObjectEncoder<ProtobufWriter, T> objectEncoderSelf; protected final ObjectEncoder<ProtobufWriter, T> objectEncoderSelf;
// 动态字段: protected SimpledCoder xxxSimpledCoder; // 动态字段: protected SimpledCoder xxxSimpledCoder;
@@ -34,7 +32,6 @@ public abstract class ProtobufDynEncoder<T> extends ProtobufObjectEncoder<T> {
protected ProtobufDynEncoder(ProtobufFactory factory, Type type, ProtobufObjectEncoder objectEncoderSelf) { protected ProtobufDynEncoder(ProtobufFactory factory, Type type, ProtobufObjectEncoder objectEncoderSelf) {
super((Class) type); super((Class) type);
this.typeClass = (Class) type;
this.factory = factory; this.factory = factory;
this.objectEncoderSelf = objectEncoderSelf; this.objectEncoderSelf = objectEncoderSelf;
this.members = objectEncoderSelf.getMembers(); this.members = objectEncoderSelf.getMembers();

View File

@@ -1305,6 +1305,8 @@ public abstract class AsyncConnection implements Channel, AutoCloseable {
}); });
return; return;
} }
default:
return;
} }
} }
} }

View File

@@ -404,7 +404,7 @@ public abstract class Server<
final ProtocolServer oldServerChannel = this.serverChannel; final ProtocolServer oldServerChannel = this.serverChannel;
ProtocolServer newServerChannel = null; ProtocolServer newServerChannel = null;
InetSocketAddress addr0 = addr; InetSocketAddress addr0 = addr;
try {
newServerChannel = ProtocolServer.create(this.netprotocol, context, this.serverClassLoader); newServerChannel = ProtocolServer.create(this.netprotocol, context, this.serverClassLoader);
this.resourceFactory.inject(newServerChannel); this.resourceFactory.inject(newServerChannel);
newServerChannel.open(config); newServerChannel.open(config);
@@ -414,9 +414,7 @@ public abstract class Server<
addr0 = (InetSocketAddress) localAddress; addr0 = (InetSocketAddress) localAddress;
} }
newServerChannel.accept(application, this); newServerChannel.accept(application, this);
} catch (IOException e) {
throw e;
}
context.updateServerAddress(addr0); context.updateServerAddress(addr0);
this.address = context.serverAddress; this.address = context.serverAddress;
this.serverChannel = newServerChannel; this.serverChannel = newServerChannel;

View File

@@ -815,8 +815,6 @@ public class DataJdbcSource extends AbstractDataSqlSource {
int c = Utility.sum(stmt2.executeBatch()); int c = Utility.sum(stmt2.executeBatch());
slowLog(s, sqls); slowLog(s, sqls);
return c; return c;
} catch (SQLException se) {
throw se;
} finally { } finally {
conn.offerUpdateStatement(stmt2); conn.offerUpdateStatement(stmt2);
} }
@@ -2199,7 +2197,7 @@ public class DataJdbcSource extends AbstractDataSqlSource {
conn.setAutoCommit(true); conn.setAutoCommit(true);
prestmt = conn.prepareQueryStatement(sql); prestmt = conn.prepareQueryStatement(sql);
final ResultSet set = prestmt.executeQuery(); final ResultSet set = prestmt.executeQuery();
boolean rs = set.next() ? (set.getInt(1) > 0) : false; boolean rs = set.next() && (set.getInt(1) > 0);
set.close(); set.close();
conn.offerQueryStatement(prestmt); conn.offerQueryStatement(prestmt);
if (info.isLoggable(logger, Level.FINEST, sql)) { if (info.isLoggable(logger, Level.FINEST, sql)) {

View File

@@ -5118,29 +5118,27 @@ public final class Utility {
// return socket; // return socket;
// } // }
// //
public static String postHttpContent(String url) throws IOException { public static String postHttpContent(String url) {
return remoteHttpContent("POST", url, 0, null, null).toString(StandardCharsets.UTF_8); return remoteHttpContent("POST", url, 0, null, null).toString(StandardCharsets.UTF_8);
} }
public static String postHttpContent(String url, int timeoutMs) throws IOException { public static String postHttpContent(String url, int timeoutMs) {
return remoteHttpContent("POST", url, timeoutMs, null, null).toString(StandardCharsets.UTF_8); return remoteHttpContent("POST", url, timeoutMs, null, null).toString(StandardCharsets.UTF_8);
} }
public static String postHttpContent(String url, String body) throws IOException { public static String postHttpContent(String url, String body) {
return remoteHttpContent("POST", url, 0, null, body).toString(StandardCharsets.UTF_8); return remoteHttpContent("POST", url, 0, null, body).toString(StandardCharsets.UTF_8);
} }
public static String postHttpContent(String url, int timeoutMs, String body) throws IOException { public static String postHttpContent(String url, int timeoutMs, String body) {
return remoteHttpContent("POST", url, timeoutMs, null, body).toString(StandardCharsets.UTF_8); return remoteHttpContent("POST", url, timeoutMs, null, body).toString(StandardCharsets.UTF_8);
} }
public static String postHttpContent(String url, Map<String, Serializable> headers, String body) public static String postHttpContent(String url, Map<String, Serializable> headers, String body) {
throws IOException {
return remoteHttpContent("POST", url, 0, headers, body).toString(StandardCharsets.UTF_8); return remoteHttpContent("POST", url, 0, headers, body).toString(StandardCharsets.UTF_8);
} }
public static String postHttpContent(String url, int timeoutMs, Map<String, Serializable> headers, String body) public static String postHttpContent(String url, int timeoutMs, Map<String, Serializable> headers, String body) {
throws IOException {
return remoteHttpContent("POST", url, timeoutMs, headers, body).toString(StandardCharsets.UTF_8); return remoteHttpContent("POST", url, timeoutMs, headers, body).toString(StandardCharsets.UTF_8);
} }
@@ -5171,38 +5169,36 @@ public final class Utility {
return remoteHttpContent("POST", url, timeoutMs, headers, body).toString(charset.name()); return remoteHttpContent("POST", url, timeoutMs, headers, body).toString(charset.name());
} }
public static byte[] postHttpBytesContent(String url) throws IOException { public static byte[] postHttpBytesContent(String url) {
return remoteHttpContent("POST", url, 0, null, null).toByteArray(); return remoteHttpContent("POST", url, 0, null, null).toByteArray();
} }
public static byte[] postHttpBytesContent(String url, int timeoutMs) throws IOException { public static byte[] postHttpBytesContent(String url, int timeoutMs) {
return remoteHttpContent("POST", url, timeoutMs, null, null).toByteArray(); return remoteHttpContent("POST", url, timeoutMs, null, null).toByteArray();
} }
public static byte[] postHttpBytesContent(String url, Map<String, Serializable> headers, String body) public static byte[] postHttpBytesContent(String url, Map<String, Serializable> headers, String body) {
throws IOException {
return remoteHttpContent("POST", url, 0, headers, body).toByteArray(); return remoteHttpContent("POST", url, 0, headers, body).toByteArray();
} }
public static byte[] postHttpBytesContent(String url, int timeoutMs, Map<String, Serializable> headers, String body) public static byte[] postHttpBytesContent(
throws IOException { String url, int timeoutMs, Map<String, Serializable> headers, String body) {
return remoteHttpContent("POST", url, timeoutMs, headers, body).toByteArray(); return remoteHttpContent("POST", url, timeoutMs, headers, body).toByteArray();
} }
public static String getHttpContent(String url) throws IOException { public static String getHttpContent(String url) {
return remoteHttpContent("GET", url, 0, null, null).toString(StandardCharsets.UTF_8); return remoteHttpContent("GET", url, 0, null, null).toString(StandardCharsets.UTF_8);
} }
public static String getHttpContent(String url, int timeoutMs) throws IOException { public static String getHttpContent(String url, int timeoutMs) {
return remoteHttpContent("GET", url, timeoutMs, null, null).toString(StandardCharsets.UTF_8); return remoteHttpContent("GET", url, timeoutMs, null, null).toString(StandardCharsets.UTF_8);
} }
public static String getHttpContent(String url, Map<String, Serializable> headers, String body) throws IOException { public static String getHttpContent(String url, Map<String, Serializable> headers, String body) {
return remoteHttpContent("GET", url, 0, headers, body).toString(StandardCharsets.UTF_8); return remoteHttpContent("GET", url, 0, headers, body).toString(StandardCharsets.UTF_8);
} }
public static String getHttpContent(String url, int timeoutMs, Map<String, Serializable> headers, String body) public static String getHttpContent(String url, int timeoutMs, Map<String, Serializable> headers, String body) {
throws IOException {
return remoteHttpContent("GET", url, timeoutMs, headers, body).toString(StandardCharsets.UTF_8); return remoteHttpContent("GET", url, timeoutMs, headers, body).toString(StandardCharsets.UTF_8);
} }
@@ -5225,41 +5221,38 @@ public final class Utility {
return remoteHttpContent("GET", url, timeoutMs, headers, body).toString(charset.name()); return remoteHttpContent("GET", url, timeoutMs, headers, body).toString(charset.name());
} }
public static byte[] getHttpBytesContent(String url) throws IOException { public static byte[] getHttpBytesContent(String url) {
return remoteHttpContent("GET", url, 0, null, null).toByteArray(); return remoteHttpContent("GET", url, 0, null, null).toByteArray();
} }
public static byte[] getHttpBytesContent(String url, int timeoutMs) throws IOException { public static byte[] getHttpBytesContent(String url, int timeoutMs) {
return remoteHttpContent("GET", url, timeoutMs, null, null).toByteArray(); return remoteHttpContent("GET", url, timeoutMs, null, null).toByteArray();
} }
public static byte[] getHttpBytesContent(String url, Map<String, Serializable> headers, String body) public static byte[] getHttpBytesContent(String url, Map<String, Serializable> headers, String body) {
throws IOException {
return remoteHttpContent("GET", url, 0, headers, body).toByteArray(); return remoteHttpContent("GET", url, 0, headers, body).toByteArray();
} }
public static byte[] getHttpBytesContent(String url, int timeoutMs, Map<String, Serializable> headers, String body) public static byte[] getHttpBytesContent(
throws IOException { String url, int timeoutMs, Map<String, Serializable> headers, String body) {
return remoteHttpContent("GET", url, timeoutMs, headers, body).toByteArray(); return remoteHttpContent("GET", url, timeoutMs, headers, body).toByteArray();
} }
public static String remoteHttpContent(HttpClient client, String method, String url, Charset charset) public static String remoteHttpContent(HttpClient client, String method, String url, Charset charset) {
throws IOException {
return remoteHttpContentAsync(client, method, url, 0, null, null) return remoteHttpContentAsync(client, method, url, 0, null, null)
.thenApply(out -> out.toString(charset == null ? StandardCharsets.UTF_8 : charset)) .thenApply(out -> out.toString(charset == null ? StandardCharsets.UTF_8 : charset))
.join(); .join();
} }
public static String remoteHttpContent(HttpClient client, String method, String url, int timeoutMs, Charset charset) public static String remoteHttpContent(
throws IOException { HttpClient client, String method, String url, int timeoutMs, Charset charset) {
return remoteHttpContentAsync(client, method, url, timeoutMs, null, null) return remoteHttpContentAsync(client, method, url, timeoutMs, null, null)
.thenApply(out -> out.toString(charset == null ? StandardCharsets.UTF_8 : charset)) .thenApply(out -> out.toString(charset == null ? StandardCharsets.UTF_8 : charset))
.join(); .join();
} }
public static String remoteHttpContent( public static String remoteHttpContent(
HttpClient client, String method, String url, Charset charset, Map<String, Serializable> headers) HttpClient client, String method, String url, Charset charset, Map<String, Serializable> headers) {
throws IOException {
return remoteHttpContentAsync(client, method, url, 0, headers, null) return remoteHttpContentAsync(client, method, url, 0, headers, null)
.thenApply(out -> out.toString(charset == null ? StandardCharsets.UTF_8 : charset)) .thenApply(out -> out.toString(charset == null ? StandardCharsets.UTF_8 : charset))
.join(); .join();
@@ -5271,8 +5264,7 @@ public final class Utility {
String url, String url,
Charset charset, Charset charset,
Map<String, Serializable> headers, Map<String, Serializable> headers,
String body) String body) {
throws IOException {
return remoteHttpContentAsync(client, method, url, 0, headers, body) return remoteHttpContentAsync(client, method, url, 0, headers, body)
.thenApply(out -> out.toString(charset == null ? StandardCharsets.UTF_8 : charset)) .thenApply(out -> out.toString(charset == null ? StandardCharsets.UTF_8 : charset))
.join(); .join();
@@ -5284,8 +5276,7 @@ public final class Utility {
String url, String url,
int timeoutMs, int timeoutMs,
Charset charset, Charset charset,
Map<String, Serializable> headers) Map<String, Serializable> headers) {
throws IOException {
return remoteHttpContentAsync(client, method, url, timeoutMs, headers, null) return remoteHttpContentAsync(client, method, url, timeoutMs, headers, null)
.thenApply(out -> out.toString(charset == null ? StandardCharsets.UTF_8 : charset)) .thenApply(out -> out.toString(charset == null ? StandardCharsets.UTF_8 : charset))
.join(); .join();
@@ -5298,8 +5289,7 @@ public final class Utility {
int timeoutMs, int timeoutMs,
Charset charset, Charset charset,
Map<String, Serializable> headers, Map<String, Serializable> headers,
String body) String body) {
throws IOException {
return remoteHttpContentAsync(client, method, url, timeoutMs, headers, body) return remoteHttpContentAsync(client, method, url, timeoutMs, headers, body)
.thenApply(out -> out.toString(charset == null ? StandardCharsets.UTF_8 : charset)) .thenApply(out -> out.toString(charset == null ? StandardCharsets.UTF_8 : charset))
.join(); .join();
@@ -5311,10 +5301,9 @@ public final class Utility {
String url, String url,
Charset charset, Charset charset,
Map<String, Serializable> headers, Map<String, Serializable> headers,
String body) String body) {
throws IOException {
return remoteHttpContentAsync(client, method, url, 0, headers, body) return remoteHttpContentAsync(client, method, url, 0, headers, body)
.thenApply(out -> out.toByteArray()) .thenApply(ByteArrayOutputStream::toByteArray)
.join(); .join();
} }
@@ -5324,10 +5313,9 @@ public final class Utility {
String url, String url,
int timeoutMs, int timeoutMs,
Charset charset, Charset charset,
Map<String, Serializable> headers) Map<String, Serializable> headers) {
throws IOException {
return remoteHttpContentAsync(client, method, url, timeoutMs, headers, null) return remoteHttpContentAsync(client, method, url, timeoutMs, headers, null)
.thenApply(out -> out.toByteArray()) .thenApply(ByteArrayOutputStream::toByteArray)
.join(); .join();
} }
@@ -5338,27 +5326,29 @@ public final class Utility {
int timeoutMs, int timeoutMs,
Charset charset, Charset charset,
Map<String, Serializable> headers, Map<String, Serializable> headers,
String body) String body) {
throws IOException {
return remoteHttpContentAsync(client, method, url, timeoutMs, headers, body) return remoteHttpContentAsync(client, method, url, timeoutMs, headers, body)
.thenApply(out -> out.toByteArray()) .thenApply(ByteArrayOutputStream::toByteArray)
.join(); .join();
} }
public static ByteArrayOutputStream remoteHttpContent( public static ByteArrayOutputStream remoteHttpContent(
String method, String url, Map<String, Serializable> headers, String body) throws IOException { String method, String url, Map<String, Serializable> headers, String body) {
return remoteHttpContent(method, url, 0, headers, body); return remoteHttpContent(method, url, 0, headers, body);
} }
public static ByteArrayOutputStream remoteHttpContent( public static ByteArrayOutputStream remoteHttpContent(
String method, String url, int timeoutMs, Map<String, Serializable> headers, String body) String method, String url, int timeoutMs, Map<String, Serializable> headers, String body) {
throws IOException {
return remoteHttpContentAsync(method, url, timeoutMs, headers, body).join(); return remoteHttpContentAsync(method, url, timeoutMs, headers, body).join();
} }
public static ByteArrayOutputStream remoteHttpContent( public static ByteArrayOutputStream remoteHttpContent(
HttpClient client, String method, String url, int timeoutMs, Map<String, Serializable> headers, String body) HttpClient client,
throws IOException { String method,
String url,
int timeoutMs,
Map<String, Serializable> headers,
String body) {
return remoteHttpContentAsync(client, method, url, timeoutMs, headers, body) return remoteHttpContentAsync(client, method, url, timeoutMs, headers, body)
.join(); .join();
} }
@@ -5548,38 +5538,40 @@ public final class Utility {
} }
public static CompletableFuture<byte[]> postHttpBytesContentAsync(String url) { public static CompletableFuture<byte[]> postHttpBytesContentAsync(String url) {
return remoteHttpContentAsync("POST", url, 0, null, null).thenApply(out -> out.toByteArray()); return remoteHttpContentAsync("POST", url, 0, null, null).thenApply(ByteArrayOutputStream::toByteArray);
} }
public static CompletableFuture<byte[]> postHttpBytesContentAsync( public static CompletableFuture<byte[]> postHttpBytesContentAsync(
String url, Map<String, Serializable> respHeaders) { String url, Map<String, Serializable> respHeaders) {
return remoteHttpContentAsync("POST", url, 0, null, null, respHeaders).thenApply(out -> out.toByteArray()); return remoteHttpContentAsync("POST", url, 0, null, null, respHeaders)
.thenApply(ByteArrayOutputStream::toByteArray);
} }
public static CompletableFuture<byte[]> postHttpBytesContentAsync(String url, int timeoutMs) { public static CompletableFuture<byte[]> postHttpBytesContentAsync(String url, int timeoutMs) {
return remoteHttpContentAsync("POST", url, timeoutMs, null, null).thenApply(out -> out.toByteArray()); return remoteHttpContentAsync("POST", url, timeoutMs, null, null).thenApply(ByteArrayOutputStream::toByteArray);
} }
public static CompletableFuture<byte[]> postHttpBytesContentAsync( public static CompletableFuture<byte[]> postHttpBytesContentAsync(
String url, int timeoutMs, Map<String, Serializable> respHeaders) { String url, int timeoutMs, Map<String, Serializable> respHeaders) {
return remoteHttpContentAsync("POST", url, timeoutMs, null, null, respHeaders) return remoteHttpContentAsync("POST", url, timeoutMs, null, null, respHeaders)
.thenApply(out -> out.toByteArray()); .thenApply(ByteArrayOutputStream::toByteArray);
} }
public static CompletableFuture<byte[]> postHttpBytesContentAsync( public static CompletableFuture<byte[]> postHttpBytesContentAsync(
String url, Map<String, Serializable> headers, String body) { String url, Map<String, Serializable> headers, String body) {
return remoteHttpContentAsync("POST", url, 0, headers, body).thenApply(out -> out.toByteArray()); return remoteHttpContentAsync("POST", url, 0, headers, body).thenApply(ByteArrayOutputStream::toByteArray);
} }
public static CompletableFuture<byte[]> postHttpBytesContentAsync( public static CompletableFuture<byte[]> postHttpBytesContentAsync(
String url, Map<String, Serializable> headers, String body, Map<String, Serializable> respHeaders) { String url, Map<String, Serializable> headers, String body, Map<String, Serializable> respHeaders) {
return remoteHttpContentAsync("POST", url, 0, headers, body, respHeaders) return remoteHttpContentAsync("POST", url, 0, headers, body, respHeaders)
.thenApply(out -> out.toByteArray()); .thenApply(ByteArrayOutputStream::toByteArray);
} }
public static CompletableFuture<byte[]> postHttpBytesContentAsync( public static CompletableFuture<byte[]> postHttpBytesContentAsync(
String url, int timeoutMs, Map<String, Serializable> headers, String body) { String url, int timeoutMs, Map<String, Serializable> headers, String body) {
return remoteHttpContentAsync("POST", url, timeoutMs, headers, body).thenApply(out -> out.toByteArray()); return remoteHttpContentAsync("POST", url, timeoutMs, headers, body)
.thenApply(ByteArrayOutputStream::toByteArray);
} }
public static CompletableFuture<byte[]> postHttpBytesContentAsync( public static CompletableFuture<byte[]> postHttpBytesContentAsync(
@@ -5589,7 +5581,7 @@ public final class Utility {
String body, String body,
Map<String, Serializable> respHeaders) { Map<String, Serializable> respHeaders) {
return remoteHttpContentAsync("POST", url, timeoutMs, headers, body, respHeaders) return remoteHttpContentAsync("POST", url, timeoutMs, headers, body, respHeaders)
.thenApply(out -> out.toByteArray()); .thenApply(ByteArrayOutputStream::toByteArray);
} }
public static CompletableFuture<String> getHttpContentAsync(String url) { public static CompletableFuture<String> getHttpContentAsync(String url) {
@@ -5718,37 +5710,40 @@ public final class Utility {
} }
public static CompletableFuture<byte[]> getHttpBytesContentAsync(String url) { public static CompletableFuture<byte[]> getHttpBytesContentAsync(String url) {
return remoteHttpContentAsync("GET", url, 0, null, null).thenApply(out -> out.toByteArray()); return remoteHttpContentAsync("GET", url, 0, null, null).thenApply(ByteArrayOutputStream::toByteArray);
} }
public static CompletableFuture<byte[]> getHttpBytesContentAsync( public static CompletableFuture<byte[]> getHttpBytesContentAsync(
String url, Map<String, Serializable> respHeaders) { String url, Map<String, Serializable> respHeaders) {
return remoteHttpContentAsync("GET", url, 0, null, null, respHeaders).thenApply(out -> out.toByteArray()); return remoteHttpContentAsync("GET", url, 0, null, null, respHeaders)
.thenApply(ByteArrayOutputStream::toByteArray);
} }
public static CompletableFuture<byte[]> getHttpBytesContentAsync(String url, int timeoutMs) { public static CompletableFuture<byte[]> getHttpBytesContentAsync(String url, int timeoutMs) {
return remoteHttpContentAsync("GET", url, timeoutMs, null, null).thenApply(out -> out.toByteArray()); return remoteHttpContentAsync("GET", url, timeoutMs, null, null).thenApply(ByteArrayOutputStream::toByteArray);
} }
public static CompletableFuture<byte[]> getHttpBytesContentAsync( public static CompletableFuture<byte[]> getHttpBytesContentAsync(
String url, int timeoutMs, Map<String, Serializable> respHeaders) { String url, int timeoutMs, Map<String, Serializable> respHeaders) {
return remoteHttpContentAsync("GET", url, timeoutMs, null, null, respHeaders) return remoteHttpContentAsync("GET", url, timeoutMs, null, null, respHeaders)
.thenApply(out -> out.toByteArray()); .thenApply(ByteArrayOutputStream::toByteArray);
} }
public static CompletableFuture<byte[]> getHttpBytesContentAsync( public static CompletableFuture<byte[]> getHttpBytesContentAsync(
String url, Map<String, Serializable> headers, String body) { String url, Map<String, Serializable> headers, String body) {
return remoteHttpContentAsync("GET", url, 0, headers, body).thenApply(out -> out.toByteArray()); return remoteHttpContentAsync("GET", url, 0, headers, body).thenApply(ByteArrayOutputStream::toByteArray);
} }
public static CompletableFuture<byte[]> getHttpBytesContentAsync( public static CompletableFuture<byte[]> getHttpBytesContentAsync(
String url, Map<String, Serializable> headers, String body, Map<String, Serializable> respHeaders) { String url, Map<String, Serializable> headers, String body, Map<String, Serializable> respHeaders) {
return remoteHttpContentAsync("GET", url, 0, headers, body, respHeaders).thenApply(out -> out.toByteArray()); return remoteHttpContentAsync("GET", url, 0, headers, body, respHeaders)
.thenApply(ByteArrayOutputStream::toByteArray);
} }
public static CompletableFuture<byte[]> getHttpBytesContentAsync( public static CompletableFuture<byte[]> getHttpBytesContentAsync(
String url, int timeoutMs, Map<String, Serializable> headers, String body) { String url, int timeoutMs, Map<String, Serializable> headers, String body) {
return remoteHttpContentAsync("GET", url, timeoutMs, headers, body).thenApply(out -> out.toByteArray()); return remoteHttpContentAsync("GET", url, timeoutMs, headers, body)
.thenApply(ByteArrayOutputStream::toByteArray);
} }
public static CompletableFuture<byte[]> getHttpBytesContentAsync( public static CompletableFuture<byte[]> getHttpBytesContentAsync(
@@ -5758,7 +5753,7 @@ public final class Utility {
String body, String body,
Map<String, Serializable> respHeaders) { Map<String, Serializable> respHeaders) {
return remoteHttpContentAsync("GET", url, timeoutMs, headers, body, respHeaders) return remoteHttpContentAsync("GET", url, timeoutMs, headers, body, respHeaders)
.thenApply(out -> out.toByteArray()); .thenApply(ByteArrayOutputStream::toByteArray);
} }
public static CompletableFuture<byte[]> getHttpBytesContentAsync( public static CompletableFuture<byte[]> getHttpBytesContentAsync(
@@ -5769,7 +5764,7 @@ public final class Utility {
String body, String body,
Map<String, Serializable> respHeaders) { Map<String, Serializable> respHeaders) {
return remoteHttpContentAsync(client, "GET", url, timeoutMs, headers, body, respHeaders) return remoteHttpContentAsync(client, "GET", url, timeoutMs, headers, body, respHeaders)
.thenApply(out -> out.toByteArray()); .thenApply(ByteArrayOutputStream::toByteArray);
} }
public static CompletableFuture<ByteArrayOutputStream> remoteHttpContentAsync( public static CompletableFuture<ByteArrayOutputStream> remoteHttpContentAsync(