org.modeshape.jcr.journal

## Class ClusteredJournal

- java.lang.Object
- - org.modeshape.jcr.clustering.MessageConsumer<org.modeshape.jcr.journal.DeltaMessage>
  - - org.modeshape.jcr.journal.ClusteredJournal

- All Implemented Interfaces:
    ChangeSetListener, ChangeJournal

      @ThreadSafe
      public class ClusteredJournal
      extends MessageConsumer<org.modeshape.jcr.journal.DeltaMessage>
      implements ChangeJournal

  A `ChangeJournal` implementation which runs in a cluster and which attempts to reconcile with other members of the cluster on startup in order to retrieve missed/lost records.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.modeshape.jcr.journal.ChangeJournal

      `ChangeJournal.Records`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClusteredJournal(LocalJournal localJournal, ClusteringService clusteringService)` Creates a new clustered journal

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addRecords(JournalRecord... records)` Adds one or more journal records to a journal.
    `ChangeJournal.Records` | `allRecords(boolean descendingOrder)` Returns all the records this journal holds
    `protected ClusteringService` | `clusteringService()`
    `protected String` | `clusterName()`
    `void` | `consume(org.modeshape.jcr.journal.DeltaMessage message)` Consumes a payload of the given type.
    `String` | `journalId()` Returns the id of this change journal.
    `JournalRecord` | `lastRecord()` Returns the last record from the journal.
    `protected LocalJournal` | `localJournal()`
    `void` | `notify(ChangeSet changeSet)` Notifies a listener of the given changes.
    `ChangeJournal.Records` | `recordsNewerThan(org.joda.time.DateTime changeSetTime, boolean inclusive, boolean descendingOrder)` Returns all records that have changesets which are newer than a given timestamp.
    `void` | `removeOldRecords()` Removes older entries.
    `void` | `shutdown()` Stops the journal.
    `void` | `start()` Starts this journal instance.

    - ### Methods inherited from class org.modeshape.jcr.clustering.MessageConsumer

      `getPayloadType`

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

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

- - ### Constructor Detail

    - #### ClusteredJournal

          public ClusteredJournal(LocalJournal localJournal,
                          ClusteringService clusteringService)

      Creates a new clustered journal
      Parameters:
        `localJournal` - the local `ChangeJournal` which will
        `clusteringService` - an `ClusteringService` instance.

  - ### Method Detail

    - #### notify

          public void notify(ChangeSet changeSet)

      Description copied from interface: `ChangeSetListener`
      Notifies a listener of the given changes.
      Specified by:
        `notify` in interface `ChangeSetListener`
      Parameters:
        `changeSet` - a `non-null` `ChangeSet`

    - #### start

          public void start()
                     throws Exception

      Description copied from interface: `ChangeJournal`
      Starts this journal instance.
      Specified by:
        `start` in interface `ChangeJournal`
      Throws:
        `Exception` - if anything fails during start

    - #### shutdown

          public void shutdown()

      Description copied from interface: `ChangeJournal`
      Stops the journal.
      Specified by:
        `shutdown` in interface `ChangeJournal`

    - #### removeOldRecords

          public void removeOldRecords()

      Description copied from interface: `ChangeJournal`
      Removes older entries. Each journal is free to decide the semantics behind "old".
      Specified by:
        `removeOldRecords` in interface `ChangeJournal`

    - #### allRecords

          public ChangeJournal.Records allRecords(boolean descendingOrder)

      Description copied from interface: `ChangeJournal`
      Returns all the records this journal holds
      Specified by:
        `allRecords` in interface `ChangeJournal`
      Parameters:
        `descendingOrder` - flag which indicates whether the entries
      Returns:
        a `ChangeJournal.Records` instance

    - #### lastRecord

          public JournalRecord lastRecord()

      Description copied from interface: `ChangeJournal`
      Returns the last record from the journal.
      Specified by:
        `lastRecord` in interface `ChangeJournal`
      Returns:
        either a `JournalRecord` instance or `null` if the journal is empty.

    - #### recordsNewerThan

          public ChangeJournal.Records recordsNewerThan(org.joda.time.DateTime changeSetTime,
                                               boolean inclusive,
                                               boolean descendingOrder)

      Description copied from interface: `ChangeJournal`
      Returns all records that have changesets which are newer than a given timestamp.
      Specified by:
        `recordsNewerThan` in interface `ChangeJournal`
      Parameters:
        `changeSetTime` - the `DateTime` of the changes representing the lower bound; may be null indicating that *all the records* should be returned.
        `inclusive` - flag indicating whether the timestamp should be used inclusively or exclusively
        `descendingOrder` - flag indicating if the records should be returned in ascending order (oldest to newest) or descending order (newest to oldest)
      Returns:
        a `ChangeJournal.Records` instance; never `null`

    - #### addRecords

          public void addRecords(JournalRecord... records)

      Description copied from interface: `ChangeJournal`
      Adds one or more journal records to a journal.
      Specified by:
        `addRecords` in interface `ChangeJournal`
      Parameters:
        `records` - a `JournalRecord` array.

    - #### journalId

          public String journalId()

      Description copied from interface: `ChangeJournal`
      Returns the id of this change journal.
      Specified by:
        `journalId` in interface `ChangeJournal`
      Returns:
        a `String`, never `null`

    - #### consume

          public void consume(org.modeshape.jcr.journal.DeltaMessage message)

      Description copied from class: `MessageConsumer`
      Consumes a payload of the given type.
      Specified by:
        `consume` in class `MessageConsumer<org.modeshape.jcr.journal.DeltaMessage>`
      Parameters:
        `message` - a `Serializable` payload.

    - #### clusteringService

          protected ClusteringService clusteringService()

    - #### localJournal

          protected LocalJournal localJournal()

    - #### clusterName

          protected String clusterName()

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