Skip to content

Commit

Permalink
Merge pull request #32878 from Sanne/backportsWithVertxAndHr
Browse files Browse the repository at this point in the history
3.0.1 backports 2 - Vert.x 4.4, HR 2.0.0.CR1 version
  • Loading branch information
gsmet authored Apr 25, 2023
2 parents 0f0ff8f + c35fda7 commit 89cd51c
Show file tree
Hide file tree
Showing 175 changed files with 3,247 additions and 729 deletions.
15 changes: 7 additions & 8 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<opentelemetry.version>1.23.1</opentelemetry.version>
<opentelemetry-alpha.version>1.23.0-alpha</opentelemetry-alpha.version>
<jaeger.version>1.8.1</jaeger.version>
<quarkus-http.version>5.0.1.Final</quarkus-http.version>
<quarkus-http.version>5.0.2.Final</quarkus-http.version>
<micrometer.version>1.10.5</micrometer.version><!-- keep in sync with hdrhistogram -->
<hdrhistogram.version>2.1.12</hdrhistogram.version><!-- keep in sync with micrometer -->
<google-auth.version>0.22.0</google-auth.version>
Expand Down Expand Up @@ -67,7 +67,7 @@
<smallrye-context-propagation.version>2.1.0</smallrye-context-propagation.version>
<smallrye-reactive-streams-operators.version>1.0.13</smallrye-reactive-streams-operators.version>
<smallrye-reactive-types-converter.version>3.0.0</smallrye-reactive-types-converter.version>
<smallrye-mutiny-vertx-binding.version>3.2.0</smallrye-mutiny-vertx-binding.version>
<smallrye-mutiny-vertx-binding.version>3.3.0</smallrye-mutiny-vertx-binding.version>
<smallrye-reactive-messaging.version>4.4.0</smallrye-reactive-messaging.version>
<smallrye-stork.version>2.1.0</smallrye-stork.version>
<jakarta.activation.version>2.1.1</jakarta.activation.version>
Expand Down Expand Up @@ -97,10 +97,10 @@
<commons-lang3.version>3.12.0</commons-lang3.version>
<commons-codec.version>1.15</commons-codec.version>
<classmate.version>1.5.1</classmate.version>
<hibernate-orm.version>6.2.0.Final</hibernate-orm.version> <!-- When updating, align bytebuddy.version to Hibernate needs as well (just below): -->
<hibernate-orm.version>6.2.1.Final</hibernate-orm.version> <!-- When updating, align bytebuddy.version to Hibernate needs as well (just below): -->
<bytebuddy.version>1.12.18</bytebuddy.version> <!-- Version controlled by Hibernate ORM's needs -->
<hibernate-commons-annotations.version>6.0.6.Final</hibernate-commons-annotations.version> <!-- version controlled by Hibernate ORM -->
<hibernate-reactive.version>2.0.0.Beta2</hibernate-reactive.version>
<hibernate-reactive.version>2.0.0.CR1</hibernate-reactive.version>
<hibernate-validator.version>8.0.0.Final</hibernate-validator.version>
<hibernate-search.version>6.1.7.Final</hibernate-search.version>
<narayana.version>6.0.0.Final</narayana.version>
Expand All @@ -119,8 +119,7 @@
<wildfly-client-config.version>1.0.1.Final</wildfly-client-config.version>
<wildfly-elytron.version>2.1.0.Final</wildfly-elytron.version>
<jboss-threads.version>3.5.0.Final</jboss-threads.version>
<vertx.version>4.3.7</vertx.version>

<vertx.version>4.4.1</vertx.version>
<httpclient.version>4.5.14</httpclient.version>
<httpcore.version>4.4.16</httpcore.version>
<httpasync.version>4.1.5</httpasync.version>
Expand All @@ -142,7 +141,7 @@
<infinispan.version>14.0.8.Final</infinispan.version>
<infinispan.protostream.version>4.6.2.Final</infinispan.protostream.version>
<caffeine.version>3.1.5</caffeine.version>
<netty.version>4.1.87.Final</netty.version>
<netty.version>4.1.90.Final</netty.version>
<brotli4j.version>1.11.0</brotli4j.version>
<reactive-streams.version>1.0.4</reactive-streams.version>
<jboss-logging.version>3.5.0.Final</jboss-logging.version>
Expand All @@ -161,7 +160,7 @@
<kotlin.version>1.8.10</kotlin.version>
<kotlin.coroutine.version>1.6.4</kotlin.coroutine.version>
<kotlin-serialization.version>1.5.0</kotlin-serialization.version>
<dekorate.version>3.5.4</dekorate.version> <!-- Please check with Java Operator SDK team before updating -->
<dekorate.version>3.5.5</dekorate.version> <!-- Please check with Java Operator SDK team before updating -->
<maven-invoker.version>3.2.0</maven-invoker.version>
<awaitility.version>4.2.0</awaitility.version>
<jboss-logmanager.version>1.1.1</jboss-logmanager.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ public Optional<DevModeType> getDevModeType() {
return devModeType;
}

/**
* Whether the development mode type is not local.
*
* @return true if {@link #getDevModeType()} is not {@link DevModeType#LOCAL}
*/
public boolean isNotLocalDevModeType() {
return devModeType.orElse(null) != DevModeType.LOCAL;
}

