diff --git a/bom/dev-ui/pom.xml b/bom/dev-ui/pom.xml index 9c0a6e8697281d..e4ebd64ee2f984 100644 --- a/bom/dev-ui/pom.xml +++ b/bom/dev-ui/pom.xml @@ -13,7 +13,7 @@ Dependency management for dev-ui. Importable by third party extension developers. - 24.4.7 + 24.4.8 3.2.0 4.1.0 3.2.0 diff --git a/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/dns/MongoDnsClient.java b/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/dns/MongoDnsClient.java index d20705bedaec5f..56ab2a4ddd1557 100644 --- a/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/dns/MongoDnsClient.java +++ b/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/dns/MongoDnsClient.java @@ -13,6 +13,7 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Consumer; +import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -26,6 +27,7 @@ import io.quarkus.mongodb.runtime.MongodbConfig; import io.quarkus.runtime.annotations.RegisterForReflection; +import io.smallrye.mutiny.Uni; import io.vertx.core.dns.DnsClientOptions; import io.vertx.mutiny.core.Vertx; import io.vertx.mutiny.core.dns.SrvRecord; @@ -130,12 +132,21 @@ private List resolveSrvRequest(final String srvHost) { if (SRV_CACHE.containsKey(srvHost)) { srvRecords = SRV_CACHE.get(srvHost); } else { - srvRecords = dnsClient.resolveSRV(srvHost).invoke(new Consumer<>() { - @Override - public void accept(List srvRecords) { - SRV_CACHE.put(srvHost, srvRecords); - } - }).await().atMost(timeout); + srvRecords = Uni.createFrom().> deferred( + new Supplier<>() { + @Override + public Uni> get() { + return dnsClient.resolveSRV(srvHost); + } + }) + .onFailure().retry().withBackOff(Duration.ofSeconds(1)).atMost(3) + .invoke(new Consumer<>() { + @Override + public void accept(List srvRecords) { + SRV_CACHE.put(srvHost, srvRecords); + } + }) + .await().atMost(timeout); } if (srvRecords.isEmpty()) { @@ -167,12 +178,22 @@ public List resolveTxtRequest(final String host) { try { Duration timeout = config.getOptionalValue(DNS_LOOKUP_TIMEOUT, Duration.class) .orElse(Duration.ofSeconds(5)); - return dnsClient.resolveTXT(host).invoke(new Consumer<>() { - @Override - public void accept(List strings) { - TXT_CACHE.put(host, strings); - } - }).await().atMost(timeout); + + return Uni.createFrom().> deferred( + new Supplier<>() { + @Override + public Uni> get() { + return dnsClient.resolveTXT(host); + } + }) + .onFailure().retry().withBackOff(Duration.ofSeconds(1)).atMost(3) + .invoke(new Consumer<>() { + @Override + public void accept(List strings) { + TXT_CACHE.put(host, strings); + } + }) + .await().atMost(timeout); } catch (Throwable e) { throw new MongoConfigurationException("Unable to look up TXT record for host " + host, e); } diff --git a/extensions/resteasy-reactive/rest-jaxb/runtime/src/main/java/io/quarkus/resteasy/reactive/jaxb/runtime/serialisers/ServerJaxbMessageBodyReader.java b/extensions/resteasy-reactive/rest-jaxb/runtime/src/main/java/io/quarkus/resteasy/reactive/jaxb/runtime/serialisers/ServerJaxbMessageBodyReader.java index ab833016c9bc7e..a8d8eec468b01e 100644 --- a/extensions/resteasy-reactive/rest-jaxb/runtime/src/main/java/io/quarkus/resteasy/reactive/jaxb/runtime/serialisers/ServerJaxbMessageBodyReader.java +++ b/extensions/resteasy-reactive/rest-jaxb/runtime/src/main/java/io/quarkus/resteasy/reactive/jaxb/runtime/serialisers/ServerJaxbMessageBodyReader.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.io.InputStream; +import java.io.PushbackInputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; @@ -20,7 +21,6 @@ import jakarta.xml.bind.UnmarshalException; import jakarta.xml.bind.Unmarshaller; -import org.jboss.resteasy.reactive.common.util.StreamUtil; import org.jboss.resteasy.reactive.server.spi.ResteasyReactiveResourceInfo; import org.jboss.resteasy.reactive.server.spi.ServerMessageBodyReader; import org.jboss.resteasy.reactive.server.spi.ServerRequestContext; @@ -93,14 +93,16 @@ private Unmarshaller getUnmarshall(Class type) throws JAXBException { } private Object doReadFrom(Class type, Type genericType, InputStream entityStream) throws IOException { - if (isInputStreamEmpty(entityStream)) { + PushbackInputStream pushbackEntityStream = new PushbackInputStream(entityStream); + if (isStreamEmpty(pushbackEntityStream)) { return null; } - - return unmarshal(entityStream, type); + return unmarshal(pushbackEntityStream, type); } - private boolean isInputStreamEmpty(InputStream entityStream) throws IOException { - return StreamUtil.isEmpty(entityStream) || entityStream.available() == 0; + private boolean isStreamEmpty(PushbackInputStream pushbackStream) throws IOException { + int firstByte = pushbackStream.read(); + pushbackStream.unread(firstByte); + return firstByte == -1; } }