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

Add more uninterruptible methods #1409

Open
gissuebot opened this issue Oct 31, 2014 · 15 comments
Open

Add more uninterruptible methods #1409

gissuebot opened this issue Oct 31, 2014 · 15 comments

Comments

@gissuebot
Copy link

Original issue created by Ash2kk on 2013-05-12 at 10:33 AM


Currently Uninterruptibles have putUninterruptibly() and takeUninterruptibly() methods for BlockingQueue. Consider adding helper methods for other interruptible methods: offer(Object, long, TimeUnit) and poll(long, TimeUnit).

Also there is BlockingDeque interface with many more interruptible methods.

Related to issue #1212 and issue #1315.

@RamAnvesh
Copy link

Also there are the Object.wait methods. I am guessing they are also used quite frequently.

@camerondavison
Copy link

is there a reason that poll or offer has not been added? do they introduce something that will make people program incorrectly? such as #1118 ?

@cpovirk
Copy link
Member

cpovirk commented May 6, 2016

I think we just haven't needed them yet. They seem fine to add as far as I can tell.

@thecoop
Copy link

thecoop commented May 16, 2018

Could this be made more generic, for running any arbitrary operation that throws InterruptedException?

Uninterruptibles.runUninterruptibly(() -> opThrowingInterruptedException())

@RamAnvesh
Copy link

@thecoop #2384

@leventov
Copy link

leventov commented Feb 8, 2019

Maybe there are enough voices to add more methods now? We would benefit from BlockingQueue.offer() and poll() too.

@Pr0methean
Copy link

@thecoop For time-limited operations, we'd need to pass the total time into the helper method, which in turn would pass the remaining time as an argument to the functional parameter.

@tanmayvarun
Copy link
Contributor

tanmayvarun commented Sep 19, 2020

@cpovirk l am beginner when it comes to contributing to open-source of Guava. I would like to work on this issue.

I am planning to implement two methods offerUninterruptibly(long timeout, TimeUnit unit) and pollUninterruptibly(long timeout, TimeUnit unit).

Please let me know if I can start working on this!

Thanks

@cpovirk
Copy link
Member

cpovirk commented Sep 19, 2020

That sounds great. Go for it!

(I have some other things that I need to get back to people about, so I might not review it immediately, but I'll be sure to get to it.)

@tanmayvarun
Copy link
Contributor

Ack.

tanmayvarun added a commit to tanmayvarun/guava that referenced this issue Sep 19, 2020
@tanmayvarun
Copy link
Contributor

@cpovirk Please review per your convenience.

tanmayvarun added a commit to tanmayvarun/guava that referenced this issue Sep 20, 2020
tanmayvarun added a commit to tanmayvarun/guava that referenced this issue Sep 20, 2020
@tanmayvarun
Copy link
Contributor

All errors fixed, Please review 4034

@tanmayvarun
Copy link
Contributor

@cpovirk Please suggest me next issue to work on, a small feature enhancement will be good too :)

@tanmayvarun
Copy link
Contributor

All errors fixed, Please review 4034

@cpovirk Any updates..

tanmayvarun added a commit to tanmayvarun/guava that referenced this issue Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests