Hi there,
I believe that org.apache.curator.utils.CloseableExecutorService is NOT thread 
safe. Checking implementation looks that this was NOT the author intention 
(otherwise why to use a concurrent set to store futures for cancelation, etc...)
If submit(...) and close() methods are called concurrently in different threads 
with a provided executor service, I think it is perfectly possible that latest 
submitted tasks is accepted BUT NOT observed by the iterator used to close 
submitted tasks (There is race condition here); then this latest submitted task 
is never interrupted when closing. The same applies to 
CloseableScheduledExecutorService, and the latest scheduled task could run 
forever even after closing.
In my opinion it should be documented if the class is expected to be thread 
safe or NOT (or anything else in the middle with documented limitations). In 
case it is expected to be thread safe, then implementation needs to be 
corrected. Let me know your opinion here, and I could work a PR if needed.
Regards,
Chevaris








Reply via email to