Skip to content

Conversation

@tlrx
Copy link
Member

@tlrx tlrx commented Nov 13, 2018

This pull request adds a simple RunOnce class that can be used to execute a Runnable exactly once.

Related to #34902 (comment)

@tlrx tlrx added >enhancement :Core/Infra/Core Core issues without another label v7.0.0 labels Nov 13, 2018
@tlrx tlrx requested a review from s1monw November 13, 2018 10:36
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

Copy link
Member

@jasontedor jasontedor left a comment

Choose a reason for hiding this comment

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

I left a drive-by comment.

* A class which wraps an existing {@link Runnable} and allows to execute it exactly once
* whatever the number of times the wrapped {@link Runnable#run()} method is called.
*/
public class RunOnce implements Runnable {
Copy link
Member

Choose a reason for hiding this comment

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

We already have at least one implementation of this in the codebase: WorkerBulkByScrollTakeState#RunOnce. Can we relocate that code instead? Also, it is lacking tests. I think it could go in separately in a PR that adds tests along side it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I created #35489

@tlrx
Copy link
Member Author

tlrx commented Nov 13, 2018

Superseded by #35489

@tlrx tlrx closed this Nov 13, 2018
@tlrx tlrx deleted the add-runonce branch November 13, 2018 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Core/Infra/Core Core issues without another label >enhancement v7.0.0-beta1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants