Questions tagged [closeable]
5 questions
2
votes
2 answers
Java future timeout with way to cleanup
Say I have a method getCloseableResource() which might take an unbounded amount of time to complete and returns something that needs to be closed or cleaned up.
I want to submit a task to an executorService to get the closeable resource but only…

jbu
- 15,831
- 29
- 82
- 105
1
vote
1 answer
Return autocloseable object inside a CompletableFuture and use it in whenComplete
I want to return an autocloseable object inside a CompletableFuture and use it in whenComplete without going to close it manually later.
This is the code that I've tried, but of course it won't work because it closes automatically when I return…

thatflow
- 25
- 6
1
vote
3 answers
How to handle Autoclosable Resources which being passed as a Method arguments
I'm trying to migrate existing code to try with resource, but not sure how to deal when the closable resources are passed to other methods.
My main concern is how to prevent the developers from touching the method additionalMethod() from closing the…

ir2pid
- 5,604
- 12
- 63
- 107
1
vote
1 answer
Kotlin `use` with AutoCloseable type and a lambda returning Boolean
This must be simple, but I've been banging my head against it for half an hour now... Here's my old, exception-unsafe code:
fun isReady(): Boolean {
try {
val cc: CommandChannel = getCommandChannel() // implements AutoCloseable
…

Quuxplusone
- 23,928
- 8
- 94
- 159
-2
votes
1 answer
Closeable MUI React Tabs
Here I have use MUI tabs and added a X button to it, I am having trouble making the tabs closeable, was wondering for help and guidance so that I can close tabs. I have tried different ways but no success.
Code
I tried setting new values but to no…

kushplanker
- 1
- 1