/**
* An Auxiliary Application is a second application running in the same JVM as a primary application.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,6 @@ public final class RunTimeConfigurationGenerator {
static final MethodDescriptor CU_ADD_SOURCE_FACTORY_PROVIDER = MethodDescriptor.ofMethod(ConfigUtils.class,
"addSourceFactoryProvider",
void.class, SmallRyeConfigBuilder.class, ConfigSourceFactoryProvider.class);
static final MethodDescriptor CU_WITH_MAPPING = MethodDescriptor.ofMethod(ConfigUtils.class, "addMapping",
void.class, SmallRyeConfigBuilder.class, String.class, String.class);

static final MethodDescriptor RCS_NEW = MethodDescriptor.ofConstructor(RuntimeConfigSource.class, String.class);
static final MethodDescriptor RCSP_NEW = MethodDescriptor.ofConstructor(RuntimeConfigSourceProvider.class, String.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,13 @@ private Path createAppCDSFromExit(JarBuildItem jarResult,
Path workingDirectory = appCDSPathsContainer.workingDirectory;
Path appCDSPath = appCDSPathsContainer.resultingFile;

List<String> javaArgs = new ArrayList<>(3);
boolean debug = log.isDebugEnabled();
List<String> javaArgs = new ArrayList<>(debug ? 4 : 3);
javaArgs.add("-XX:ArchiveClassesAtExit=" + appCDSPath.getFileName().toString());
javaArgs.add(String.format("-D%s=true", MainClassBuildStep.GENERATE_APP_CDS_SYSTEM_PROPERTY));
if (debug) {
javaArgs.add("-Xlog:cds=debug");
}
javaArgs.add("-jar");

List<String> command;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
import io.quarkus.runtime.configuration.ConfigRecorder;
import io.quarkus.runtime.configuration.DefaultsConfigSource;
import io.quarkus.runtime.configuration.DisableableConfigSource;
import io.quarkus.runtime.configuration.MappingsConfigBuilder;
import io.quarkus.runtime.configuration.QuarkusConfigValue;
import io.quarkus.runtime.configuration.RuntimeOverrideConfigSource;
import io.smallrye.config.ConfigMappings.ConfigClassWithPrefix;
Expand All @@ -91,10 +92,6 @@ public class ConfigGenerationBuildStep {
SmallRyeConfigBuilder.class, "withSources",
SmallRyeConfigBuilder.class, ConfigSource[].class);

private static final MethodDescriptor WITH_MAPPING = MethodDescriptor.ofMethod(
SmallRyeConfigBuilder.class, "withMapping",
SmallRyeConfigBuilder.class, Class.class, String.class);

@BuildStep
void staticInitSources(
BuildProducer<StaticInitConfigSourceProviderBuildItem> staticInitConfigSourceProviderBuildItem,
Expand Down Expand Up @@ -553,23 +550,25 @@ private static void generateMappingsConfigBuilder(
.classOutput(new GeneratedClassGizmoAdaptor(generatedClass, true))
.className(className)
.interfaces(ConfigBuilder.class)
.superClass(MappingsConfigBuilder.class)
.setFinal(true)
.build()) {

MethodCreator method = classCreator.getMethodCreator(CONFIG_BUILDER);
ResultHandle configBuilder = method.getMethodParam(0);

MethodDescriptor addMapping = MethodDescriptor.ofMethod(MappingsConfigBuilder.class, "addMapping", void.class,
SmallRyeConfigBuilder.class, String.class, String.class);

for (ConfigClassWithPrefix mapping : mappings) {
method.invokeVirtualMethod(WITH_MAPPING, configBuilder,
method.loadClass(mapping.getKlass()),
method.invokeStaticMethod(addMapping, configBuilder, method.load(mapping.getKlass().getName()),
method.load(mapping.getPrefix()));
}

method.returnValue(configBuilder);
}

reflectiveClass
.produce(ReflectiveClassBuildItem.builder(className).build());
reflectiveClass.produce(ReflectiveClassBuildItem.builder(className).build());
}

private static Set<String> discoverService(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ private List<ConfigDocItem> recursivelyFindConfigItems(Element element, String r
String name = null;
String defaultValue = NO_DEFAULT;
String defaultValueDoc = EMPTY;
final TypeMirror typeMirror = unwrapTypeMirror(enclosedElement.asType());
String type = typeMirror.toString();
List<String> acceptedValues = null;
final TypeElement clazz = (TypeElement) element;
final String fieldName = enclosedElement.getSimpleName().toString();
Expand Down Expand Up @@ -250,6 +248,9 @@ private List<ConfigDocItem> recursivelyFindConfigItems(Element element, String r
defaultValue = EMPTY;
}

TypeMirror typeMirror = unwrapTypeMirror(enclosedElement.asType());
String type = getType(typeMirror);

if (isConfigGroup(type)) {
List<ConfigDocItem> groupConfigItems = readConfigGroupItems(configPhase, rootName, name, type,
configSection, withinAMap, generateSeparateConfigGroupDocsFiles);
Expand Down Expand Up @@ -387,6 +388,15 @@ private TypeMirror unwrapTypeMirror(TypeMirror typeMirror) {
return typeMirror;
}

private String getType(TypeMirror typeMirror) {
if (typeMirror instanceof DeclaredType) {
DeclaredType declaredType = (DeclaredType) typeMirror;
TypeElement typeElement = (TypeElement) declaredType.asElement();
return typeElement.getQualifiedName().toString();
}
return typeMirror.toString();
}

private boolean isConfigGroup(String type) {
if (type.startsWith("java.") || PRIMITIVE_TYPES.contains(type)) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,6 @@ public static void addSourceFactoryProvider(SmallRyeConfigBuilder builder, Confi
builder.withSources(provider.getConfigSourceFactory(Thread.currentThread().getContextClassLoader()));
}

public static void addMapping(SmallRyeConfigBuilder builder, String mappingClass, String prefix) {
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
try {
builder.withMapping(contextClassLoader.loadClass(mappingClass), prefix);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}

public static List<String> getProfiles() {
return ConfigProvider.getConfig().unwrap(SmallRyeConfig.class).getProfiles();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package io.quarkus.runtime.configuration;

import io.smallrye.config.SmallRyeConfigBuilder;

/**
* To support mappings that are not public
*/
public abstract class MappingsConfigBuilder implements ConfigBuilder {
protected static void addMapping(SmallRyeConfigBuilder builder, String mappingClass, String prefix) {
// TODO - Ideally should use the classloader passed to Config, but the method is not public. Requires a change in SmallRye Config.
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
try {
builder.withMapping(contextClassLoader.loadClass(mappingClass), prefix);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package io.quarkus.runtime.init;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
import java.util.stream.StreamSupport;

import org.eclipse.microprofile.config.ConfigProvider;

import io.quarkus.runtime.PreventFurtherStepsException;
import io.quarkus.runtime.Quarkus;
import io.quarkus.runtime.annotations.Recorder;

/**
Expand All @@ -22,8 +26,27 @@ public void exitIfNeeded() {
.anyMatch(n -> QUARKUS_INIT_AND_EXIT.equals(n));
if (initAndExitConfigured) {
if (ConfigProvider.getConfig().getValue(QUARKUS_INIT_AND_EXIT, boolean.class)) {
throw new PreventFurtherStepsException("Gracefully exiting after initalization.", 0);
preventFurtherRecorderSteps(5, "Error attempting to gracefully shutdown after initialization",
() -> new PreventFurtherStepsException("Gracefully exiting after initialization.", 0));
}
}
}

public static void preventFurtherRecorderSteps(int waitSeconds, String waitErrorMessage,
Supplier<PreventFurtherStepsException> supplier) {
CountDownLatch latch = new CountDownLatch(1);
new Thread(new Runnable() {
@Override
public void run() {
Quarkus.blockingExit();
latch.countDown();
}
}).start();
try {
latch.await(waitSeconds, TimeUnit.SECONDS);
} catch (InterruptedException e) {
System.err.println(waitErrorMessage);
}
throw supplier.get();
}
}
2 changes: 2 additions & 0 deletions docs/src/main/asciidoc/config-extending-support.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,8 @@ The `ConfigSourceInterceptorFactory` may initialize an interceptor with access t
----
package org.acme.config;
import static io.smallrye.config.SecretKeys.doLocked;
import jakarta.annotation.Priority;
import io.smallrye.config.ConfigSourceInterceptor;
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/doc-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Your titles and headings must also follow the specific guidance for the Quarkus
.Title guidance for different Quarkus content types
[cols="15%,25%a,30%,30%"]
|===
|Content type |Should ... |Good example|Bad example
|Content type |Should ... |Good example |Bad example

|Concept
|* Start with a noun that names the concept or topic
Expand Down
37 changes: 36 additions & 1 deletion docs/src/main/asciidoc/kafka-schema-registry-avro.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ For example, with Apicurio dev service if you set the image name to use version

[source,properties]
----
quarkus.apicurio-registry.devservices.image-name=quay.io/apicurio/apicurio-registry-mem:2.4.2.Final
quarkus.apicurio-registry.devservices.image-name=quay.io/apicurio/apicurio-registry-mem:2.1.5.Final
----

You need to make sure that `apicurio-registry-serdes-avro-serde` dependency
Expand All @@ -645,6 +645,16 @@ and the REST client `apicurio-common-rest-client-vertx` dependency are set to co
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.apicurio</groupId>
<artifactId>apicurio-registry-client</artifactId>
<version>2.1.5.Final</version>
</dependency>
<dependency>
<groupId>io.apicurio</groupId>
<artifactId>apicurio-registry-common</artifactId>
<version>2.1.5.Final</version>
</dependency>
<dependency>
<groupId>io.apicurio</groupId>
<artifactId>apicurio-registry-serdes-avro-serde</artifactId>
Expand All @@ -654,6 +664,14 @@ and the REST client `apicurio-common-rest-client-vertx` dependency are set to co
<groupId>io.apicurio</groupId>
<artifactId>apicurio-common-rest-client-jdk</artifactId>
</exclusion>
<exclusion>
<groupId>io.apicurio</groupId>
<artifactId>apicurio-registry-client</artifactId>
</exclusion>
<exclusion>
<groupId>io.apicurio</groupId>
<artifactId>apicurio-registry-common</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand All @@ -674,6 +692,18 @@ dependencies {
implementation("io.quarkus:quarkus-apicurio-registry-avro")
implementation("io.apicurio:apicurio-registry-serdes-avro-serde") {
exclude group: "io.apicurio", module: "apicurio-common-rest-client-jdk"
exclude group: "io.apicurio", module: "apicurio-registry-client"
exclude group: "io.apicurio", module: "apicurio-registry-common"
version {
strictly "2.1.5.Final"
}
}
implementation("io.apicurio:apicurio-registry-client") {
version {
strictly "2.1.5.Final"
}
}
implementation("io.apicurio:apicurio-registry-common") {
version {
strictly "2.1.5.Final"
}
Expand All @@ -686,6 +716,11 @@ dependencies {
}
----

Known previous compatible versions for `apicurio-registry-client` and `apicurio-common-rest-client-vertx` are the following

- `apicurio-registry-client` 2.1.5.Final with `apicurio-common-rest-client-vertx` 0.1.5.Final
- `apicurio-registry-client` 2.3.1.Final with `apicurio-common-rest-client-vertx` 0.1.13.Final

[[confluent]]
== Using the Confluent Schema Registry

Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/mongodb-panache.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ For these operations, you can express the update document the same way you expre
- `firstname = ?1 and status = ?2` will be mapped to the update document `{'$set' : {'firstname': ?1, 'status': ?2}}`
- `firstname = :firstname and status = :status` will be mapped to the update document `{'$set' : {'firstname': :firstname, 'status': :status}}`
- `{'firstname' : ?1 and 'status' : ?2}` will be mapped to the update document `{'$set' : {'firstname': ?1, 'status': ?2}}`
- `{'firstname' : :firstname and 'status' : :status}` ` will be mapped to the update document `{'$set' : {'firstname': :firstname, 'status': :status}}`
- `{'firstname' : :firstname and 'status' : :status}` will be mapped to the update document `{'$set' : {'firstname': :firstname, 'status': :status}}`
- `{'$inc': {'cpt': ?1}}` will be used as-is

=== Query parameters
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/qute-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1665,7 +1665,7 @@ On the other hand, if the value is set (e.g. via `TemplateInstance.data("foo", "
The type of a default value must be assignable to the type of the parameter declaration. For example, see the incorrect parameter declaration that results in a build failure: `{@org.acme.Foo foo=1}`.

TIP: The default value is actually an <<expressions,expression>>. So the default value does not have to be a literal (such as `42` or `true`). For example, you can leverage the `@TemplateEnum` and specify an enum constant as a default value of a parameter declaration: `{@org.acme.MyEnum myEnum=MyEnum:FOO}`.
However, the infix notation is not supported in default values unless the parentheses are used for grouping, e.g. `{@org.acme.Foo foo=(foo1 ?: foo2)}``.
However, the infix notation is not supported in default values unless the parentheses are used for grouping, e.g. `{@org.acme.Foo foo=(foo1 ?: foo2)}`.

IMPORTANT: The type of a default value is not validated in <<standalone,Qute standalone>>.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/redis-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ This behavior is disabled in _prod_ mode, and if you want to import even in prod
%prod.quarkus.redis.load-script=import.redis
----

Before importing in _prod_ mode, mae sure you configured `quarkus.redis.flush-before-load` accordingly.
Before importing in _prod_ mode, make sure you configured `quarkus.redis.flush-before-load` accordingly.

IMPORTANT: In dev mode, to reload the content of the `.redis` load scripts, you need to add: `%dev.quarkus.vertx.caching=false`

Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/rest-client-multipart.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ The name of the property needs to follow a certain convention which is best disp
quarkus.rest-client."org.acme.rest.client.multipart.MultipartService".url=http://localhost:8080/
----

Having this configuration means that all requests performed using `org.acme.rest.client.multipart.MultipartService` will use `http://localhost:8080/ ` as the base URL.
Having this configuration means that all requests performed using `org.acme.rest.client.multipart.MultipartService` will use `http://localhost:8080/` as the base URL.

Note that `org.acme.rest.client.multipart.MultipartService` _must_ match the fully qualified name of the `MultipartService` interface we created in the previous section.

Expand Down
Loading

0 comments on commit 89cd51c

Please sign in to comment.