This commit refactors *ReceiveCommits. The main goal is
to move error handling and metric reporting to a central
place.
As in other parts of Gerrit, we use unchecked exceptions
for unrecoverable failures. They are handled in the
PreReceiveHook and translated into a message on the Git
wire.
We also make ReceiveCommits return a result instead of
accessing the result from a private member.
Having both unrecoverable exceptions as well as the result
of the operation - in case there were no exceptions -
handled in a single spot allows googlesource.com to report
more accurate metrics.
To have ReceiveCommits return a result, we have to use a
Callable. WorkQueue wasn't ready for that, so this commit
adds support for a Callable inside a ProjectRunnable.
WorkQueue seems like component with lots of thorny, multi-
threaded code that is rarely used. In the future, we might
want to get rid of it and just use standard thread pools.
Change-Id: I6a4b2731f8de77cc453b58f931a9ec7a3f5b6612