Package dev.restate.sdk
Class HandlerRunner.Options
java.lang.Object
dev.restate.sdk.HandlerRunner.Options
- All Implemented Interfaces:
HandlerRunner.Options
- Enclosing class:
HandlerRunner<REQ,RES>
HandlerRunner options. You can override the default options to configure the executor
where to run the handlers.
You can run on virtual threads by using the executor
Executors.newVirtualThreadPerTaskExecutor().
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HandlerRunner.OptionsDefault options will use virtual threads on Java 21+, or fallback toExecutors.newCachedThreadPool()for Java < 21. -
Method Summary
Modifier and TypeMethodDescriptionstatic HandlerRunner.OptionswithExecutor(Executor executor) Create an instance ofHandlerRunner.Optionswith the givenexecutor.
-
Field Details
-
DEFAULT
Default options will use virtual threads on Java 21+, or fallback toExecutors.newCachedThreadPool()for Java < 21. The bounded pool is shared among allHandlerRunnerinstances, and is used byRestate.run(java.lang.String, java.lang.Class<T>, dev.restate.common.function.ThrowingSupplier<T>)/Context.run(java.lang.String, java.lang.Class<T>, dev.restate.common.function.ThrowingSupplier<T>)as well.
-
-
Method Details
-
withExecutor
Create an instance ofHandlerRunner.Optionswith the givenexecutor.The given executor is used for running the handler code, and
Restate.run(java.lang.String, java.lang.Class<T>, dev.restate.common.function.ThrowingSupplier<T>)/Context.run(java.lang.String, java.lang.Class<T>, dev.restate.common.function.ThrowingSupplier<T>)as well.
-