chore: add Java external shard allocation factory#2954
Merged
He-Pin merged 1 commit intoapache:mainfrom May 9, 2026
Merged
Conversation
Motivation: Upstream commit akka/akka-core@25dd5f7, which is now Apache licensed, added a Java factory for external shard allocation without requiring callers to pass the default timeout explicitly. Modification: Add the Java API create(systemProvider, typeName) overload and update the Java compile-only example to use it. Result: Java users get parity with the Scala factory that uses the default timeout. Tests: - git diff --check / passed - scalafmt --mode diff-ref=origin/main / passed - scalafmt --list --mode diff-ref=origin/main / passed - JDK 17 sbt "cluster-sharding-typed / javafmtAll" / passed - sbt "cluster-sharding / Test / compile" "cluster-sharding-typed / Test / compile" "cluster-sharding / mimaReportBinaryIssues" / passed - sbt "+ cluster-sharding / mimaReportBinaryIssues" / passed References: Refs akka/akka-core@25dd5f7 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Port upstream A commit akka/akka-core@25dd5f7, which is now Apache licensed. Java users should be able to create an
ExternalShardAllocationStrategywith the default timeout just like the Scala API.Modification
Added
ExternalShardAllocationStrategy.create(systemProvider, typeName)for Java callers and updated the Java compile-only example to use it.Result
Java and Scala factory APIs are aligned for the default-timeout case. Existing timeout-taking APIs remain unchanged.
Tests
git diff --check/ passedscalafmt --mode diff-ref=origin/main/ passedscalafmt --list --mode diff-ref=origin/main/ passedsbt "cluster-sharding-typed / javafmtAll"/ passedsbt "cluster-sharding / Test / compile" "cluster-sharding-typed / Test / compile" "cluster-sharding / mimaReportBinaryIssues"/ passedsbt "+ cluster-sharding / mimaReportBinaryIssues"/ passedReferences
Refs akka/akka-core@25dd5f7