| File was renamed from opends/src/server/org/opends/server/replication/server/ReplicationIterator.java |
| | |
| | | import org.opends.server.replication.protocol.UpdateMsg; |
| | | import org.opends.server.replication.server.ReplicationDB.ReplServerDBCursor; |
| | | import org.opends.server.replication.server.changelog.api.ChangelogException; |
| | | import org.opends.server.replication.server.changelog.api.ReplicationIterator; |
| | | |
| | | /** |
| | | * This class allows to iterate through the changes received from a given |
| | | * LDAP Server Identifier. |
| | | * Berkeley DB JE implementation of IReplicationIterator. |
| | | */ |
| | | public class ReplicationIterator |
| | | public class JEReplicationIterator implements ReplicationIterator |
| | | { |
| | | private UpdateMsg currentChange = null; |
| | | private ReplServerDBCursor cursor = null; |
| | |
| | | * @param dbHandler The associated DbHandler. |
| | | * @throws ChangelogException if a database problem happened. |
| | | */ |
| | | public ReplicationIterator(ReplicationDB db, ChangeNumber changeNumber, |
| | | public JEReplicationIterator(ReplicationDB db, ChangeNumber changeNumber, |
| | | DbHandler dbHandler) throws ChangelogException |
| | | { |
| | | this.db = db; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Get the UpdateMsg where the iterator is currently set. |
| | | * @return The UpdateMsg where the iterator is currently set. |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public UpdateMsg getChange() |
| | | { |
| | | return currentChange; |
| | | } |
| | | |
| | | /** |
| | | * Go to the next change in the ReplicationDB or in the server Queue. |
| | | * @return false if the iterator is already on the last change before |
| | | * this call. |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean next() |
| | | { |
| | | currentChange = cursor.next(); |
| | |
| | | return currentChange != null; |
| | | } |
| | | |
| | | /** |
| | | * 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. |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void releaseCursor() |
| | | { |
| | | synchronized (this) |