Skip to content

Commit a49f141

Browse files
Handle workflowCompleted error in workflow service (#611)
1 parent 31a9c39 commit a49f141

File tree

5 files changed

+226
-60
lines changed

5 files changed

+226
-60
lines changed

src/main/java/com/uber/cadence/internal/sync/POJOActivityTaskHandler.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,13 @@ public Result handle(
189189
isLocalActivity);
190190
}
191191
if (metricsRateLimiter.tryAcquire(1)) {
192-
if (isLocalActivity) {
193-
metricsScope.gauge(MetricsType.LOCAL_ACTIVITY_ACTIVE_THREAD_COUNT).update(Thread.activeCount());
194-
} else {
195-
metricsScope.gauge(MetricsType.ACTIVITY_ACTIVE_THREAD_COUNT).update(Thread.activeCount());
196-
}
192+
if (isLocalActivity) {
193+
metricsScope
194+
.gauge(MetricsType.LOCAL_ACTIVITY_ACTIVE_THREAD_COUNT)
195+
.update(Thread.activeCount());
196+
} else {
197+
metricsScope.gauge(MetricsType.ACTIVITY_ACTIVE_THREAD_COUNT).update(Thread.activeCount());
198+
}
197199
}
198200
return activity.execute(activityTask, metricsScope);
199201
}

src/main/java/com/uber/cadence/internal/testservice/TestWorkflowMutableState.java

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,46 +64,57 @@ interface TestWorkflowMutableState {
6464
StartWorkflowExecutionRequest getStartRequest();
6565

6666
void startDecisionTask(PollForDecisionTaskResponse task, PollForDecisionTaskRequest pollRequest)
67-
throws InternalServiceError, EntityNotExistsError, BadRequestError;
67+
throws InternalServiceError, EntityNotExistsError, WorkflowExecutionAlreadyCompletedError,
68+
BadRequestError;
6869

6970
void completeDecisionTask(int historySize, RespondDecisionTaskCompletedRequest request)
70-
throws InternalServiceError, EntityNotExistsError, BadRequestError;
71+
throws InternalServiceError, EntityNotExistsError, WorkflowExecutionAlreadyCompletedError,
72+
BadRequestError;
7173

7274
void completeSignalExternalWorkflowExecution(String signalId, String runId)
73-
throws EntityNotExistsError, InternalServiceError, BadRequestError;
75+
throws EntityNotExistsError, InternalServiceError, WorkflowExecutionAlreadyCompletedError,
76+
BadRequestError;
7477

7578
void failSignalExternalWorkflowExecution(
7679
String signalId, SignalExternalWorkflowExecutionFailedCause cause)
77-
throws EntityNotExistsError, InternalServiceError, BadRequestError;
80+
throws EntityNotExistsError, InternalServiceError, WorkflowExecutionAlreadyCompletedError,
81+
BadRequestError;
7882

7983
void failDecisionTask(RespondDecisionTaskFailedRequest request)
8084
throws InternalServiceError, EntityNotExistsError, WorkflowExecutionAlreadyCompletedError,
8185
BadRequestError;
8286

8387
void childWorkflowStarted(ChildWorkflowExecutionStartedEventAttributes a)
84-
throws InternalServiceError, EntityNotExistsError, BadRequestError;
88+
throws InternalServiceError, EntityNotExistsError, WorkflowExecutionAlreadyCompletedError,
89+
BadRequestError;
8590

8691
void childWorkflowFailed(String workflowId, ChildWorkflowExecutionFailedEventAttributes a)
87-
throws InternalServiceError, EntityNotExistsError, BadRequestError;
92+
throws InternalServiceError, EntityNotExistsError, WorkflowExecutionAlreadyCompletedError,
93+
BadRequestError;
8894

8995
void childWorkflowTimedOut(String activityId, ChildWorkflowExecutionTimedOutEventAttributes a)
90-
throws InternalServiceError, EntityNotExistsError, BadRequestError;
96+
throws InternalServiceError, EntityNotExistsError, WorkflowExecutionAlreadyCompletedError,
97+
BadRequestError;
9198

9299
void failStartChildWorkflow(String workflowId, StartChildWorkflowExecutionFailedEventAttributes a)
93-
throws InternalServiceError, EntityNotExistsError, BadRequestError;
100+
throws InternalServiceError, EntityNotExistsError, WorkflowExecutionAlreadyCompletedError,
101+
BadRequestError;
94102

95103
void childWorkflowCompleted(String workflowId, ChildWorkflowExecutionCompletedEventAttributes a)
96-
throws InternalServiceError, EntityNotExistsError, BadRequestError;
104+
throws InternalServiceError, EntityNotExistsError, WorkflowExecutionAlreadyCompletedError,
105+
BadRequestError;
97106

98107
void childWorkflowCanceled(String workflowId, ChildWorkflowExecutionCanceledEventAttributes a)
99-
throws InternalServiceError, EntityNotExistsError, BadRequestError;
108+
throws InternalServiceError, EntityNotExistsError, WorkflowExecutionAlreadyCompletedError,
109+
BadRequestError;
100110

101111
void startWorkflow(
102112
boolean continuedAsNew, Optional<SignalWorkflowExecutionRequest> signalWithStartSignal)
103113
throws InternalServiceError, BadRequestError;
104114

105115
void startActivityTask(PollForActivityTaskResponse task, PollForActivityTaskRequest pollRequest)
106-
throws InternalServiceError, EntityNotExistsError, BadRequestError;
116+
throws InternalServiceError, EntityNotExistsError, WorkflowExecutionAlreadyCompletedError,
117+
BadRequestError;
107118

108119
void completeActivityTask(String activityId, RespondActivityTaskCompletedRequest request)
109120
throws InternalServiceError, EntityNotExistsError, WorkflowExecutionAlreadyCompletedError,

0 commit comments

Comments
 (0)