Skip to content

Commit

Permalink
Merge pull request #410 from SteafanMrZhou/master
Browse files Browse the repository at this point in the history
A PR for issue#405.
  • Loading branch information
Palmr committed Mar 2, 2022
2 parents 160e798 + 35f2b93 commit a32218d
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// tag::example[]
public class LongEventFactory implements EventFactory<LongEvent>
{
@Override
public LongEvent newInstance()
{
return new LongEvent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// tag::example[]
public class LongEventHandler implements EventHandler<LongEvent>
{
@Override
public void onEvent(LongEvent event, long sequence, boolean endOfBatch)
{
System.out.println("Event: " + event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public LongEventProducer(RingBuffer<LongEvent> ringBuffer)
private static final EventTranslatorOneArg<LongEvent, ByteBuffer> TRANSLATOR =
new EventTranslatorOneArg<LongEvent, ByteBuffer>()
{
@Override
public void translateTo(LongEvent event, long sequence, ByteBuffer bb)
{
event.set(bb.getLong(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public LongEventProducerWithTranslator(RingBuffer<LongEvent> ringBuffer)
private static final EventTranslatorOneArg<LongEvent, ByteBuffer> TRANSLATOR =
new EventTranslatorOneArg<LongEvent, ByteBuffer>()
{
@Override
public void translateTo(LongEvent event, long sequence, ByteBuffer bb)
{
event.set(bb.getLong(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

public class ClearingEventHandler<T> implements EventHandler<ObjectEvent<T>>
{
@Override
public void onEvent(ObjectEvent<T> event, long sequence, boolean endOfBatch)
{
event.clear(); // <1>
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/lmax/disruptor/RingBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ public long getCursor()
*
* @return size of buffer
*/
@Override
public int getBufferSize()
{
return bufferSize;
Expand All @@ -455,6 +456,7 @@ public int getBufferSize()
* @return <code>true</code> If the specified <code>requiredCapacity</code> is available
* <code>false</code> if not.
*/
@Override
public boolean hasAvailableCapacity(final int requiredCapacity)
{
return sequencer.hasAvailableCapacity(requiredCapacity);
Expand Down Expand Up @@ -898,6 +900,7 @@ public void publish(final long lo, final long hi)
*
* @return The number of slots remaining.
*/
@Override
public long remainingCapacity()
{
return sequencer.remainingCapacity();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ public void setRewindable(final BatchEventProcessor<LongEvent> processor)
this.processor = processor;
}

@Override
public void onEvent(final LongEvent event, final long sequence, final boolean endOfBatch) throws Exception
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ public long getCursor()
*
* @return size of buffer
*/
@Override
public int getBufferSize()
{
return bufferSize;
Expand All @@ -474,6 +475,7 @@ public int getBufferSize()
* @return <code>true</code> If the specified <code>requiredCapacity</code> is available
* <code>false</code> if not.
*/
@Override
public boolean hasAvailableCapacity(final int requiredCapacity)
{
return sequencer.hasAvailableCapacity(requiredCapacity);
Expand Down Expand Up @@ -917,6 +919,7 @@ public void publish(final long lo, final long hi)
*
* @return The number of slots remaining.
*/
@Override
public long remainingCapacity()
{
return sequencer.remainingCapacity();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ public long getCursor()
*
* @return size of buffer
*/
@Override
public int getBufferSize()
{
return bufferSize;
Expand All @@ -487,6 +488,7 @@ public int getBufferSize()
* @return <code>true</code> If the specified <code>requiredCapacity</code> is available
* <code>false</code> if not.
*/
@Override
public boolean hasAvailableCapacity(final int requiredCapacity)
{
return sequencer.hasAvailableCapacity(requiredCapacity);
Expand Down Expand Up @@ -930,6 +932,7 @@ public void publish(final long lo, final long hi)
*
* @return The number of slots remaining.
*/
@Override
public long remainingCapacity()
{
return sequencer.remainingCapacity();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public StubExceptionHandler(final AtomicReference<Throwable> exceptionHandled)
this.exceptionHandled = exceptionHandled;
}

@Override
public void handleEventException(final Throwable ex, final long sequence, final Object event)
{
exceptionHandled.set(ex);
Expand Down

0 comments on commit a32218d

Please sign in to comment.