Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime initialize grpc class using j.u.Random #16008

Merged
merged 1 commit into from
Mar 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
import io.quarkus.gizmo.MethodCreator;
import io.quarkus.gizmo.MethodDescriptor;
import io.quarkus.gizmo.ResultHandle;
Expand Down Expand Up @@ -175,6 +176,12 @@ void registerSslResources(BuildProducer<NativeImageResourceBuildItem> resourceBu
registerResourcesForProperties(config, resourceBuildItem, TRUST_STORE_PATTERN, CERTIFICATE_PATTERN, KEY_PATTERN);
}

@BuildStep
void runtimeInitialize(BuildProducer<RuntimeInitializedClassBuildItem> producer) {
// io.grpc.internal.RetriableStream uses j.u.Ramdom, so needs to be runtime-initialized
producer.produce(new RuntimeInitializedClassBuildItem("io.grpc.internal.RetriableStream"));
}

private void generateChannelProducer(MethodCreator mc, GrpcServiceBuildItem svc) {
ResultHandle name = mc.load(svc.getServiceName());
ResultHandle result = mc.invokeStaticMethod(CREATE_CHANNEL_METHOD, name);
Expand Down