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

Handling InterruptedException #335

Open
Dexteroo7 opened this issue Aug 31, 2018 · 2 comments
Open

Handling InterruptedException #335

Dexteroo7 opened this issue Aug 31, 2018 · 2 comments

Comments

@Dexteroo7
Copy link

Dexteroo7 commented Aug 31, 2018

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.

@dehora
Copy link
Owner

dehora commented Sep 10, 2018

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.

@Dexteroo7
Copy link
Author

Dexteroo7 commented Sep 10, 2018

  1. I would not call it an issue :) rather an improvement in the API
  2. 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.

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

No branches or pull requests

2 participants