Java API: Make sure afterBulk is always called in BulkProcessor

Java API: Make sure afterBulk is always called in BulkProcessor.

Also strenghtened BulkProcessorTests by adding randomizations to existing tests and new tests for concurrent request.

Closes #5038
I like the idea of moving the `beforeBulk` up one line. This removes the need for the `beforeCalled` variable as well. Pushed a new commit.