diff --git a/src/main/java/com/uber/cadence/internal/common/WorkflowExecutionUtils.java b/src/main/java/com/uber/cadence/internal/common/WorkflowExecutionUtils.java
index 5f37a16df..e32f912ae 100644
--- a/src/main/java/com/uber/cadence/internal/common/WorkflowExecutionUtils.java
+++ b/src/main/java/com/uber/cadence/internal/common/WorkflowExecutionUtils.java
@@ -389,42 +389,6 @@ public static boolean isWorkflowExecutionCompleteDecision(Decision decision) {
|| decision.getDecisionType() == DecisionType.ContinueAsNewWorkflowExecution));
}
- public static boolean isActivityTaskClosedEvent(HistoryEvent event) {
- return ((event != null)
- && (event.getEventType() == EventType.ActivityTaskCompleted
- || event.getEventType() == EventType.ActivityTaskCanceled
- || event.getEventType() == EventType.ActivityTaskFailed
- || event.getEventType() == EventType.ActivityTaskTimedOut));
- }
-
- public static boolean isExternalWorkflowClosedEvent(HistoryEvent event) {
- return ((event != null)
- && (event.getEventType() == EventType.ChildWorkflowExecutionCompleted
- || event.getEventType() == EventType.ChildWorkflowExecutionCanceled
- || event.getEventType() == EventType.ChildWorkflowExecutionFailed
- || event.getEventType() == EventType.ChildWorkflowExecutionTerminated
- || event.getEventType() == EventType.ChildWorkflowExecutionTimedOut));
- }
-
- public static WorkflowExecution getWorkflowIdFromExternalWorkflowCompletedEvent(
- HistoryEvent event) {
- if (event != null) {
- if (event.getEventType() == EventType.ChildWorkflowExecutionCompleted) {
- return event.getChildWorkflowExecutionCompletedEventAttributes().getWorkflowExecution();
- } else if (event.getEventType() == EventType.ChildWorkflowExecutionCanceled) {
- return event.getChildWorkflowExecutionCanceledEventAttributes().getWorkflowExecution();
- } else if (event.getEventType() == EventType.ChildWorkflowExecutionFailed) {
- return event.getChildWorkflowExecutionFailedEventAttributes().getWorkflowExecution();
- } else if (event.getEventType() == EventType.ChildWorkflowExecutionTerminated) {
- return event.getChildWorkflowExecutionTerminatedEventAttributes().getWorkflowExecution();
- } else if (event.getEventType() == EventType.ChildWorkflowExecutionTimedOut) {
- return event.getChildWorkflowExecutionTimedOutEventAttributes().getWorkflowExecution();
- }
- }
-
- return null;
- }
-
public static String getId(HistoryEvent historyEvent) {
String id = null;
if (historyEvent != null) {
@@ -436,67 +400,6 @@ public static String getId(HistoryEvent historyEvent) {
return id;
}
- public static String getFailureCause(HistoryEvent historyEvent) {
- String failureCause = null;
- if (historyEvent != null) {
- if (historyEvent.getEventType() == EventType.StartChildWorkflowExecutionFailed) {
- failureCause =
- historyEvent
- .getStartChildWorkflowExecutionFailedEventAttributes()
- .getCause()
- .toString();
- // } else if (historyEvent.getEventType() ==
- // EventType.SignalExternalWorkflowExecutionFailed) {
- // failureCause =
- // historyEvent.getSignalExternalWorkflowExecutionFailedEventAttributes().getCause();
- } else {
- failureCause = "Cannot extract failure cause from " + historyEvent.getEventType();
- }
- }
-
- return failureCause;
- }
-
- /**
- * Blocks until workflow instance completes. Never use in production setting as
- * polling for worklow instance status is an expensive operation.
- *
- * @param workflowExecution result of {@link
- * IWorkflowService#StartWorkflowExecution(StartWorkflowExecutionRequest)}
- * @return instance close status
- */
- public static WorkflowExecutionCloseStatus waitForWorkflowInstanceCompletion(
- IWorkflowService service, String domain, WorkflowExecution workflowExecution)
- throws EntityNotExistsError {
- try {
- return waitForWorkflowInstanceCompletion(
- service, domain, workflowExecution, 0, TimeUnit.MILLISECONDS);
- } catch (TimeoutException e) {
- throw new Error("should never happen", e);
- }
- }
-
- /**
- * Waits up to specified timeout for workflow instance completion. Never use in
- * production setting as polling for worklow instance status is an expensive operation.
- *
- * @param workflowExecution result of {@link
- * IWorkflowService#StartWorkflowExecution(StartWorkflowExecutionRequest)}
- * @param timeout maximum time to wait for completion. 0 means wait forever.
- * @return instance close status
- */
- public static WorkflowExecutionCloseStatus waitForWorkflowInstanceCompletion(
- IWorkflowService service,
- String domain,
- WorkflowExecution workflowExecution,
- long timeout,
- TimeUnit unit)
- throws TimeoutException, EntityNotExistsError {
- HistoryEvent closeEvent =
- getInstanceCloseEvent(service, domain, workflowExecution, timeout, unit);
- return getCloseStatus(closeEvent);
- }
-
public static WorkflowExecutionCloseStatus getCloseStatus(HistoryEvent event) {
switch (event.getEventType()) {
case WorkflowExecutionCanceled:
@@ -516,88 +419,6 @@ public static WorkflowExecutionCloseStatus getCloseStatus(HistoryEvent event) {
}
}
- /**
- * Like {@link #waitForWorkflowInstanceCompletion(IWorkflowService, String, WorkflowExecution,
- * long, TimeUnit)} , except will wait for continued generations of the original workflow
- * execution too.
- *
- * @see #waitForWorkflowInstanceCompletion(IWorkflowService, String, WorkflowExecution, long,
- * TimeUnit)
- */
- public static WorkflowExecutionCloseStatus waitForWorkflowInstanceCompletionAcrossGenerations(
- IWorkflowService service,
- String domain,
- WorkflowExecution workflowExecution,
- long timeout,
- TimeUnit unit)
- throws TimeoutException, EntityNotExistsError {
-
- WorkflowExecution lastExecutionToRun = workflowExecution;
- long millisecondsAtFirstWait = System.currentTimeMillis();
- WorkflowExecutionCloseStatus lastExecutionToRunCloseStatus =
- waitForWorkflowInstanceCompletion(service, domain, lastExecutionToRun, timeout, unit);
-
- // keep waiting if the instance continued as new
- while (lastExecutionToRunCloseStatus == WorkflowExecutionCloseStatus.CONTINUED_AS_NEW) {
- // get the new execution's information
- HistoryEvent closeEvent =
- getInstanceCloseEvent(service, domain, lastExecutionToRun, timeout, unit);
- WorkflowExecutionContinuedAsNewEventAttributes continuedAsNewAttributes =
- closeEvent.getWorkflowExecutionContinuedAsNewEventAttributes();
-
- WorkflowExecution newGenerationExecution = new WorkflowExecution();
- newGenerationExecution.setRunId(continuedAsNewAttributes.getNewExecutionRunId());
- newGenerationExecution.setWorkflowId(lastExecutionToRun.getWorkflowId());
-
- // and wait for it
- long currentTime = System.currentTimeMillis();
- long millisecondsSinceFirstWait = currentTime - millisecondsAtFirstWait;
- long timeoutInSecondsForNextWait =
- unit.toMillis(timeout) - (millisecondsSinceFirstWait / 1000L);
-
- lastExecutionToRunCloseStatus =
- waitForWorkflowInstanceCompletion(
- service,
- domain,
- newGenerationExecution,
- timeoutInSecondsForNextWait,
- TimeUnit.MILLISECONDS);
- lastExecutionToRun = newGenerationExecution;
- }
-
- return lastExecutionToRunCloseStatus;
- }
-
- /**
- * Like {@link #waitForWorkflowInstanceCompletion(IWorkflowService, String, WorkflowExecution,
- * long, TimeUnit)} , but with no timeout.*
- */
- public static WorkflowExecutionCloseStatus waitForWorkflowInstanceCompletionAcrossGenerations(
- IWorkflowService service, String domain, WorkflowExecution workflowExecution)
- throws InterruptedException, EntityNotExistsError {
- try {
- return waitForWorkflowInstanceCompletionAcrossGenerations(
- service, domain, workflowExecution, 0L, TimeUnit.MILLISECONDS);
- } catch (TimeoutException e) {
- throw new Error("should never happen", e);
- }
- }
-
- public static WorkflowExecutionInfo describeWorkflowInstance(
- IWorkflowService service, String domain, WorkflowExecution workflowExecution) {
- DescribeWorkflowExecutionRequest describeRequest = new DescribeWorkflowExecutionRequest();
- describeRequest.setDomain(domain);
- describeRequest.setExecution(workflowExecution);
- DescribeWorkflowExecutionResponse executionDetail = null;
- try {
- executionDetail = service.DescribeWorkflowExecution(describeRequest);
- } catch (TException e) {
- throw new RuntimeException(e);
- }
- WorkflowExecutionInfo instanceMetadata = executionDetail.getWorkflowExecutionInfo();
- return instanceMetadata;
- }
-
public static GetWorkflowExecutionHistoryResponse getHistoryPage(
byte[] nextPageToken,
IWorkflowService service,
@@ -621,26 +442,6 @@ public static GetWorkflowExecutionHistoryResponse getHistoryPage(
return history;
}
- /** Returns workflow instance history in a human readable format. */
- public static String prettyPrintHistory(
- IWorkflowService service, String domain, WorkflowExecution workflowExecution) {
- return prettyPrintHistory(service, domain, workflowExecution, true);
- }
- /**
- * Returns workflow instance history in a human readable format.
- *
- * @param showWorkflowTasks when set to false workflow task events (decider events) are not
- * included
- */
- public static String prettyPrintHistory(
- IWorkflowService service,
- String domain,
- WorkflowExecution workflowExecution,
- boolean showWorkflowTasks) {
- Iterator events = getHistory(service, domain, workflowExecution);
- return prettyPrintHistory(events, showWorkflowTasks);
- }
-
public static Iterator getHistory(
IWorkflowService service, String domain, WorkflowExecution workflowExecution) {
return new Iterator() {
diff --git a/src/main/java/com/uber/cadence/internal/replay/ActivityDecisionStateMachine.java b/src/main/java/com/uber/cadence/internal/replay/ActivityDecisionStateMachine.java
index 9b8579a63..6bb632078 100644
--- a/src/main/java/com/uber/cadence/internal/replay/ActivityDecisionStateMachine.java
+++ b/src/main/java/com/uber/cadence/internal/replay/ActivityDecisionStateMachine.java
@@ -33,15 +33,6 @@ public ActivityDecisionStateMachine(
this.scheduleAttributes = scheduleAttributes;
}
- /** Used for unit testing */
- ActivityDecisionStateMachine(
- DecisionId id,
- ScheduleActivityTaskDecisionAttributes scheduleAttributes,
- DecisionState state) {
- super(id, state);
- this.scheduleAttributes = scheduleAttributes;
- }
-
@Override
public Decision getDecision() {
switch (state) {
diff --git a/src/main/java/com/uber/cadence/internal/replay/ChildWorkflowDecisionStateMachine.java b/src/main/java/com/uber/cadence/internal/replay/ChildWorkflowDecisionStateMachine.java
index 83bbf500c..9b7499a67 100644
--- a/src/main/java/com/uber/cadence/internal/replay/ChildWorkflowDecisionStateMachine.java
+++ b/src/main/java/com/uber/cadence/internal/replay/ChildWorkflowDecisionStateMachine.java
@@ -33,15 +33,6 @@ public ChildWorkflowDecisionStateMachine(
this.startAttributes = startAttributes;
}
- /** Used for unit testing */
- ChildWorkflowDecisionStateMachine(
- DecisionId id,
- StartChildWorkflowExecutionDecisionAttributes startAttributes,
- DecisionState state) {
- super(id, state);
- this.startAttributes = startAttributes;
- }
-
@Override
public Decision getDecision() {
switch (state) {
diff --git a/src/main/java/com/uber/cadence/internal/replay/SignalDecisionStateMachine.java b/src/main/java/com/uber/cadence/internal/replay/SignalDecisionStateMachine.java
index bd1275763..7d0be827c 100644
--- a/src/main/java/com/uber/cadence/internal/replay/SignalDecisionStateMachine.java
+++ b/src/main/java/com/uber/cadence/internal/replay/SignalDecisionStateMachine.java
@@ -34,15 +34,6 @@ public SignalDecisionStateMachine(
this.attributes = attributes;
}
- /** Used for unit testing */
- SignalDecisionStateMachine(
- DecisionId id,
- SignalExternalWorkflowExecutionDecisionAttributes attributes,
- DecisionState state) {
- super(id, state);
- this.attributes = attributes;
- }
-
@Override
public Decision getDecision() {
switch (state) {
diff --git a/src/main/java/com/uber/cadence/internal/replay/TimerDecisionStateMachine.java b/src/main/java/com/uber/cadence/internal/replay/TimerDecisionStateMachine.java
index a4f4b8110..191d3132c 100644
--- a/src/main/java/com/uber/cadence/internal/replay/TimerDecisionStateMachine.java
+++ b/src/main/java/com/uber/cadence/internal/replay/TimerDecisionStateMachine.java
@@ -41,13 +41,6 @@ public TimerDecisionStateMachine(DecisionId id, StartTimerDecisionAttributes att
this.attributes = attributes;
}
- /** Used for unit testing */
- TimerDecisionStateMachine(
- DecisionId id, StartTimerDecisionAttributes attributes, DecisionState state) {
- super(id, state);
- this.attributes = attributes;
- }
-
@Override
public Decision getDecision() {
switch (state) {
diff --git a/src/main/java/com/uber/cadence/internal/sync/SimulatedTimeoutExceptionInternal.java b/src/main/java/com/uber/cadence/internal/sync/SimulatedTimeoutExceptionInternal.java
index 74ac9a88b..e98ad7192 100644
--- a/src/main/java/com/uber/cadence/internal/sync/SimulatedTimeoutExceptionInternal.java
+++ b/src/main/java/com/uber/cadence/internal/sync/SimulatedTimeoutExceptionInternal.java
@@ -34,11 +34,6 @@ final class SimulatedTimeoutExceptionInternal extends RuntimeException {
this.details = details;
}
- SimulatedTimeoutExceptionInternal(TimeoutType timeoutType) {
- this.timeoutType = timeoutType;
- this.details = null;
- }
-
TimeoutType getTimeoutType() {
return timeoutType;
}
diff --git a/src/main/java/com/uber/cadence/internal/sync/SyncWorkflowWorker.java b/src/main/java/com/uber/cadence/internal/sync/SyncWorkflowWorker.java
index 6691d4928..05e66e4f4 100644
--- a/src/main/java/com/uber/cadence/internal/sync/SyncWorkflowWorker.java
+++ b/src/main/java/com/uber/cadence/internal/sync/SyncWorkflowWorker.java
@@ -224,18 +224,6 @@ public boolean isSuspended() {
return workflowWorker.isSuspended() && laWorker.isSuspended() && ldaWorker.isSuspended();
}
- public R queryWorkflowExecution(
- WorkflowExecution execution,
- String queryType,
- Class resultClass,
- Type resultType,
- Object[] args)
- throws Exception {
- byte[] serializedArgs = dataConverter.toData(args);
- byte[] result = workflowWorker.queryWorkflowExecution(execution, queryType, serializedArgs);
- return dataConverter.fromData(result, resultClass, resultType);
- }
-
public R queryWorkflowExecution(
WorkflowExecutionHistory history,
String queryType,
diff --git a/src/main/java/com/uber/cadence/internal/sync/WorkflowInternal.java b/src/main/java/com/uber/cadence/internal/sync/WorkflowInternal.java
index bb67ed712..217195841 100644
--- a/src/main/java/com/uber/cadence/internal/sync/WorkflowInternal.java
+++ b/src/main/java/com/uber/cadence/internal/sync/WorkflowInternal.java
@@ -70,14 +70,6 @@ public static WorkflowThread newThread(boolean ignoreParentCancellation, Runnabl
return WorkflowThread.newThread(runnable, ignoreParentCancellation);
}
- public static WorkflowThread newThread(
- boolean ignoreParentCancellation, String name, Runnable runnable) {
- if (name == null) {
- throw new NullPointerException("name cannot be null");
- }
- return WorkflowThread.newThread(runnable, ignoreParentCancellation, name);
- }
-
public static Promise newTimer(Duration duration) {
return getWorkflowInterceptor().newTimer(duration);
}
@@ -228,26 +220,6 @@ public static T newContinueAsNewStub(
new ContinueAsNewWorkflowInvocationHandler(options, getWorkflowInterceptor()));
}
- /**
- * Execute activity by name.
- *
- * @param name name of the activity
- * @param resultClass activity return type
- * @param args list of activity arguments
- * @param activity return type
- * @return activity result
- */
- public static R executeActivity(
- String name, ActivityOptions options, Class resultClass, Type resultType, Object... args) {
- Promise result =
- getWorkflowInterceptor().executeActivity(name, resultClass, resultType, args, options);
- if (AsyncInternal.isAsync()) {
- AsyncInternal.setAsyncResult(result);
- return null; // ignored
- }
- return result.get();
- }
-
private static WorkflowInterceptor getWorkflowInterceptor() {
return DeterministicRunnerImpl.currentThreadInternal()
.getDecisionContext()
@@ -347,10 +319,6 @@ public static void continueAsNew(
decisionContext.continueAsNew(workflowType, options, args);
}
- public static Promise cancelWorkflow(WorkflowExecution execution) {
- return getWorkflowInterceptor().cancelWorkflow(execution);
- }
-
public static void sleep(Duration duration) {
getWorkflowInterceptor().sleep(duration);
}
diff --git a/src/main/java/com/uber/cadence/internal/sync/WorkflowRetryerInternal.java b/src/main/java/com/uber/cadence/internal/sync/WorkflowRetryerInternal.java
index 61f034cbb..23acb1766 100644
--- a/src/main/java/com/uber/cadence/internal/sync/WorkflowRetryerInternal.java
+++ b/src/main/java/com/uber/cadence/internal/sync/WorkflowRetryerInternal.java
@@ -32,21 +32,6 @@
*/
final class WorkflowRetryerInternal {
- /**
- * Retry procedure synchronously.
- *
- * @param options retry options.
- * @param proc procedure to retry.
- */
- public static void retry(RetryOptions options, Functions.Proc proc) {
- retry(
- options,
- () -> {
- proc.apply();
- return null;
- });
- }
-
public static R validateOptionsAndRetry(RetryOptions options, Functions.Func func) {
return retry(RetryOptions.merge(null, options), func);
}
diff --git a/src/main/java/com/uber/cadence/internal/worker/Throttler.java b/src/main/java/com/uber/cadence/internal/worker/Throttler.java
index 0d7d97776..db0a4dad1 100644
--- a/src/main/java/com/uber/cadence/internal/worker/Throttler.java
+++ b/src/main/java/com/uber/cadence/internal/worker/Throttler.java
@@ -85,12 +85,6 @@ public synchronized void setMaxRatePerSecond(double maxRatePerSecond) {
log.debug("new rate=" + maxRatePerSecond + " (msg/sec)");
}
- public synchronized void throttle(int count) throws InterruptedException {
- for (int i = 0; i < count; ++i) {
- throttle();
- }
- }
-
/**
* When called on each request sleeps if called faster then configured average rate.
*