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

Made the grpc to use Managed channel directly to use it in blocking mode #1084

Merged
merged 1 commit into from
May 13, 2024

Conversation

maheshrajamani
Copy link
Contributor

@maheshrajamani maheshrajamani commented May 13, 2024

What this PR does:
Injecting blocking stub doesn't work on eventloop thread. Made token validation call as blocking channel.

Checklist

  • Changes manually tested
  • Automated Tests added/updated
  • Documentation added/updated
  • CLA Signed: DataStax CLA

@maheshrajamani maheshrajamani self-assigned this May 13, 2024
@maheshrajamani maheshrajamani requested a review from a team as a code owner May 13, 2024 16:46
@maheshrajamani maheshrajamani merged commit 5da46e7 into main May 13, 2024
3 checks passed
@maheshrajamani maheshrajamani deleted the blocking-validation branch May 13, 2024 17:22
@ConfigProperty(name = "quarkus.grpc.clients.embedding.port")
private int port;

private ManagedChannel channel = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be volatile if there's no other synchronization?


@Inject DataApiRequestInfo dataApiRequestInfo;

public boolean validate(String provider, String value) {
if (channel == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about synchronization? Could make channel synchronized; if this is used concurrently is it not necessary to consider synchronization?

@@ -31,4 +44,8 @@ public boolean validate(String provider, String value) {
}
return validateCredentialResponse.getValidity();
}

void onStop(@Observes ShutdownEvent ev) {
channel.shutdown();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can channel ever remain null?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants