Class LegacyStateMachine
java.lang.Object
dev.restate.sdk.core.legacy.LegacyStateMachine
- All Implemented Interfaces:
StateMachine, AutoCloseable
Legacy pure-Java
StateMachine, used on JDK < 23 or when the native shared-core library
is unavailable/disabled. This is a deprecated fallback that will be removed in a future release;
the native (FFM) state machine is the path that supports the latest Restate features.-
Nested Class Summary
Nested classes/interfaces inherited from interface StateMachine
StateMachine.AwaitResult, StateMachine.Awakeable, StateMachine.CallHandle, StateMachine.Input, StateMachine.InvocationState, StateMachine.NotificationValue, StateMachine.RunResultHandle -
Constructor Summary
ConstructorsConstructorDescriptionLegacyStateMachine(HeadersAccessor headersAccessor, EndpointRequestHandler.LoggingContextSetter loggingContextSetter) -
Method Summary
Modifier and TypeMethodDescriptionintattachInvocation(String invocationId) call(Target target, Slice payload, @Nullable String idempotencyKey, @Nullable String scope, @Nullable String limitKey, @Nullable Collection<Map.Entry<String, String>> headers) voidcancelInvocation(String targetInvocationId) voidclose()voidcompleteAwakeable(String awakeableId, Slice value) voidcompleteAwakeable(String awakeableId, TerminalException exception) voidcompleteSignal(String targetInvocationId, String signalName, Slice value) voidcompleteSignal(String targetInvocationId, String signalName, TerminalException exception) intcreateSignalHandle(String signalName) doAwait(UnresolvedFuture future) Make progress on the still-uncompleted await tree rooted atfuture, or returnnullwhen nothing is left to await (every node already resolved).voidend()intgetInvocationOutput(String invocationId) input()booleanvoidnotifyError(Throwable throwable) voidnotifyInput(Slice bytes) Feed the next chunk of wire input.voidintpromiseComplete(String key, Slice value) intpromiseComplete(String key, TerminalException exception) intpromiseGet(String key) intpromisePeek(String key) voidproposeRunCompletion(int handle, Slice value) voidproposeRunCompletion(int handle, TerminalException terminalException) voidproposeRunCompletion(int handle, Throwable exception, Duration attemptDuration, @Nullable RetryPolicy retryPolicy) intsend(Target target, Slice payload, @Nullable String idempotencyKey, @Nullable String scope, @Nullable String limitKey, @Nullable Collection<Map.Entry<String, String>> headers, @Nullable Duration delay) intstate()voidstateClear(String key) voidintintvoid@Nullable StateMachine.NotificationValuetakeNotification(int handle) Drain the next chunk of serialized output ready for the wire, orSlice.EMPTYwhen nothing is buffered.voidwriteOutput(Slice value) voidwriteOutput(TerminalException exception)
-
Constructor Details
-
LegacyStateMachine
public LegacyStateMachine(HeadersAccessor headersAccessor, EndpointRequestHandler.LoggingContextSetter loggingContextSetter)
-
-
Method Details
-
notifyInput
Description copied from interface:StateMachineFeed the next chunk of wire input.- Specified by:
notifyInputin interfaceStateMachine
-
notifyInputClosed
public void notifyInputClosed()- Specified by:
notifyInputClosedin interfaceStateMachine
-
notifyError
- Specified by:
notifyErrorin interfaceStateMachine
-
takeOutput
Description copied from interface:StateMachineDrain the next chunk of serialized output ready for the wire, orSlice.EMPTYwhen nothing is buffered.- Specified by:
takeOutputin interfaceStateMachine
-
getResponseContentType
- Specified by:
getResponseContentTypein interfaceStateMachine
-
isReadyToExecute
public boolean isReadyToExecute()- Specified by:
isReadyToExecutein interfaceStateMachine
-
state
- Specified by:
statein interfaceStateMachine
-
doAwait
Description copied from interface:StateMachineMake progress on the still-uncompleted await tree rooted atfuture, or returnnullwhen nothing is left to await (every node already resolved).On suspension this does not return a value: it sneaky-throws
AbortedExecutionException, which should be treated as a clean abort of the user code, not a failure to re-report.- Specified by:
doAwaitin interfaceStateMachine
-
takeNotification
- Specified by:
takeNotificationin interfaceStateMachine
-
input
- Specified by:
inputin interfaceStateMachine
-
stateGet
- Specified by:
stateGetin interfaceStateMachine
-
stateGetKeys
public int stateGetKeys()- Specified by:
stateGetKeysin interfaceStateMachine
-
stateSet
- Specified by:
stateSetin interfaceStateMachine
-
stateClear
- Specified by:
stateClearin interfaceStateMachine
-
stateClearAll
public void stateClearAll()- Specified by:
stateClearAllin interfaceStateMachine
-
sleep
- Specified by:
sleepin interfaceStateMachine
-
call
public StateMachine.CallHandle call(Target target, Slice payload, @Nullable String idempotencyKey, @Nullable String scope, @Nullable String limitKey, @Nullable Collection<Map.Entry<String, String>> headers) - Specified by:
callin interfaceStateMachine
-
send
-
awakeable
- Specified by:
awakeablein interfaceStateMachine
-
completeAwakeable
- Specified by:
completeAwakeablein interfaceStateMachine
-
completeAwakeable
- Specified by:
completeAwakeablein interfaceStateMachine
-
createSignalHandle
- Specified by:
createSignalHandlein interfaceStateMachine
-
completeSignal
- Specified by:
completeSignalin interfaceStateMachine
-
completeSignal
public void completeSignal(String targetInvocationId, String signalName, TerminalException exception) - Specified by:
completeSignalin interfaceStateMachine
-
promiseGet
- Specified by:
promiseGetin interfaceStateMachine
-
promisePeek
- Specified by:
promisePeekin interfaceStateMachine
-
promiseComplete
- Specified by:
promiseCompletein interfaceStateMachine
-
promiseComplete
- Specified by:
promiseCompletein interfaceStateMachine
-
run
- Specified by:
runin interfaceStateMachine
-
proposeRunCompletion
- Specified by:
proposeRunCompletionin interfaceStateMachine
-
proposeRunCompletion
- Specified by:
proposeRunCompletionin interfaceStateMachine
-
proposeRunCompletion
public void proposeRunCompletion(int handle, Throwable exception, Duration attemptDuration, @Nullable RetryPolicy retryPolicy) - Specified by:
proposeRunCompletionin interfaceStateMachine
-
cancelInvocation
- Specified by:
cancelInvocationin interfaceStateMachine
-
attachInvocation
- Specified by:
attachInvocationin interfaceStateMachine
-
getInvocationOutput
- Specified by:
getInvocationOutputin interfaceStateMachine
-
writeOutput
- Specified by:
writeOutputin interfaceStateMachine
-
writeOutput
- Specified by:
writeOutputin interfaceStateMachine
-
end
public void end()- Specified by:
endin interfaceStateMachine
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceStateMachine
-