Class MultiDomainDBCursor

java.lang.Object
org.opends.server.replication.server.changelog.file.MultiDomainDBCursor
All Implemented Interfaces:
Closeable, AutoCloseable, DBCursor<UpdateMsg>

@NotThreadSafe public class MultiDomainDBCursor extends Object
Cursor iterating over all the replication domains known to the changelog DB.
  • Constructor Details

    • MultiDomainDBCursor

      public MultiDomainDBCursor(ReplicationDomainDB domainDB, DBCursor.CursorOptions options)
      Builds a MultiDomainDBCursor instance.
      Parameters:
      domainDB - the replication domain management DB
      options - The cursor options
  • Method Details

    • addDomain

      public void addDomain(Dn baseDN, ServerState startAfterState)
      Adds a replication domain for this cursor to iterate over. Added cursors will be created and iterated over on the next call to DBCursor.next().
      Parameters:
      baseDN - the replication domain's baseDN
      startAfterState - the ServerState after which to start iterating
    • incorporateNewCursors

      protected void incorporateNewCursors() throws ChangelogException
      Called when implementors should incorporate new cursors into the current composite DBCursor. Implementors should call addCursor(DBCursor, Object) to do so.
      Throws:
      ChangelogException - if a database problem occurred
    • removeDomain

      public void removeDomain(Dn baseDN)
      Removes a replication domain from this cursor and stops iterating over it. Removed cursors will be effectively removed on the next call to DBCursor.next().

      FIXME this method should not immediately remove the cursors because it could change the record returned by DBCursor.getRecord(). All the cursor code should be replaced by the reactive changelog.

      Parameters:
      baseDN - the replication domain's baseDN
    • close

      public void close()
      Description copied from interface: DBCursor
      Release the resources and locks used by this Iterator. This method must be called when the iterator is no longer used. Failure to do it could cause DB deadlock.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface DBCursor<UpdateMsg>
    • next

      public boolean next() throws ChangelogException
      Description copied from interface: DBCursor
      Skip to the next record of the database.
      Specified by:
      next in interface DBCursor<T>
      Returns:
      true if has next, false otherwise
      Throws:
      ChangelogException - When database exception raised.
    • addCursor

      protected final void addCursor(DBCursor<UpdateMsg> cursor, Dn data) throws ChangelogException
      Adds a cursor to this composite cursor. It first calls DBCursor.next() to verify whether it is exhausted or not.
      Parameters:
      cursor - the cursor to add to this composite
      data - the data associated to the provided cursor
      Throws:
      ChangelogException - if a database problem occurred
    • getRecord

      public UpdateMsg getRecord()
      Description copied from interface: DBCursor
      Getter for the current record.

      This method will always return null when

      Specified by:
      getRecord in interface DBCursor<T>
      Returns:
      The current record. May be null.
    • getData

      public Dn getData()
      Returns the data associated to the cursor that returned the current record.
      Returns:
      the data associated to the cursor that returned the current record.
    • toString

      public String toString()
      Overrides:
      toString in class Object