MODE-2088 Ring buffer implementation with integration into the RepositoryChangeBus

Supersedes these pull-requests: #1095  and #1096 

Incorporated all of the commits from #1096 (which itself incorporated the commits from #1095), plus some fixes. The initial implementation of the RingBuffer supported producing events only from a single thread (there was no locking or coordination in the `add(...)` methods), but the RepositoryChangeBus requirements demand that events can be produced from multiple threads.

This may be ready to be merged, but there is still one thing I'm not sure of. The `RingBuffer.submitImmediately` methods make me uncomfortable: any events that go "into the buffer" this way will not be ordered correctly, because in reality they are fired immediately in the calling thread without even putting the event into the ring buffer. This is especially problematic for the Journal, which is the one thing that appears to use the `submitImmediately` method (via the `RepositoryChangeBus.registerInThread` functionality). Plus, when we do this, each consumer must be thread safe, since its consume method may be called by multiple threads.

I think we may need to change this implementation to put the event into the ring buffer and to instead block until all consumers process the event. We can do this relatively easily by using a count-down latch, though we do have to handle the case where an event is added in this way but before all consumers can process it one of the consumers is removed. (In such cases, we need to decrement any remaining latches.) This way all of the events remain in the correct order, plus the consumer's own thread is the only thread that will ever call the consumer.

The old `RepositoryChangeBus` implementation used something along the lines of the current implementation, so we may be able to merge this PR before fixing this issue. But I do think it has to be fixed.