org.modeshape.jcr.bus

## Class RepositoryChangeBus.ChangeSetListenerConsumerAdapter

- java.lang.Object
- - org.modeshape.jcr.bus.RepositoryChangeBus.ChangeSetListenerConsumerAdapter

- All Implemented Interfaces:
    RingBuffer.ConsumerAdapter<ChangeSet,ChangeSetListener>
  Enclosing class:
    RepositoryChangeBus

      protected class RepositoryChangeBus.ChangeSetListenerConsumerAdapter
      extends Object
      implements RingBuffer.ConsumerAdapter<ChangeSet,ChangeSetListener>

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `RepositoryChangeBus.ChangeSetListenerConsumerAdapter()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close(ChangeSetListener consumer)` Called by the `RingBuffer` when the `RingBuffer.ConsumerAdapter.consume(Object, Object, long, long)` method returns false, or when the buffer has been shutdown and the consumer has `consumed` all entries in the now-closed buffer.
    `boolean` | `consume(ChangeSetListener consumer, ChangeSet event, long position, long maxPosition)` Consume an entry from the ring buffer.
    `void` | `handleException(ChangeSetListener consumer, Throwable t, ChangeSet entry, long position, long maxPosition)` Handle an exception that was thrown from the `RingBuffer.ConsumerAdapter.consume(Object, Object, long, long)`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RepositoryChangeBus.ChangeSetListenerConsumerAdapter

          protected RepositoryChangeBus.ChangeSetListenerConsumerAdapter()

  - ### Method Detail

    - #### consume

          public boolean consume(ChangeSetListener consumer,
                        ChangeSet event,
                        long position,
                        long maxPosition)

      Description copied from interface: `RingBuffer.ConsumerAdapter`
      Consume an entry from the ring buffer. Generally all exceptions should be handled within this method; any exception thrown will result in the `RingBuffer.ConsumerAdapter.handleException(Object, Throwable, Object, long, long)` being called.
      Specified by:
        `consume` in interface `RingBuffer.ConsumerAdapter<ChangeSet,ChangeSetListener>`
      Parameters:
        `consumer` - the consumer instance that is to consume the event; never null
        `event` - the entry; will not be null
        `position` - the position of the entry within in the ring buffer; this is typically a monotonically-increasing value
        `maxPosition` - the maximum position of entries in the ring buffer that are being consumed within the same batch; this will be greater or equal to `position`
      Returns:
        `true` if the consumer should continue processing the next entry, or `false` if this consumer is to stop processing any more entries (from this or subsequent batches); returning `false` provides a way for the consumer to signal that it should no longer be used

    - #### close

          public void close(ChangeSetListener consumer)

      Description copied from interface: `RingBuffer.ConsumerAdapter`
      Called by the `RingBuffer` when the `RingBuffer.ConsumerAdapter.consume(Object, Object, long, long)` method returns false, or when the buffer has been shutdown and the consumer has `consumed` all entries in the now-closed buffer.

      This method allows any resources used by the consumer to be cleaned up when no longer needed

      Specified by:
        `close` in interface `RingBuffer.ConsumerAdapter<ChangeSet,ChangeSetListener>`
      Parameters:
        `consumer` - the consumer instance that is being closed; never null

    - #### handleException

          public void handleException(ChangeSetListener consumer,
                             Throwable t,
                             ChangeSet entry,
                             long position,
                             long maxPosition)

      Description copied from interface: `RingBuffer.ConsumerAdapter`
      Handle an exception that was thrown from the `RingBuffer.ConsumerAdapter.consume(Object, Object, long, long)`.
      Specified by:
        `handleException` in interface `RingBuffer.ConsumerAdapter<ChangeSet,ChangeSetListener>`
      Parameters:
        `consumer` - the consumer instance that is to consume the event; never null
        `t` - the exception; never null
        `entry` - the entry during the consumption of which generated the exception; will not be null
        `position` - the position of the entry within in the ring buffer; this is typically a monotonically-increasing value
        `maxPosition` - the maximum position of entries in the ring buffer that are being consumed within the same batch; this will be greater or equal to `position`

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.