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

orTime and submit combination #12

Closed
DavDavid opened this issue Mar 25, 2019 · 5 comments
Closed

orTime and submit combination #12

DavDavid opened this issue Mar 25, 2019 · 5 comments

Comments

@DavDavid
Copy link

When I execute this code:

CompletableTask
  .submit(this::doTask, executor)
  .orTimeout(Duration.ofSeconds(5L))
  .whenComplete((res, err) -> {
    if (res != null)
	System.out.println(res);
    else
        System.out.println(err.getMessage());
});

private String doTask () throws Exception {
  TimeUnit.SECONDS.sleep(3);
  if (true)
    throw new Exception("my error");
  return "executed ok";
}

I never get "my error" exception after 3 secs, only TimeoutException after 5 secs with "Timeout after PT5S" message.
If I remove orTimeout(...) line, I get "my error" exception.
Is there any way to catch both exceptions?

Thanks

@vsilaev
Copy link
Owner

vsilaev commented Mar 26, 2019

Confirmed. The issue affects both orTimeout and onTimeout -- working on this

@vsilaev
Copy link
Owner

vsilaev commented Mar 28, 2019

Dav,

Could you please verify with the sources from master that the issues is fixed?
Please notice that the artifact has new coordinates:

	<groupId>net.tascalate</groupId>
	<artifactId>net.tascalate.concurrent</artifactId>
	<version>1.0.0-SNAPSHOT</version>

@DavDavid
Copy link
Author

DavDavid commented Apr 3, 2019

Sorry, but how can I verify it with maven? Do I need a special repository? Maven says that this artifact doesn't exist.

@vsilaev
Copy link
Owner

vsilaev commented Apr 5, 2019

It's necessary to clone a repo locally. Nevermind, I will release new build shortly.

@vsilaev
Copy link
Owner

vsilaev commented Apr 19, 2019

Build is released with the fix mentioned

@vsilaev vsilaev closed this as completed Apr 19, 2019
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