Skip to content

Commit

Permalink
Clients with a class with postponed initialization in their method
Browse files Browse the repository at this point in the history
signatures cannot be compiled to native quarkiverse#580
  • Loading branch information
ppalaga committed Apr 12, 2023
1 parent afe1c3e commit ce850dd
Show file tree
Hide file tree
Showing 21 changed files with 634 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@ quarkus.cxf.client.codeFirstClient.client-endpoint-url=${cxf.it.calculator.baseU
quarkus.cxf.client.codeFirstClient.service-interface=io.quarkiverse.cxf.client.it.CodeFirstClient
quarkus.cxf.client.codeFirstClient.endpoint-namespace=http://www.jboss.org/eap/quickstarts/wscalculator/Calculatorrr
quarkus.cxf.client.codeFirstClient.endpoint-name=CalculatorService

quarkus.cxf.client.clientWithRuntimeInitializedPayload.client-endpoint-url=${cxf.it.calculator.baseUri}/calculator-ws/CalculatorService
quarkus.cxf.client.clientWithRuntimeInitializedPayload.service-interface=io.quarkiverse.cxf.client.it.rtinit.ClientWithRuntimeInitializedPayload
quarkus.cxf.client.clientWithRuntimeInitializedPayload.endpoint-namespace=http://www.jboss.org/eap/quickstarts/wscalculator/Calculator
quarkus.cxf.client.clientWithRuntimeInitializedPayload.endpoint-name=CalculatorService
quarkus.cxf.client.clientWithRuntimeInitializedPayload.native.runtime-initialized = true
quarkus.native.additional-build-args=--initialize-at-run-time=io.quarkiverse.cxf.client.it.rtinit.Operands\\,io.quarkiverse.cxf.client.it.rtinit.Result
50 changes: 50 additions & 0 deletions docs/modules/ROOT/pages/includes/quarkus-cxf.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,56 @@ endif::add-copy-button-to-env-var[]
|


a|icon:lock[title=Fixed at build time] [[quarkus-cxf_quarkus.cxf.client.-clients-.service-interface]]`link:#quarkus-cxf_quarkus.cxf.client.-clients-.service-interface[quarkus.cxf.client."clients".service-interface]`

[.description]
--
The client service interface class name

ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_CXF_CLIENT__CLIENTS__SERVICE_INTERFACE+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_CXF_CLIENT__CLIENTS__SERVICE_INTERFACE+++`
endif::add-copy-button-to-env-var[]
--|string
|


a|icon:lock[title=Fixed at build time] [[quarkus-cxf_quarkus.cxf.client.-clients-.alternative]]`link:#quarkus-cxf_quarkus.cxf.client.-clients-.alternative[quarkus.cxf.client."clients".alternative]`

[.description]
--
Indicates whether this is an alternative proxy client configuration. If true, then this configuration is ignored when configuring a client without annotation `@CXFClient`.

ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_CXF_CLIENT__CLIENTS__ALTERNATIVE+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_CXF_CLIENT__CLIENTS__ALTERNATIVE+++`
endif::add-copy-button-to-env-var[]
--|boolean
|`false`


a|icon:lock[title=Fixed at build time] [[quarkus-cxf_quarkus.cxf.client.-clients-.native.runtime-initialized]]`link:#quarkus-cxf_quarkus.cxf.client.-clients-.native.runtime-initialized[quarkus.cxf.client."clients".native.runtime-initialized]`

[.description]
--
If `true`, the client dynamic proxy class generated by native compiler will be initialized at runtime; otherwise the proxy class will be initialized at build time.
Setting this to `true` makes sense if your service endpoint interface references some class initialized at runtime in its method signatures. E.g. Say, your service interface has method @code++{++int add(Operands o)++}++ and the `Operands` class was requested to be initialized at runtime. Then, without setting this configuration parameter to `true`, the native compiler will throw an exception saying something like `Classes that should be initialized at run time got initialized during image building: org.acme.Operands ... jdk.proxy<some-number>.$Proxy<some-number> caused initialization of this class`. `jdk.proxy<some-number>.$Proxy<some-number>` is the proxy class generated by the native compiler.
While `quarkus-cxf` can auto-detect the proper setting in some cases, the auto-detection is not perfect. This is because runtime initialization of classes can be requested in many ways out of which only the ones done via Quarkus `RuntimeInitializedClassBuildItem` and `RuntimeInitializedPackageBuildItem` can safely be observed by `quarkus-cxf`. In other cases, you'll have to set this manually.

ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_CXF_CLIENT__CLIENTS__NATIVE_RUNTIME_INITIALIZED+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_CXF_CLIENT__CLIENTS__NATIVE_RUNTIME_INITIALIZED+++`
endif::add-copy-button-to-env-var[]
--|boolean
|`false`


a| [[quarkus-cxf_quarkus.cxf.endpoint.-endpoints-.implementor]]`link:#quarkus-cxf_quarkus.cxf.endpoint.-endpoints-.implementor[quarkus.cxf.endpoint."endpoints".implementor]`

[.description]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,22 @@
* Holds a client endpoint metadata.
*/
public final class CxfClientBuildItem extends AbstractEndpointBuildItem {
private final String sei;
private final boolean proxyClassRuntimeInitialized;

public CxfClientBuildItem(String sei, String soapBinding, String wsNamespace,
String wsName) {
String wsName, boolean runtimeInitialized) {
super(soapBinding, wsNamespace, wsName);
this.sei = sei;
this.proxyClassRuntimeInitialized = runtimeInitialized;
}

private final String sei;

public String getSei() {
return sei;
}

public boolean isProxyClassRuntimeInitialized() {
return proxyClassRuntimeInitialized;
}

}
Loading

0 comments on commit ce850dd

Please sign in to comment.