thrifty icon indicating copy to clipboard operation
thrifty copied to clipboard

RPC method timeouts

Open benjamin-bader opened this issue 8 years ago • 1 comments

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 avatar Mar 07 '16 03:03 benjamin-bader

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?

benjamin-bader avatar Mar 10 '16 02:03 benjamin-bader