directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r772445 - /directory/apacheds/branches/apacheds-replication/syncrepl/src/main/java/org/apache/directory/server/syncrepl/SyncReplConsumer.java
Date Wed, 06 May 2009 22:05:00 GMT
Author: elecharny
Date: Wed May  6 22:04:59 2009
New Revision: 772445

URL: http://svn.apache.org/viewvc?rev=772445&view=rev
Log:
o Replaced the call to ldapConnection.add( listener) by using an async search operation.
o Minor code cleaning

Modified:
    directory/apacheds/branches/apacheds-replication/syncrepl/src/main/java/org/apache/directory/server/syncrepl/SyncReplConsumer.java

Modified: directory/apacheds/branches/apacheds-replication/syncrepl/src/main/java/org/apache/directory/server/syncrepl/SyncReplConsumer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-replication/syncrepl/src/main/java/org/apache/directory/server/syncrepl/SyncReplConsumer.java?rev=772445&r1=772444&r2=772445&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-replication/syncrepl/src/main/java/org/apache/directory/server/syncrepl/SyncReplConsumer.java
(original)
+++ directory/apacheds/branches/apacheds-replication/syncrepl/src/main/java/org/apache/directory/server/syncrepl/SyncReplConsumer.java
Wed May  6 22:04:59 2009
@@ -102,7 +102,7 @@
     /** the syncrequest control */
     private SyncRequestValueControl syncReq;
 
-    /** a reference to the directoryservice */
+    /** a reference to the directoryService */
     private DirectoryService directoryService;
 
     /** the decoder for syncinfovalue control */
@@ -185,7 +185,6 @@
             if( connection == null )
             {
                 connection = new LdapConnection( providerHost, port );
-                connection.addListener( this );
             }
 
             // Do a bind
@@ -590,13 +589,14 @@
 
 
     /**
-     * 
-     * performs a search on connection with updated syncrequest control.
+     * performs a search on connection with updated syncRequest control.
      *
      * @throws Exception in case of any problems encountered while searching
      */
     private void doSyncSearch() throws Exception
     {
+        SyncRequestValueControl syncReq = new SyncRequestValueControl();
+        
         if( config.isRefreshPersist() )
         {
             syncReq.setMode( SynchronizationModeEnum.REFRESH_AND_PERSIST );
@@ -613,7 +613,8 @@
 
         searchRequest.add( syncReq );
         
-        connection.search( searchRequest );
+        // Do the search
+        connection.search( searchRequest, this );
     }
 
     
@@ -673,12 +674,13 @@
     {
         try
         {
-            if( cookieFile.exists() && cookieFile.length() > 0 )
+            if( cookieFile.exists() && ( cookieFile.length() > 0 ) )
             {
                 FileInputStream fin = new FileInputStream( cookieFile );
                 syncCookie = new byte[ fin.read() ];
                 fin.read( syncCookie );
                 fin.close();
+                
                 LOG.debug( "read the cookie from file: " + StringTools.utf8ToString( syncCookie
) );
             }
         }



Mime
View raw message