Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-388: add non blocking sleeper #440

Closed

Conversation

hakimrabet
Copy link

@pivotal-cla
Copy link

@hakimrabet Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-cla
Copy link

@hakimrabet Thank you for signing the Contributor License Agreement!

@hakimrabet hakimrabet force-pushed the fix/add_non_blocking_sleeper branch from 49762a6 to 6b07318 Compare May 23, 2024 23:41
Alireza Hakimrabet added 2 commits May 24, 2024 03:43
throw new BackOffInterruptedException("Thread interrupted while sleeping", e);
}
});
future.join();
Copy link
Member

Choose a reason for hiding this comment

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

I'm sorry what difference does it make against regular Thread.sleep() in the thread which calls this Sleeper?

Copy link
Author

Choose a reason for hiding this comment

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

thanks for reading and comment my code.
when backoff execute from a scheduler and the thread that run the scheduler, going to sleep in the (sleeper.java).
the main idea of that is to release the thread that run scheduler, because the time scheduler and back off time going to Disorder the scheduler or preventing other scheduler from running.
am i right?

Copy link
Member

Choose a reason for hiding this comment

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

Do you have a confirmation with tests that it works as you explain ?
I just believe that this join() is blocking the thread which calls it.

throw new BackOffInterruptedException("Thread interrupted while sleeping", e);
}
});
future.join();
Copy link
Member

Choose a reason for hiding this comment

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

Do you have a confirmation with tests that it works as you explain ?
I just believe that this join() is blocking the thread which calls it.

@hakimrabet
Copy link
Author

i dig more about it, indeed you're right. join() block the thread as like Thread.Sleep().

@hakimrabet hakimrabet closed this May 26, 2024
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.

None yet

3 participants