Class WorkflowInternal

java.lang.Object
io.temporal.internal.sync.WorkflowInternal

public final class WorkflowInternal extends Object
Never reference directly. It is public only because Java doesn't have internal package support.
  • Field Details

  • Method Details

    • newWorkflowMethodThread

      @Nonnull public static WorkflowThread newWorkflowMethodThread(Runnable runnable, String name)
    • newTimer

      public static Promise<Void> newTimer(Duration duration)
    • newTimer

      public static Promise<Void> newTimer(Duration duration, TimerOptions options)
    • newQueue

      @Deprecated public static <E> WorkflowQueue<E> newQueue(int capacity)
      Deprecated.
      this method created a deprecated implementation of the queue that has some methods implemented incorrectly. Please use newWorkflowQueue(int) instead.
      Parameters:
      capacity - the maximum size of the queue
      Returns:
      new instance of WorkflowQueue
    • newWorkflowQueue

      public static <E> WorkflowQueue<E> newWorkflowQueue(int capacity)
      Creates a WorkflowQueue implementation that can be used from workflow code.
      Parameters:
      capacity - the maximum size of the queue
      Returns:
      new instance of WorkflowQueue
    • newWorkflowLock

      public static WorkflowLock newWorkflowLock()
    • newWorkflowSemaphore

      public static WorkflowSemaphore newWorkflowSemaphore(int permits)
    • newCompletablePromise

      public static <E> CompletablePromise<E> newCompletablePromise()
    • newPromise

      public static <E> Promise<E> newPromise(E value)
    • newFailedPromise

      public static <E> Promise<E> newFailedPromise(Exception failure)
    • registerListener

      public static void registerListener(Object implementation)
      Register query or queries implementation object. There is no need to register top level workflow implementation object as it is done implicitly. Only methods annotated with @QueryMethod are registered. TODO(quinn) LIES!
    • currentTimeMillis

      public static long currentTimeMillis()
      Should be used to get current time instead of System.currentTimeMillis()
    • setDefaultActivityOptions

      public static void setDefaultActivityOptions(ActivityOptions activityOptions)
    • applyActivityOptions

      public static void applyActivityOptions(Map<String,ActivityOptions> activityTypeToOptions)
    • setDefaultLocalActivityOptions

      public static void setDefaultLocalActivityOptions(LocalActivityOptions localActivityOptions)
    • applyLocalActivityOptions

      public static void applyLocalActivityOptions(Map<String,LocalActivityOptions> activityTypeToOptions)
    • newActivityStub

      public static <T> T newActivityStub(Class<T> activityInterface, ActivityOptions options, Map<String,ActivityOptions> activityMethodOptions)
      Creates client stub to activities that implement given interface.
      Parameters:
      activityInterface - interface type implemented by activities
      options - options that together with the properties of ActivityMethod specify the activity invocation parameters
      activityMethodOptions - activity method-specific invocation parameters
    • newLocalActivityStub

      public static <T> T newLocalActivityStub(Class<T> activityInterface, LocalActivityOptions options, @Nullable Map<String,LocalActivityOptions> activityMethodOptions)
      Creates client stub to local activities that implement given interface.
      Parameters:
      activityInterface - interface type implemented by activities
      options - options that together with the properties of ActivityMethod specify the activity invocation parameters
      activityMethodOptions - activity method-specific invocation parameters
    • newUntypedActivityStub

      public static ActivityStub newUntypedActivityStub(ActivityOptions options)
    • newUntypedLocalActivityStub

      public static ActivityStub newUntypedLocalActivityStub(LocalActivityOptions options)
    • newChildWorkflowStub

      public static <T> T newChildWorkflowStub(Class<T> workflowInterface, ChildWorkflowOptions options)
    • newExternalWorkflowStub

      public static <T> T newExternalWorkflowStub(Class<T> workflowInterface, io.temporal.api.common.v1.WorkflowExecution execution)
    • getWorkflowExecution

      public static Promise<io.temporal.api.common.v1.WorkflowExecution> getWorkflowExecution(Object workflowStub)
    • newUntypedChildWorkflowStub

      public static ChildWorkflowStub newUntypedChildWorkflowStub(String workflowType, ChildWorkflowOptions options)
    • newUntypedExternalWorkflowStub

      public static ExternalWorkflowStub newUntypedExternalWorkflowStub(io.temporal.api.common.v1.WorkflowExecution execution)
    • newContinueAsNewStub

      public static <T> T newContinueAsNewStub(Class<T> workflowInterface, ContinueAsNewOptions options)
      Creates client stub that can be used to continue this workflow as new.
      Parameters:
      workflowInterface - interface type implemented by the next generation of workflow
    • executeActivity

      public static <R> R executeActivity(String name, ActivityOptions options, Class<R> resultClass, Type resultType, Object... args)
      Execute activity by name.
      Type Parameters:
      R - activity return type
      Parameters:
      name - name of the activity
      resultClass - activity return type
      args - list of activity arguments
      Returns:
      activity result
    • await

      public static void await(String reason, Supplier<Boolean> unblockCondition) throws DestroyWorkflowThreadError
      Throws:
      DestroyWorkflowThreadError
    • await

      public static boolean await(Duration timeout, String reason, Supplier<Boolean> unblockCondition) throws DestroyWorkflowThreadError
      Throws:
      DestroyWorkflowThreadError
    • sideEffect

      public static <R> R sideEffect(Class<R> resultClass, Type resultType, Functions.Func<R> func)
    • sideEffect

      public static <R> R sideEffect(Class<R> resultClass, Type resultType, Functions.Func<R> func, SideEffectOptions options)
    • mutableSideEffect

      public static <R> R mutableSideEffect(String id, Class<R> resultClass, Type resultType, BiPredicate<R,R> updated, Functions.Func<R> func)
    • mutableSideEffect

      public static <R> R mutableSideEffect(String id, Class<R> resultClass, Type resultType, BiPredicate<R,R> updated, Functions.Func<R> func, MutableSideEffectOptions options)
    • getVersion

      public static int getVersion(String changeId, int minSupported, int maxSupported)
    • promiseAllOf

      public static <V> Promise<Void> promiseAllOf(Iterable<Promise<V>> promises)
    • promiseAllOf

      public static Promise<Void> promiseAllOf(Promise<?>... promises)
    • promiseAnyOf

      public static <V> Promise<V> promiseAnyOf(Iterable<Promise<V>> promises)
    • promiseAnyOf

      public static Promise<Object> promiseAnyOf(Promise<?>... promises)
    • newCancellationScope

      public static CancellationScope newCancellationScope(boolean detached, Runnable runnable)
    • newCancellationScope

      public static CancellationScope newCancellationScope(boolean detached, Functions.Proc1<CancellationScope> proc)
    • currentCancellationScope

      public static io.temporal.internal.sync.CancellationScopeImpl currentCancellationScope()
    • wrap

      public static RuntimeException wrap(Throwable e)
    • unwrap

      public static Throwable unwrap(Throwable e)
    • isReplaying

      public static boolean isReplaying()
      Returns false if not under workflow code.
    • getMemo

      public static <T> T getMemo(String key, Class<T> valueClass, Type genericType)
    • retry

      public static <R> R retry(RetryOptions options, Optional<Duration> expiration, Functions.Func<R> fn)
    • continueAsNew

      public static void continueAsNew(@Nullable String workflowType, @Nullable ContinueAsNewOptions options, Object[] args)
    • continueAsNew

      public static void continueAsNew(@Nullable String workflowType, @Nullable ContinueAsNewOptions options, Object[] args, WorkflowOutboundCallsInterceptor outboundCallsInterceptor)
    • cancelWorkflow

      public static Promise<Void> cancelWorkflow(io.temporal.api.common.v1.WorkflowExecution execution)
    • cancelWorkflow

      public static Promise<Void> cancelWorkflow(io.temporal.api.common.v1.WorkflowExecution execution, @Nullable String reason)
    • sleep

      public static void sleep(Duration duration)
    • isWorkflowThread

      public static boolean isWorkflowThread()
    • deadlockDetectorOff

      public static <T> T deadlockDetectorOff(Functions.Func<T> func)
    • getWorkflowInfo

      public static WorkflowInfo getWorkflowInfo()
    • getCurrentUpdateInfo

      public static Optional<UpdateInfo> getCurrentUpdateInfo()
    • getMetricsScope

      public static com.uber.m3.tally.Scope getMetricsScope()
    • randomUUID

      public static UUID randomUUID()
    • newRandom

      public static Random newRandom()
    • getLogger

      public static org.slf4j.Logger getLogger(Class<?> clazz)
    • getLogger

      public static org.slf4j.Logger getLogger(String name)
    • getLastCompletionResult

      public static <R> R getLastCompletionResult(Class<R> resultClass, Type resultType)
    • getSearchAttribute

      @Nullable public static <T> T getSearchAttribute(String name)
    • getSearchAttributeValues

      @Nullable public static <T> List<T> getSearchAttributeValues(String name)
    • getSearchAttributes

      @Nonnull public static Map<String,List<?>> getSearchAttributes()
    • getTypedSearchAttributes

      @Nonnull public static SearchAttributes getTypedSearchAttributes()
    • upsertSearchAttributes

      public static void upsertSearchAttributes(Map<String,?> searchAttributes)
    • upsertTypedSearchAttributes

      public static void upsertTypedSearchAttributes(SearchAttributeUpdate<?>... searchAttributeUpdates)
    • upsertMemo

      public static void upsertMemo(Map<String,Object> memo)
    • getDataConverter

      public static DataConverter getDataConverter()
    • getWorkflowType

      public static String getWorkflowType(Class<?> workflowInterfaceClass)
      Name of the workflow type the interface defines. It is either the interface short name * or value of WorkflowMethod.name() parameter.
      Parameters:
      workflowInterfaceClass - interface annotated with @WorkflowInterface
    • getPreviousRunFailure

      public static Optional<Exception> getPreviousRunFailure()
    • isEveryHandlerFinished

      public static boolean isEveryHandlerFinished()
    • newNexusServiceStub

      public static <T> T newNexusServiceStub(Class<T> serviceInterface, NexusServiceOptions options)
    • newUntypedNexusServiceStub

      public static NexusServiceStub newUntypedNexusServiceStub(String service, NexusServiceOptions options)
    • startNexusOperation

      public static <T, R> NexusOperationHandle<R> startNexusOperation(Functions.Func1<T,R> operation, T arg)
    • startNexusOperation

      public static <R> NexusOperationHandle<R> startNexusOperation(Functions.Func<R> operation)
    • setCurrentDetails

      public static void setCurrentDetails(String details)
    • getCurrentDetails

      @Nullable public static String getCurrentDetails()
    • getInstance

      @Nullable public static Object getInstance()