Only throw interrupt in pushDocIds for first batch

DocIdPusher says that we return the first DocId to fail when there is an
exception. However, that wasn't the case for InterruptedExceptions,
which are populated to the caller. We do want to throw
InterruptedException so that callers gracefully shutdown the thread, but
we also want to tell the caller of any ids that failed to send.

Therefore, now we throw the interruption if no ids have been sent (and
thus no knowledge to be lost) but simply stop early otherwise and leave
the interruption flag intact, which still allows us to inform the caller
of the error. Since we only return with error after we have successfully
made progress, even if the client doesn't observe the interrupted flag
we will continue to make progress as a whole. In addition, if the GSA is
down and thus we are constantly erroring, we will end up throwing the
interrupted exception on the first batch.

Do note that our loop doesn't throw InterruptedException. Instead, the
user's error handler may throw an InterruptedException, assumably while
sleeping.
3 files changed