Skip to content

Commit

Permalink
Improve documentation #96.
Browse files Browse the repository at this point in the history
mikeb01 committed Mar 6, 2018
1 parent 23d391d commit 1878c49
Showing 3 changed files with 14 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/main/java/com/lmax/disruptor/EventHandler.java
Original file line number Diff line number Diff line change
@@ -24,7 +24,12 @@
public interface EventHandler<T>
{
/**
* Called when a publisher has published an event to the {@link RingBuffer}
* Called when a publisher has published an event to the {@link RingBuffer}. The {@link BatchEventProcessor} will
* read messages from the {@link RingBuffer} in batches, where a batch is all of the events available to be
* processed without having to wait for any new event to arrive. This can be useful for event handlers that need
* to do slower operations like I/O as they can group together the data from multiple events into a single
* operation. Implementations should ensure that the operation is always performed when endOfBatch is true as
* the time between that message an the next one is inderminate.
*
* @param event published to the {@link RingBuffer}
* @param sequence of the event being processed
5 changes: 4 additions & 1 deletion src/main/java/com/lmax/disruptor/EventProcessor.java
Original file line number Diff line number Diff line change
@@ -16,7 +16,10 @@
package com.lmax.disruptor;

/**
* EventProcessors waitFor events to become available for consumption from the {@link RingBuffer}
* An EventProcessor needs to be an implementation of a runnable that will poll for events from the {@link RingBuffer}
* using the appropriate wait strategy. It is unlikely that you will need to implement this interface yourself.
* Look at using the {@link EventHandler} interface along with the pre-supplied BatchEventProcessor in the first
* instance.
* <p>
* An EventProcessor will generally be associated with a Thread for execution.
*/
4 changes: 4 additions & 0 deletions src/main/java/com/lmax/disruptor/dsl/Disruptor.java
Original file line number Diff line number Diff line change
@@ -155,6 +155,8 @@ private Disruptor(final RingBuffer<T> ringBuffer, final Executor executor)
* process events before handler <code>B</code>:</p>
* <pre><code>dw.handleEventsWith(A).then(B);</code></pre>
*
* <p>This call is additive, but generally should only be called once when setting up the Disruptor instance</p>
*
* @param handlers the event handlers that will process events.
* @return a {@link EventHandlerGroup} that can be used to chain dependencies.
*/
@@ -178,6 +180,8 @@ public final EventHandlerGroup<T> handleEventsWith(final EventHandler<? super T>
* {@link EventHandlerGroup#handleEventsWith(EventProcessorFactory...)} and {@link EventHandlerGroup#then(EventProcessorFactory...)}
* which do have barrier sequences to provide.</p>
*
* <p>This call is additive, but generally should only be called once when setting up the Disruptor instance</p>
*
* @param eventProcessorFactories the event processor factories to use to create the event processors that will process events.
* @return a {@link EventHandlerGroup} that can be used to chain dependencies.
*/

0 comments on commit 1878c49

Please sign in to comment.