Skip to content

Commit fc0d00e

Browse files
Jira/iwf 273 Add/fix javadocs for exception thrown (#265)
1 parent 4484a27 commit fc0d00e

File tree

9 files changed

+125
-34
lines changed

9 files changed

+125
-34
lines changed

src/main/java/io/iworkflow/core/Client.java

Lines changed: 84 additions & 12 deletions
Large diffs are not rendered by default.

src/main/java/io/iworkflow/core/Context.java

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
public abstract class Context {
99
public abstract Long getWorkflowStartTimestampSeconds();
1010

11+
/**
12+
* @return the StateExecutionId.
13+
* Only applicable for state methods (waitUntil or execute)
14+
*/
1115
public abstract Optional<String> getStateExecutionId();
1216

1317
public abstract String getWorkflowRunId();
@@ -16,11 +20,20 @@ public abstract class Context {
1620

1721
public abstract String getWorkflowType();
1822

19-
// this is the start time of the first attempt of the API call. It's from ScheduledTimestamp of Cadence/Temporal activity.GetInfo
20-
// require server version 1.2.2+, return -1 if server version is lower
23+
/**
24+
* @return the start time of the first attempt of the state method invocation.
25+
* Only applicable for state methods (waitUntil or execute)
26+
*/
2127
public abstract Optional<Long> getFirstAttemptTimestampSeconds();
2228

23-
// Attempt starts from 1, and increased by 1 for every retry if retry policy is specified. It's from Attempt of Cadence/Temporal activity.GetInfo
24-
// require server version 1.2.2+, return -1 if server version is lower
29+
/**
30+
* @return attempt starts from 1, and increased by 1 for every retry if retry policy is specified.
31+
*/
2532
public abstract Optional<Integer> getAttempt();
33+
34+
/**
35+
* @return the requestId that is used to start the child workflow from state method.
36+
* Only applicable for state methods (waitUntil or execute)
37+
*/
38+
public abstract Optional<String> getChildWorkflowRequestId();
2639
}

src/main/java/io/iworkflow/core/RPC.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
* Only used when workflow has enabled {@link PersistenceOptions} CachingPersistenceByMemo
3939
* By default, it's false for high throughput support
4040
* flip to true to bypass the caching for strong consistent reads
41+
* @return true if bypass caching for strong consistency
4142
*/
4243
boolean bypassCachingForStrongConsistency() default false;
4344
}

src/main/java/io/iworkflow/core/StateDecision.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public static <I> StateDecision singleNextState(final Class<? extends WorkflowSt
182182
* singleNextState as non-strongly typing required for input
183183
* @param stateClass required
184184
* @param stateInput optional, can be null
185-
* @return
185+
* @return state decision
186186
*/
187187
public static StateDecision singleNextStateUntypedInput(final Class<? extends WorkflowState> stateClass, final Object stateInput) {
188188
return singleNextState(stateClass.getSimpleName(), stateInput, null);

src/main/java/io/iworkflow/core/WorkerService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ private Context fromIdlContext(final io.iworkflow.gen.models.Context context, fi
388388
.workflowRunId(context.getWorkflowRunId())
389389
.workflowStartTimestampSeconds(context.getWorkflowStartedTimestamp())
390390
.stateExecutionId(Optional.ofNullable(context.getStateExecutionId()))
391+
.childWorkflowRequestId(context.getWorkflowRunId()+"-"+context.getStateExecutionId())
391392
.attempt(attempt)
392393
.firstAttemptTimestampSeconds(firstAttemptTimestamp)
393394
.build();

src/main/java/io/iworkflow/core/communication/Communication.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ public interface Communication {
1616
* trigger new state movements as the RPC results
1717
* NOTE: closing workflows like completing/failing are not supported
1818
* NOTE: Only used in RPC -- cannot be used in state APIs
19-
*
20-
* @param stateMovements
19+
* @param stateMovements the state movements to trigger
2120
*/
2221
void triggerStateMovements(final StateMovement... stateMovements);
2322
}

src/main/java/io/iworkflow/core/exceptions/NoRunningWorkflowException.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
import io.iworkflow.core.ClientSideException;
44

5-
public class NoRunningWorkflowException extends WorkflowNotExistsOrOpenException {
5+
/**
6+
* A friendly named exception to indicate that the workflow does not exist or exists but not running.
7+
* It's the same as {@link WorkflowNotExistsException} but with a different name.
8+
* It's subclass of {@link ClientSideException} with ErrorSubStatus.WORKFLOW_NOT_EXISTS_SUB_STATUS
9+
*/
10+
public class NoRunningWorkflowException extends WorkflowNotExistsException {
611
public NoRunningWorkflowException(
712
final ClientSideException exception) {
813
super(exception);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package io.iworkflow.core.exceptions;
2+
3+
import io.iworkflow.core.ClientSideException;
4+
5+
/**
6+
* A friendly named exception to indicate that the workflow does not exist
7+
* It's subclass of {@link ClientSideException} with ErrorSubStatus.WORKFLOW_NOT_EXISTS_SUB_STATUS
8+
*/
9+
public class WorkflowNotExistsException extends ClientSideException {
10+
public WorkflowNotExistsException(
11+
final ClientSideException exception) {
12+
super(exception);
13+
}
14+
}

src/main/java/io/iworkflow/core/exceptions/WorkflowNotExistsOrOpenException.java

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)