Background jobs

Some TODO and probably bugs still in here, but I think this is an OK stopping point that should unblock activator to experiment with it.

I think interrupts are a very bad way to tell the job to stop.  They are very fragile, and there are many situations where interrupting a thread will have no effect.

One example, let's say you had a task that calculated more and more accurate values for Pi until it was told to stop.  Such an algorithm would never be interrupted unless it explicitly regularly checked Thread.currentThread().interrupted() itself.

I've come across many other situations where interrupts have no impact on even a blocked thread, and some libraries ignore interrupts altogether, these tasks will be impossible to stop.  And it can also be really difficult to pass interrupts up a chain since they are a checked exception, very often you see interrupts being wrapped in RuntimeExceptions, hows the calling code going to know that this was a graceful shutdown, or if an actual error occurred?

Bottom line, interrupts should not be used for normal control flow.

Another thing, not all background tasks need a background thread to run, or they may want to manage their own threads.  An example here might be some things in js engine, js engine creates a SBT wide Actor system, which obviously has its own threads, and only needs a message to be sent to tell it to shut down a task.

I think a much better design here would be to pass in a stop callback, and let the job of starting the background task/thread/whatever be the responsibility of the start callback.