Skip to content

Remove streamsupport-minifuture dependency - #107

Merged
FZambia merged 1 commit into
centrifugal:masterfrom
IliaKazakov:remove-streamsupport-minifuture
Nov 10, 2026
Merged

FZambia merged 1 commit into
centrifugal:masterfrom
IliaKazakov:remove-streamsupport-minifuture

Conversation

@IliaKazakov

Copy link
Copy Markdown
Contributor

What changed

Client and Subscription no longer use java8.util.concurrent.CompletableFuture from streamsupport-minifuture.
Pending calls now use a small package-private CallFuture: it completes once, with a result or an error, and notifies one listener on the completing thread (or at once, if the future is already done).
The dependency is removed from centrifuge/build.gradle, and the README note about excluding it is removed.

Why

streamsupport-minifuture is licensed under GPL-2.0 with the Classpath Exception. Companies that cannot ship GPL code have to exclude it and replace the classes that the SDK calls. The SDK needs only one-shot completion and a single listener, so the dependency is not necessary.

  • No new dependencies. CallFuture uses only synchronized, so the supported Android versions do not change. java.util.concurrent.CompletableFuture (API 24+) is still not required.
  • No public API change: metalavaCheckCompatibility passes, and the production API signature is the same as on master.
  • Callbacks receive the same errors as before. The removed CompletionException unwrap in settle was unreachable, because futures are always completed directly.

Tests

  • ./gradlew :centrifuge:test: 109 passed, including 6 new CallFutureTest cases. One of them is a complete vs completeExceptionally race over 1000 iterations.
  • ./gradlew :centrifuge:integrationTest: 33 passed against Centrifugo v6 from docker-compose.yml.

- Replace java8 `CompletableFuture` with a package-private `CallFuture` in `Client` and `Subscription`
- Remove the `streamsupport-minifuture` dependency from `build.gradle`
- Remove the `README` note about excluding minifuture
- Update comments that mention `orTimeout` and `CompletableFuture`
- Add `CallFutureTest`
- Add a changelog entry
@FZambia
FZambia merged commit 4b5984b into centrifugal:master Nov 10, 2026
6 checks passed
@FZambia

FZambia commented Nov 10, 2026

Copy link
Copy Markdown
Member

@IliaKazakov hi, many thanks!

I did a small follow-up - #108 - if you don't see nothing wrong with it I'll merge and make a release. Please take a look.

FZambia added a commit that referenced this pull request Nov 10, 2026
* CallFuture follow-up: Consumer error handlers, accurate failure-path comments

Error handlers passed to Client.settle are now CallFuture.Consumer<Throwable>
instead of Function<Throwable, Void>, dropping the 'return null;' at every
call site and the Function interface.

Fix comments left over from #107: the connect timeout fails the future on
the executor (the scheduler timer hops there first), and the connect error
handler still defers to a separate executor task because a failure from
failPendingCalls() arrives in the middle of processDisconnect.

* CallFuture: reject a second listener even once the future is done

The guard checked the listener field, which is never set for a listener
registered after completion and is cleared on settle, so a second
listener was rejected only while the future was pending.
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