Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Full Circle: Reading the host location is now asynchronous #5865

Merged
merged 6 commits into from
Jan 19, 2022

Conversation

Jolyon-S
Copy link
Contributor

@Jolyon-S Jolyon-S commented Jan 19, 2022

Goals (and why):
==COMMIT_MSG==
The host location supplier is now run in a separate thread, and will return empty while evaluating. This is particularly important when the Ec2HostLocationSupplier repeatedly (and slowly) fails to connect, as this is on the creation path of the CassandraClientPoolImpl and thus the transaction manager creation path.
==COMMIT_MSG==

Implementation Description (bullets):
Introduce AsyncSupplier to encapsulate a supplier that should compute its result asynchronously...

Testing (What was existing testing like? What have you done to improve it?):
Added a test.

Concerns (what feedback would you like?):

  • Concurrency: the get method is synchronised. This is fine as the caller is once per two minutes, and I believe is not even concurrent either.

Where should we start reviewing?:
Diff

Priority (whenever / two weeks / yesterday):
Two years ago 🔥

@changelog-app
Copy link

changelog-app bot commented Jan 19, 2022

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

The host location supplier is now run in a separate thread, and will return empty while evaluating. This is particularly important when the Ec2HostLocationSupplier repeatedly (and slowly) fails to connect, as this is on the creation path of the CassandraClientPoolImpl and thus the transaction manager creation path.

Check the box to generate changelog(s)

  • Generate changelog entry

@Jolyon-S Jolyon-S changed the title Jshah/full circle Full Circle: Reading the host location is now asynchronous Jan 19, 2022

/**
* Supplier that will evaluate a delegate supplier asynchronously, providing a result when the underlying computation
* is complete. This computation is only initiated after the first call to get, but will be memoized infinitely after
Copy link
Contributor

Choose a reason for hiding this comment

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

let's say that this returns Optional.empty until the result is available somewhere - that's part of the point of this

* This class is thread safe by synchronising on {@link #get()}.
*/
@ThreadSafe
final class AsyncSupplier<T> implements Supplier<Optional<T>> {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: we should follow atlasdb conventions (public class and public factory)?

@jeremyk-91
Copy link
Contributor

👍

@bulldozer-bot bulldozer-bot bot merged commit 1ad5b58 into develop Jan 19, 2022
@bulldozer-bot bulldozer-bot bot deleted the jshah/full-circle branch January 19, 2022 17:26
@svc-autorelease
Copy link
Collaborator

Released 0.520.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants