Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 96706616C for ; Sat, 6 Aug 2011 11:55:05 +0000 (UTC) Received: (qmail 54347 invoked by uid 500); 6 Aug 2011 11:55:05 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 54289 invoked by uid 500); 6 Aug 2011 11:55:03 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 54282 invoked by uid 99); 6 Aug 2011 11:55:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Aug 2011 11:55:01 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Aug 2011 11:54:59 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 2B80D23889B3 for ; Sat, 6 Aug 2011 11:54:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1154495 - in /directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication: ReplicaEventLog.java ReplicaEventLogCursor.java Date: Sat, 06 Aug 2011 11:54:40 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110806115440.2B80D23889B3@eris.apache.org> Author: elecharny Date: Sat Aug 6 11:54:39 2011 New Revision: 1154495 URL: http://svn.apache.org/viewvc?rev=1154495&view=rev Log: o Updated Javadoc Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventLog.java directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventLogCursor.java Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventLog.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventLog.java?rev=1154495&r1=1154494&r2=1154495&view=diff ============================================================================== --- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventLog.java (original) +++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventLog.java Sat Aug 6 11:54:39 2011 @@ -35,7 +35,7 @@ import org.slf4j.LoggerFactory; /** - * A structure storing the configuration on each consumer registred on a producer. It stores + * A structure storing the configuration on each consumer registered on a producer. It stores * the following informations : *
    *
  • replicaId : the internal ID associated with the consumer
  • @@ -45,7 +45,8 @@ import org.slf4j.LoggerFactory; *
  • refreshNPersist : a flag indicating that the consumer is processing in Refresh and presist mode
  • *
  • *
- * A separate log is maintained for each syncrepl consumer + * A separate log is maintained for each syncrepl consumer.
+ * We also associate a Queue with each structure, which will store the messages to send to the consumer. * * @author Apache Directory Project */ @@ -96,7 +97,7 @@ public class ReplicaEventLog implements /** - * Create a new instance of EventLog for a replica + * Creates a new instance of EventLog for a replica * @param replicaId The replica ID */ public ReplicaEventLog( int replicaId ) @@ -108,11 +109,11 @@ public class ReplicaEventLog implements /** - * Instantiates a message queue and corresponding producer for storing DIT changes + * Instantiates a message queue and corresponding producer for storing DIT changes. * * @param amqConnection ActiveMQ connection * @param brokerService ActiveMQ's broker service - * @throws Exception + * @throws Exception If the queue can't be created */ public void configure( final ActiveMQConnection amqConnection, final BrokerService brokerService ) throws Exception { @@ -140,6 +141,7 @@ public class ReplicaEventLog implements ActiveMQObjectMessage ObjectMessage = ( ActiveMQObjectMessage ) amqSession.createObjectMessage(); ObjectMessage.setObject( message ); + producer.send( ObjectMessage ); } catch ( Exception e ) @@ -153,7 +155,7 @@ public class ReplicaEventLog implements * Deletes the queue (to remove the log) and recreates a new queue instance * with the same queue name. Also creates the corresponding message producer * - * @throws Exception + * @throws Exception If the queue can't be deleted */ public void truncate() throws Exception { @@ -185,7 +187,7 @@ public class ReplicaEventLog implements */ public void stop() throws Exception { - // then close the producer and session, DO NOT close connection + // Close the producer and session, DO NOT close connection producer.close(); amqSession.close(); } Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventLogCursor.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventLogCursor.java?rev=1154495&r1=1154494&r2=1154495&view=diff ============================================================================== --- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventLogCursor.java (original) +++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/ReplicaEventLogCursor.java Sat Aug 6 11:54:39 2011 @@ -32,65 +32,93 @@ import org.slf4j.LoggerFactory; /** + * Define a cursor on top of a message queue. * * @author Apache Directory Project */ class ReplicaEventLogCursor extends AbstractCursor { - + /** Logger for this class */ private static final Logger LOG = LoggerFactory.getLogger( ReplicaEventLogCursor.class ); + /** A browser on top of the queue */ private ActiveMQQueueBrowser browser; + /** The queue on top of which we will build the cursor */ private Queue regionQueue; + /** + * Creates a cursor on top of the given queue + * @param session The session + * @param queue The queue + * @param regionQueue ??? + * @throws Exception If we can't create a browser on top of the queue + */ public ReplicaEventLogCursor( ActiveMQSession session, ActiveMQQueue queue, Queue regionQueue ) throws Exception { - // commit before starting browser, to see the latest view of the Queue data -// session.commit(); - browser = ( ActiveMQQueueBrowser ) session.createBrowser( queue ); this.regionQueue = regionQueue; } + /** + * {@inheritDoc} + */ public void after( ReplicaEventMessage arg0 ) throws Exception { throw new UnsupportedOperationException(); } + /** + * {@inheritDoc} + */ public void afterLast() throws Exception { throw new UnsupportedOperationException(); } + /** + * {@inheritDoc} + */ public boolean available() { return browser.hasMoreElements(); } + /** + * {@inheritDoc} + */ public void before( ReplicaEventMessage arg0 ) throws Exception { throw new UnsupportedOperationException(); } + /** + * {@inheritDoc} + */ public void beforeFirst() throws Exception { } + /** + * {@inheritDoc} + */ public boolean first() throws Exception { throw new UnsupportedOperationException(); } + /** + * {@inheritDoc} + */ public ReplicaEventMessage get() throws Exception { ActiveMQObjectMessage amqObj = ( ActiveMQObjectMessage ) browser.nextElement(); @@ -102,24 +130,36 @@ class ReplicaEventLogCursor extends Abst } + /** + * {@inheritDoc} + */ public boolean last() throws Exception { throw new UnsupportedOperationException(); } + /** + * {@inheritDoc} + */ public boolean next() throws Exception { return browser.hasMoreElements(); } + /** + * {@inheritDoc} + */ public boolean previous() throws Exception { throw new UnsupportedOperationException(); } + /** + * {@inheritDoc} + */ @Override public void close() throws Exception { @@ -128,6 +168,9 @@ class ReplicaEventLogCursor extends Abst } + /** + * {@inheritDoc} + */ @Override public void close( Exception cause ) throws Exception { @@ -136,6 +179,9 @@ class ReplicaEventLogCursor extends Abst } + /** + * {@inheritDoc} + */ @Override public Iterator iterator() {