Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/main/idls
Submodule idls updated from 615f1c to b1a9b9
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Modifications copyright (C) 2017 Uber Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. A copy of the License is
* located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

package com.uber.cadence.client;

import com.uber.cadence.WorkflowExecution;
import java.util.Optional;

/**
* Thrown when workflow already completed its execution and when the client is trying to run an
* operation on the workflow like signal, terminate, cancel, poll etc.
*/
public final class WorkflowAlreadyCompletedException extends WorkflowException {

public WorkflowAlreadyCompletedException(
WorkflowExecution execution, Optional<String> workflowType, String message) {
super(message, execution, workflowType, null);
}
}
2 changes: 1 addition & 1 deletion src/main/java/com/uber/cadence/internal/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class Version {
* support. This can be used for client capibility check, on Cadence server, for backward
* compatibility Format: MAJOR.MINOR.PATCH
*/
public static final String FEATURE_VERSION = "1.3.0";
public static final String FEATURE_VERSION = "1.4.0";

static {
// Load version from version.properties generated by Gradle into build/resources/main directory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.uber.cadence.DomainNotActiveError;
import com.uber.cadence.EntityNotExistsError;
import com.uber.cadence.QueryFailedError;
import com.uber.cadence.WorkflowExecutionAlreadyCompletedError;
import com.uber.cadence.WorkflowExecutionAlreadyStartedError;
import com.uber.cadence.common.RetryOptions;
import java.time.Duration;
Expand Down Expand Up @@ -59,6 +60,7 @@ public final class RpcRetryer {
roBuilder.setDoNotRetry(
BadRequestError.class,
EntityNotExistsError.class,
WorkflowExecutionAlreadyCompletedError.class,
WorkflowExecutionAlreadyStartedError.class,
DomainAlreadyExistsError.class,
QueryFailedError.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.uber.cadence.RespondActivityTaskFailedByIDRequest;
import com.uber.cadence.RespondActivityTaskFailedRequest;
import com.uber.cadence.WorkflowExecution;
import com.uber.cadence.WorkflowExecutionAlreadyCompletedError;
import com.uber.cadence.client.ActivityCancelledException;
import com.uber.cadence.client.ActivityCompletionFailureException;
import com.uber.cadence.client.ActivityNotExistsException;
Expand Down Expand Up @@ -99,6 +100,8 @@ public void complete(Object result) {
metricsScope.counter(MetricsType.ACTIVITY_TASK_COMPLETED_COUNTER).inc(1);
} catch (EntityNotExistsError e) {
throw new ActivityNotExistsException(e);
} catch (WorkflowExecutionAlreadyCompletedError e) {
throw new ActivityNotExistsException(e);
} catch (TException e) {
throw new ActivityCompletionFailureException(e);
}
Expand All @@ -119,6 +122,8 @@ public void complete(Object result) {
metricsScope.counter(MetricsType.ACTIVITY_TASK_COMPLETED_BY_ID_COUNTER).inc(1);
} catch (EntityNotExistsError e) {
throw new ActivityNotExistsException(e);
} catch (WorkflowExecutionAlreadyCompletedError e) {
throw new ActivityNotExistsException(e);
} catch (TException e) {
throw new ActivityCompletionFailureException(activityId, e);
}
Expand All @@ -141,6 +146,8 @@ public void fail(Throwable failure) {
metricsScope.counter(MetricsType.ACTIVITY_TASK_FAILED_COUNTER).inc(1);
} catch (EntityNotExistsError e) {
throw new ActivityNotExistsException(e);
} catch (WorkflowExecutionAlreadyCompletedError e) {
throw new ActivityNotExistsException(e);
} catch (TException e) {
throw new ActivityCompletionFailureException(e);
}
Expand All @@ -156,6 +163,8 @@ public void fail(Throwable failure) {
metricsScope.counter(MetricsType.ACTIVITY_TASK_FAILED_BY_ID_COUNTER).inc(1);
} catch (EntityNotExistsError e) {
throw new ActivityNotExistsException(e);
} catch (WorkflowExecutionAlreadyCompletedError e) {
throw new ActivityNotExistsException(e);
} catch (TException e) {
throw new ActivityCompletionFailureException(activityId, e);
}
Expand All @@ -176,6 +185,8 @@ public void recordHeartbeat(Object details) throws CancellationException {
}
} catch (EntityNotExistsError e) {
throw new ActivityNotExistsException(e);
} catch (WorkflowExecutionAlreadyCompletedError e) {
throw new ActivityNotExistsException(e);
} catch (TException e) {
throw new ActivityCompletionFailureException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.uber.cadence.RecordActivityTaskHeartbeatRequest;
import com.uber.cadence.RecordActivityTaskHeartbeatResponse;
import com.uber.cadence.WorkflowExecution;
import com.uber.cadence.WorkflowExecutionAlreadyCompletedError;
import com.uber.cadence.activity.ActivityTask;
import com.uber.cadence.client.ActivityCancelledException;
import com.uber.cadence.client.ActivityCompletionException;
Expand Down Expand Up @@ -176,6 +177,8 @@ private void sendHeartbeatRequest(Object details) throws TException {
}
} catch (EntityNotExistsError e) {
lastException = new ActivityNotExistsException(task, e);
} catch (WorkflowExecutionAlreadyCompletedError e) {
throw new ActivityNotExistsException(task, e);
} catch (BadRequestError e) {
lastException = new ActivityCompletionFailureException(task, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ private WorkflowServiceWrapper(IWorkflowService impl) {
@Override
public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat(
RecordActivityTaskHeartbeatRequest heartbeatRequest)
throws BadRequestError, InternalServiceError, EntityNotExistsError, TException {
throws BadRequestError, InternalServiceError, EntityNotExistsError,
WorkflowExecutionAlreadyCompletedError, TException {
if (activityHeartbetListener != null) {
Object details =
testEnvironmentOptions
Expand All @@ -355,60 +356,68 @@ public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat(
@Override
public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeatByID(
RecordActivityTaskHeartbeatByIDRequest heartbeatRequest)
throws BadRequestError, InternalServiceError, EntityNotExistsError, DomainNotActiveError,
LimitExceededError, ServiceBusyError, TException {
throws BadRequestError, InternalServiceError, EntityNotExistsError,
WorkflowExecutionAlreadyCompletedError, DomainNotActiveError, LimitExceededError,
ServiceBusyError, TException {
return impl.RecordActivityTaskHeartbeatByID(heartbeatRequest);
}

@Override
public void RespondActivityTaskCompleted(RespondActivityTaskCompletedRequest completeRequest)
throws BadRequestError, InternalServiceError, EntityNotExistsError, TException {
throws BadRequestError, InternalServiceError, EntityNotExistsError,
WorkflowExecutionAlreadyCompletedError, TException {
impl.RespondActivityTaskCompleted(completeRequest);
}

@Override
public void RespondActivityTaskCompletedByID(
RespondActivityTaskCompletedByIDRequest completeRequest)
throws BadRequestError, InternalServiceError, EntityNotExistsError, TException {
throws BadRequestError, InternalServiceError, EntityNotExistsError,
WorkflowExecutionAlreadyCompletedError, TException {
impl.RespondActivityTaskCompletedByID(completeRequest);
}

@Override
public void RespondActivityTaskFailed(RespondActivityTaskFailedRequest failRequest)
throws BadRequestError, InternalServiceError, EntityNotExistsError, TException {
throws BadRequestError, InternalServiceError, EntityNotExistsError,
WorkflowExecutionAlreadyCompletedError, TException {
impl.RespondActivityTaskFailed(failRequest);
}

@Override
public void RespondActivityTaskFailedByID(RespondActivityTaskFailedByIDRequest failRequest)
throws BadRequestError, InternalServiceError, EntityNotExistsError, TException {
throws BadRequestError, InternalServiceError, EntityNotExistsError,
WorkflowExecutionAlreadyCompletedError, TException {
impl.RespondActivityTaskFailedByID(failRequest);
}

@Override
public void RespondActivityTaskCanceled(RespondActivityTaskCanceledRequest canceledRequest)
throws BadRequestError, InternalServiceError, EntityNotExistsError, TException {
throws BadRequestError, InternalServiceError, EntityNotExistsError,
WorkflowExecutionAlreadyCompletedError, TException {
impl.RespondActivityTaskCanceled(canceledRequest);
}

@Override
public void RespondActivityTaskCanceledByID(
RespondActivityTaskCanceledByIDRequest canceledRequest)
throws BadRequestError, InternalServiceError, EntityNotExistsError, TException {
throws BadRequestError, InternalServiceError, EntityNotExistsError,
WorkflowExecutionAlreadyCompletedError, TException {
impl.RespondActivityTaskCanceledByID(canceledRequest);
}

@Override
public void RequestCancelWorkflowExecution(RequestCancelWorkflowExecutionRequest cancelRequest)
throws BadRequestError, InternalServiceError, EntityNotExistsError,
CancellationAlreadyRequestedError, ServiceBusyError, TException {
CancellationAlreadyRequestedError, ServiceBusyError,
WorkflowExecutionAlreadyCompletedError, TException {
impl.RequestCancelWorkflowExecution(cancelRequest);
}

@Override
public void SignalWorkflowExecution(SignalWorkflowExecutionRequest signalRequest)
throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError,
TException {
throws BadRequestError, InternalServiceError, EntityNotExistsError,
WorkflowExecutionAlreadyCompletedError, ServiceBusyError, TException {
impl.SignalWorkflowExecution(signalRequest);
}

Expand All @@ -431,8 +440,8 @@ public ResetWorkflowExecutionResponse ResetWorkflowExecution(

@Override
public void TerminateWorkflowExecution(TerminateWorkflowExecutionRequest terminateRequest)
throws BadRequestError, InternalServiceError, EntityNotExistsError, ServiceBusyError,
TException {
throws BadRequestError, InternalServiceError, EntityNotExistsError,
WorkflowExecutionAlreadyCompletedError, ServiceBusyError, TException {
impl.TerminateWorkflowExecution(terminateRequest);
}

Expand Down Expand Up @@ -492,7 +501,8 @@ public GetSearchAttributesResponse GetSearchAttributes()

@Override
public void RespondQueryTaskCompleted(RespondQueryTaskCompletedRequest completeRequest)
throws BadRequestError, InternalServiceError, EntityNotExistsError, TException {
throws BadRequestError, InternalServiceError, EntityNotExistsError,
WorkflowExecutionAlreadyCompletedError, TException {
impl.RespondQueryTaskCompleted(completeRequest);
}

Expand Down Expand Up @@ -882,13 +892,15 @@ public PollForDecisionTaskResponse PollForDecisionTask(PollForDecisionTaskReques
@Override
public RespondDecisionTaskCompletedResponse RespondDecisionTaskCompleted(
RespondDecisionTaskCompletedRequest completeRequest)
throws BadRequestError, InternalServiceError, EntityNotExistsError, TException {
throws BadRequestError, InternalServiceError, EntityNotExistsError,
WorkflowExecutionAlreadyCompletedError, TException {
return impl.RespondDecisionTaskCompleted(completeRequest);
}

@Override
public void RespondDecisionTaskFailed(RespondDecisionTaskFailedRequest failedRequest)
throws BadRequestError, InternalServiceError, EntityNotExistsError, TException {
throws BadRequestError, InternalServiceError, EntityNotExistsError,
WorkflowExecutionAlreadyCompletedError, TException {
impl.RespondDecisionTaskFailed(failedRequest);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
import com.uber.cadence.UpdateDomainRequest;
import com.uber.cadence.UpdateDomainResponse;
import com.uber.cadence.WorkflowExecution;
import com.uber.cadence.WorkflowExecutionAlreadyCompletedError;
import com.uber.cadence.WorkflowExecutionAlreadyStartedError;
import com.uber.cadence.client.ActivityCompletionClient;
import com.uber.cadence.client.WorkflowClient;
Expand Down Expand Up @@ -764,13 +765,15 @@ public PollForDecisionTaskResponse PollForDecisionTask(PollForDecisionTaskReques
@Override
public RespondDecisionTaskCompletedResponse RespondDecisionTaskCompleted(
RespondDecisionTaskCompletedRequest completeRequest)
throws BadRequestError, InternalServiceError, EntityNotExistsError, TException {
throws BadRequestError, InternalServiceError, EntityNotExistsError,
WorkflowExecutionAlreadyCompletedError, TException {
return impl.RespondDecisionTaskCompleted(completeRequest);
}

@Override
public void RespondDecisionTaskFailed(RespondDecisionTaskFailedRequest failedRequest)
throws BadRequestError, InternalServiceError, EntityNotExistsError, TException {
throws BadRequestError, InternalServiceError, EntityNotExistsError,
WorkflowExecutionAlreadyCompletedError, TException {
impl.RespondDecisionTaskFailed(failedRequest);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.uber.cadence.QueryRejectCondition;
import com.uber.cadence.QueryWorkflowResponse;
import com.uber.cadence.WorkflowExecution;
import com.uber.cadence.WorkflowExecutionAlreadyCompletedError;
import com.uber.cadence.WorkflowExecutionAlreadyStartedError;
import com.uber.cadence.WorkflowType;
import com.uber.cadence.client.*;
Expand Down Expand Up @@ -390,6 +391,9 @@ private <R> R mapToWorkflowFailureException(
execution.get(), workflowType, executionFailed.getDecisionTaskCompletedEventId(), cause);
} else if (failure instanceof EntityNotExistsError) {
throw new WorkflowNotFoundException(execution.get(), workflowType, failure.getMessage());
} else if (failure instanceof WorkflowExecutionAlreadyCompletedError) {
throw new WorkflowAlreadyCompletedException(
execution.get(), workflowType, failure.getMessage());
} else if (failure instanceof CancellationException) {
throw (CancellationException) failure;
} else if (failure instanceof WorkflowException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import com.uber.cadence.StartChildWorkflowExecutionFailedEventAttributes;
import com.uber.cadence.StartWorkflowExecutionRequest;
import com.uber.cadence.StickyExecutionAttributes;
import com.uber.cadence.WorkflowExecutionAlreadyCompletedError;
import com.uber.cadence.WorkflowExecutionCloseStatus;
import com.uber.cadence.internal.testservice.TestWorkflowMutableStateImpl.QueryId;
import java.util.Optional;
Expand Down Expand Up @@ -76,7 +77,8 @@ void failSignalExternalWorkflowExecution(
throws EntityNotExistsError, InternalServiceError, BadRequestError;

void failDecisionTask(RespondDecisionTaskFailedRequest request)
throws InternalServiceError, EntityNotExistsError, BadRequestError;
throws InternalServiceError, EntityNotExistsError, WorkflowExecutionAlreadyCompletedError,
BadRequestError;

void childWorkflowStarted(ChildWorkflowExecutionStartedEventAttributes a)
throws InternalServiceError, EntityNotExistsError, BadRequestError;
Expand Down Expand Up @@ -104,34 +106,44 @@ void startActivityTask(PollForActivityTaskResponse task, PollForActivityTaskRequ
throws InternalServiceError, EntityNotExistsError, BadRequestError;

void completeActivityTask(String activityId, RespondActivityTaskCompletedRequest request)
throws InternalServiceError, EntityNotExistsError, BadRequestError;
throws InternalServiceError, EntityNotExistsError, WorkflowExecutionAlreadyCompletedError,
BadRequestError;

void completeActivityTaskById(String activityId, RespondActivityTaskCompletedByIDRequest request)
throws InternalServiceError, EntityNotExistsError, BadRequestError;
throws InternalServiceError, EntityNotExistsError, WorkflowExecutionAlreadyCompletedError,
BadRequestError;

void failActivityTask(String activityId, RespondActivityTaskFailedRequest request)
throws InternalServiceError, EntityNotExistsError, BadRequestError;
throws InternalServiceError, EntityNotExistsError, WorkflowExecutionAlreadyCompletedError,
BadRequestError;

void failActivityTaskById(String id, RespondActivityTaskFailedByIDRequest failRequest)
throws EntityNotExistsError, InternalServiceError, BadRequestError;
throws EntityNotExistsError, InternalServiceError, WorkflowExecutionAlreadyCompletedError,
BadRequestError;

RecordActivityTaskHeartbeatResponse heartbeatActivityTask(String activityId, byte[] details)
throws InternalServiceError, EntityNotExistsError, BadRequestError;
throws InternalServiceError, EntityNotExistsError, WorkflowExecutionAlreadyCompletedError,
BadRequestError;

void signal(SignalWorkflowExecutionRequest signalRequest)
throws EntityNotExistsError, InternalServiceError, BadRequestError;
throws EntityNotExistsError, InternalServiceError, WorkflowExecutionAlreadyCompletedError,
BadRequestError;

void signalFromWorkflow(SignalExternalWorkflowExecutionDecisionAttributes a)
throws EntityNotExistsError, InternalServiceError, BadRequestError;
throws EntityNotExistsError, InternalServiceError, WorkflowExecutionAlreadyCompletedError,
BadRequestError;

void requestCancelWorkflowExecution(RequestCancelWorkflowExecutionRequest cancelRequest)
throws EntityNotExistsError, InternalServiceError, BadRequestError;
throws EntityNotExistsError, InternalServiceError, WorkflowExecutionAlreadyCompletedError,
BadRequestError;

void cancelActivityTask(String id, RespondActivityTaskCanceledRequest canceledRequest)
throws EntityNotExistsError, InternalServiceError, BadRequestError;
throws EntityNotExistsError, InternalServiceError, WorkflowExecutionAlreadyCompletedError,
BadRequestError;

void cancelActivityTaskById(String id, RespondActivityTaskCanceledByIDRequest canceledRequest)
throws EntityNotExistsError, InternalServiceError, BadRequestError;
throws EntityNotExistsError, InternalServiceError, WorkflowExecutionAlreadyCompletedError,
BadRequestError;

QueryWorkflowResponse query(QueryWorkflowRequest queryRequest) throws TException;

Expand Down
Loading