Added HelloCancellationScope - #37
Merged
Merged
Conversation
samarabbas
reviewed
Aug 22, 2020
| sleep(1); | ||
| try { | ||
| context.heartbeat(i); | ||
| } catch (ActivityCompletionException e) { |
Contributor
There was a problem hiding this comment.
Usage of ActivityCompletionException here is not clear. Considering this specific sample is in the context of cancellation I think we should explain why we are handling ActivityCompletionException here.
samarabbas
approved these changes
Aug 22, 2020
samarabbas
left a comment
Contributor
There was a problem hiding this comment.
We also need a readme for this sample.
rylandg
approved these changes
Aug 22, 2020
| scope.run(); | ||
| // Wait for one of the activities to complete. | ||
| Promise.anyOf(results).get(); | ||
| // Cancel all other activities |
| scope.cancel(); | ||
| // Get the result from one of the Promises. | ||
| String result = null; | ||
| for (int i = 0; i < greetings.length; i++) { |
There was a problem hiding this comment.
I would rely on anyOf result if possible instead of the loop
| // client that can be used to start and signal workflows | ||
| WorkflowClient client = WorkflowClient.newInstance(service); | ||
|
|
||
| // worker factory that can be used to create workers for specific task queues |
| .setMaxConcurrentActivityExecutionSize(100) | ||
| .setActivityPollThreadCount(1) | ||
| .build()); | ||
| // Workflows are stateful. So you need a type to create instances. |
There was a problem hiding this comment.
I don't think this will make sense to someone reading the Sample.
|
|
||
| // worker factory that can be used to create workers for specific task queues | ||
| WorkerFactory factory = WorkerFactory.newInstance(client); | ||
| // Worker that listens on a task queue and hosts both workflow and activity implementations. |
| public static void main(String[] args) { | ||
| // gRPC stubs wrapper that talks to the local docker instance of temporal service. | ||
| WorkflowServiceStubs service = WorkflowServiceStubs.newInstance(); | ||
| // client that can be used to start and signal workflows |
There was a problem hiding this comment.
Are you starting comments with caps or lower? Also do comments end in periods?
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.