Author: kayyagari Date: Fri Oct 7 00:27:13 2011 New Revision: 1179910 URL: http://svn.apache.org/viewvc?rev=1179910&view=rev Log: o fix for DIRSERVER-1666 Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplSearchListener.java Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java?rev=1179910&r1=1179909&r2=1179910&view=diff ============================================================================== --- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java (original) +++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java Fri Oct 7 00:27:13 2011 @@ -532,7 +532,19 @@ public class ReplicationConsumerImpl imp */ public void start() { - connect(); + while ( ! connect() ) + { + try + { + // try to establish a connection for every 5 seconds + Thread.sleep( 5000 ); + } + catch( InterruptedException e ) + { + LOG.warn( "Interrupted while trying to reconnect to the provider {} with user DN", config.getRemoteHost(), config.getReplUserDn() ); + } + } + startSync(); } Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplSearchListener.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplSearchListener.java?rev=1179910&r1=1179909&r2=1179910&view=diff ============================================================================== --- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplSearchListener.java (original) +++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/SyncReplSearchListener.java Fri Oct 7 00:27:13 2011 @@ -77,8 +77,6 @@ public class SyncReplSearchListener impl /** The consumer configuration */ private final ReplicaEventLog consumerMsgLog; - private DirectoryService directoryService; - /** * Create a new instance of a consumer listener @@ -92,10 +90,9 @@ public class SyncReplSearchListener impl boolean pushInRealTime ) { this.pushInRealTime = pushInRealTime; - this.session = session; + setSession( session ); setSearchRequest( searchRequest ); this.consumerMsgLog = consumerMsgLog; - directoryService = session.getLdapServer().getDirectoryService(); } @@ -106,7 +103,6 @@ public class SyncReplSearchListener impl public void setSession( LdapSession session ) { this.session = session; - directoryService = session.getLdapServer().getDirectoryService(); } @@ -138,7 +134,7 @@ public class SyncReplSearchListener impl if ( session != null ) { // We first remove the Listener from the session's chain - directoryService.getEventService().removeListener( this ); + session.getCoreSession().getDirectoryService().getEventService().removeListener( this ); } /* @@ -219,7 +215,7 @@ public class SyncReplSearchListener impl resultEntry.setEntry( entry ); // Create the control which will be added to the response. - SyncStateValue syncAdd = createControl( directoryService, SyncStateTypeEnum.ADD, entry ); + SyncStateValue syncAdd = createControl( session.getCoreSession().getDirectoryService(), SyncStateTypeEnum.ADD, entry ); sendResult( resultEntry, entry, EventType.ADD, syncAdd ); } @@ -262,7 +258,7 @@ public class SyncReplSearchListener impl resultEntry.setObjectName( entry.getDn() ); resultEntry.setEntry( entry ); - SyncStateValue syncDelete = createControl( directoryService, SyncStateTypeEnum.DELETE, entry ); + SyncStateValue syncDelete = createControl( session.getCoreSession().getDirectoryService(), SyncStateTypeEnum.DELETE, entry ); sendResult( resultEntry, entry, EventType.DELETE, syncDelete ); } @@ -297,7 +293,7 @@ public class SyncReplSearchListener impl resultEntry.setObjectName( modifyContext.getDn() ); resultEntry.setEntry( alteredEntry ); - SyncStateValue syncModify = createControl( directoryService, SyncStateTypeEnum.MODIFY, alteredEntry ); + SyncStateValue syncModify = createControl( session.getCoreSession().getDirectoryService(), SyncStateTypeEnum.MODIFY, alteredEntry ); sendResult( resultEntry, alteredEntry, EventType.MODIFY, syncModify ); } @@ -337,7 +333,7 @@ public class SyncReplSearchListener impl resultEntry.setObjectName( moveContext.getDn() ); resultEntry.setEntry( entry ); - SyncStateValue syncModify = createControl( directoryService, SyncStateTypeEnum.MODDN, entry ); + SyncStateValue syncModify = createControl( session.getCoreSession().getDirectoryService(), SyncStateTypeEnum.MODDN, entry ); sendResult( resultEntry, entry, null, syncModify ); } @@ -378,7 +374,7 @@ public class SyncReplSearchListener impl resultEntry.setObjectName( entry.getDn() ); resultEntry.setEntry( entry ); - SyncStateValue syncModify = createControl( directoryService, SyncStateTypeEnum.MODDN, entry ); + SyncStateValue syncModify = createControl( session.getCoreSession().getDirectoryService(), SyncStateTypeEnum.MODDN, entry ); sendResult( resultEntry, entry, null, syncModify ); } @@ -413,7 +409,7 @@ public class SyncReplSearchListener impl resultEntry.setObjectName( entry.getDn() ); resultEntry.setEntry( entry ); - SyncStateValue syncModify = createControl( directoryService, SyncStateTypeEnum.MODDN, entry ); + SyncStateValue syncModify = createControl( session.getCoreSession().getDirectoryService(), SyncStateTypeEnum.MODDN, entry ); // In this case, the cookie is different syncModify.setCookie( getCookie( entry ) );