[concurrency-interest] InterruptedException-free wrappers for calls that "will never be interrupted"

Chris Povirk cpovirk at google.com
Wed Apr 14 13:11:28 EDT 2010


Given that failures are inevitable in an RPC system, a join() method
without a checked exception is a non-starter for what I have in mind.
Maybe a class like SwingWorker, which hands off a task to another
thread but isn't necessarily expected to fail (though it allows for it
by declaring "throws Exception"), would benefit from such an
interface.  That's a pretty small niche, though, to justify an
interface on top of the ForkJoinTask class.

I can certainly see the mess we end up in by trying to support all the
interruptible / checked exception combinations.  And that's all
ignoring timeouts.  It's almost enough to make me want to write:

public <T extends Exception, F extends Exception, I extends Exception>
    V megaGet(
        TimeoutPolicy<T> timeoutPolicy,
        FailurePolicy<F> failurePolicy,
        InterruptionPolicy<I> interruptionPolicy) throws T, F, I;

But again, I think maybe I can console myself with "restore interrupt,
wrap with RpcException, and throw" to handle interrupts when I'm
already declaring a checked RpcException.  Is this totally off base?


More information about the Concurrency-interest mailing list