linkedin/parseq — pull request #38 by ericmelz (2013-12-17 02:11:02+00:00)
Title: Added AsyncCallableTaskWithSLA and tests

Adds a new class, AsyncCallableTaskWithSLA.

This is similar to AsyncCallableTask but adds a few new features:
(1) accepts a timeout in a constructor which will timeout the task if it doesn't complete in time
(2) Adds optional onTimeout() and onError() methods, so that a Promise can return special values for these conditions
(3) Adds state variables so that clients can tell what happened to the task, i.e., whether it timed-out, errored, errored on timeout, etc.
(4) Saves exceptions in the cases where the task had errors. There are two levels of exceptions, primary and secondary.

The class is designed to be easy to use (i.e., users don't need to implement onTimeout and onError, and can ignore status variables if they so choose).

A unit test demos the various use cases.