You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that when an InterruptedException is caught, we set the interrupt flag back using Thread.currentThread().interrupt(). Should we not also throw some exception, so that the higher level code, is aware than an InterruptedException was caught and handled by lower level code ?
Something like https://www.yegor256.com/2015/10/20/interrupted-exception.html (check towards the end) He's just throwing a RuntimeException, we could have custom exceptions, depending on the use-case.
The text was updated successfully, but these errors were encountered:
I noticed that when an InterruptedException is caught, we set the interrupt flag back using Thread.currentThread().interrupt(). Should we not also throw some exception
@Dexteroo7 can you point to the where that's happening and maybe a description of what the issue is; the client uses a background thread which means some exceptions need to be propagated differently and just throwing won't always work.
I would not call it an issue :) rather an improvement in the API
An example scenario: Client is trying to restart the stream processor, calls StreamProcessor.stop(), but the thread gets interrupted. The exception gets handled in ExecutorServiceSupport.shutdown(). Ideally I would want to throw the exception up the stack, so that the client code calling StreamProcessor.stop(), get the exception as well and can handle it accordingly, otherwise the client would continue with the restart code path. The client could have handled the exception and gracefully stop the restart code path.
I noticed that when an InterruptedException is caught, we set the interrupt flag back using Thread.currentThread().interrupt(). Should we not also throw some exception, so that the higher level code, is aware than an InterruptedException was caught and handled by lower level code ?
Something like https://www.yegor256.com/2015/10/20/interrupted-exception.html (check towards the end) He's just throwing a RuntimeException, we could have custom exceptions, depending on the use-case.
The text was updated successfully, but these errors were encountered: