The Wayback Machine - https://web.archive.org/web/20201013203258/https://github.com/microsoft/thrifty/issues/13
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

RPC method timeouts #13

Open
benjamin-bader opened this issue Mar 7, 2016 · 1 comment
Open

RPC method timeouts #13

benjamin-bader opened this issue Mar 7, 2016 · 1 comment

Comments

@benjamin-bader
Copy link
Collaborator

@benjamin-bader benjamin-bader commented Mar 7, 2016

We need them.

Proposed api for generated methods:

Thrift:

service FooService {
  i32 bar(1: string arg)
}

corresponding Java:

public interface FooService {
  int bar(String arg);
  int bar(String arg, long timeout, TimeUnit unit);
}

Timeouts would be communicated via ServiceMethodCallback#onError(Throwable) - likely via a java.util.concurrent.TimeoutException.

The downside being, of course, that the number of service methods doubles. On the other hand, such methods are typically a small portion of the overall number of generated methods, so it may not be so impactful.

@benjamin-bader
Copy link
Collaborator Author

@benjamin-bader benjamin-bader commented Mar 10, 2016

We could take inspiration here from Apache, which uses a TreeSet of timeouts and just iterates through it on each IO loop - timeouts aren't guaranteed to fire at the expiration time (or ever), but better than nothing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
1 participant
You can’t perform that action at this time.