Skip to content

[Fix #1408] Do not rely on ServiceLoader instance creation#1409

Merged
fjtirado merged 1 commit into
serverlessworkflow:mainfrom
fjtirado:Fix_#1408
May 28, 2026
Merged

[Fix #1408] Do not rely on ServiceLoader instance creation#1409
fjtirado merged 1 commit into
serverlessworkflow:mainfrom
fjtirado:Fix_#1408

Conversation

@fjtirado
Copy link
Copy Markdown
Collaborator

Fix #1408

Copilot AI review requested due to automatic review settings May 28, 2026 10:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors callable task construction to avoid shared mutable state in ServiceLoader-provided CallableTaskBuilder instances, addressing flaky behavior when multiple call tasks use the same builder type.

Changes:

  • Replaces the init() + build() builder lifecycle with init() returning a CallableTaskFactory.
  • Updates core, HTTP, OpenAPI, gRPC, and experimental Java function builders to capture per-task state in returned factories.
  • Materializes callable task builders from ServiceLoader once and improves the unsupported-task error message.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
impl/core/src/main/java/io/serverlessworkflow/impl/executors/CallableTaskFactory.java Adds factory interface for producing callable tasks.
impl/core/src/main/java/io/serverlessworkflow/impl/executors/CallableTaskBuilder.java Changes builder SPI to return a factory from init.
impl/core/src/main/java/io/serverlessworkflow/impl/executors/CallTaskExecutor.java Uses the returned factory to create callable tasks.
impl/core/src/main/java/io/serverlessworkflow/impl/executors/DefaultTaskExecutorFactory.java Eagerly materializes ServiceLoader builders and updates lookup error text.
impl/core/src/main/java/io/serverlessworkflow/impl/executors/CallFunctionExecutorBuilder.java Refactors call-function builder state into local factory captures.
impl/http/src/main/java/io/serverlessworkflow/impl/executors/http/CallableTaskHttpExecutorBuilder.java Refactors HTTP call builder to return a per-task factory.
impl/openapi/src/main/java/io/serverlessworkflow/impl/executors/openapi/OpenAPIExecutorBuilder.java Refactors OpenAPI call builder to return a per-task factory.
impl/grpc/src/main/java/io/serverlessworkflow/impl/executors/grpc/GrpcExecutorBuilder.java Refactors gRPC call builder to return a per-task factory.
experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaConsumerCallExecutorBuilder.java Refactors Java consumer call builder to return a factory.
experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaContextFunctionCallExecutorBuilder.java Refactors Java context function builder to return a factory.
experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaFilterFunctionCallExecutorBuilder.java Refactors Java filter function builder to return a factory.
experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaFunctionCallExecutorBuilder.java Refactors Java function builder to return a factory.
experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaLoopFunctionCallExecutorBuilder.java Refactors Java loop function builder to return a factory.
experimental/lambda/src/main/java/io/serverlessworkflow/impl/executors/func/JavaLoopFunctionIndexCallExecutorBuilder.java Refactors Java indexed loop function builder to return a factory.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…reation

Signed-off-by: fjtirado <ftirados@redhat.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.

@fjtirado fjtirado merged commit cb713b5 into serverlessworkflow:main May 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky test due to a java.lang.UnsupportedOperationException

3 participants