Never throw when describing a queued ITS task

WorkQueue builds the worker thread's name from a queued task's
toString() before it invokes the task. This is done in Gerrit core's
WorkQueue and ideally should be fixed to protect its executor against
this. An exception from toString() causes the task to be dropped without
running and without reporting a rejection or a cancellation, so the
in-flight permit which Throttle holds for it is never released, and the
plugin loses that capacity for the lifetime of the server.

Catch while delegating to the wrapped task's toString() and fall back to
its class name, so the thread still gets a name and the task still runs.

Change-Id: Ifdb19197deb4dbf1e268cc33b557ec64317fc7e4
2 files changed