Skip to content

chore: add Java external shard allocation factory#2954

Merged
He-Pin merged 1 commit intoapache:mainfrom
He-Pin:port-25dd5f7-external-shard-allocation-java-factory
May 9, 2026
Merged

chore: add Java external shard allocation factory#2954
He-Pin merged 1 commit intoapache:mainfrom
He-Pin:port-25dd5f7-external-shard-allocation-java-factory

Conversation

@He-Pin
Copy link
Copy Markdown
Member

@He-Pin He-Pin commented May 9, 2026

Motivation

Port upstream A commit akka/akka-core@25dd5f7, which is now Apache licensed. Java users should be able to create an ExternalShardAllocationStrategy with 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 / 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

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>
@He-Pin He-Pin marked this pull request as ready for review May 9, 2026 15:31
Copy link
Copy Markdown
Member

@pjfanning pjfanning left a comment

Choose a reason for hiding this comment

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

lgtm

@He-Pin He-Pin merged commit d4df90c into apache:main May 9, 2026
9 checks passed
@He-Pin He-Pin deleted the port-25dd5f7-external-shard-allocation-java-factory branch May 9, 2026 16:18
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.

2 participants