Fix for 4223 : dsreplication enable --noSchemaReplication fails: routing table is empty
When dsreplication enable runs it create the replication servers configuration
then the replication domain configuration
then attempt to perform an initialization
if this attempt is made too quickly following the creation of the configuration it
can happen that the replication servers are not connected when the initialization
is started and the routing tables of the replications servers not accurate.
This fix synchronize the creation of the replication server domain with the
replication server thread in charge of connecting the replication servers
together so that this problem can't occur anymore.
| | |
| | | ECLWorkflowElement eclwe; |
| | | private static HashSet<Integer> localPorts = new HashSet<Integer>(); |
| | | |
| | | // used to synchronize the domain creation with the connect thread. |
| | | final private Object domainMonitor = new Object(); |
| | | |
| | | /** |
| | | * Creates a new Replication server using the provided configuration entry. |
| | | * |
| | |
| | | } |
| | | try |
| | | { |
| | | synchronized(domainMonitor) |
| | | { |
| | | domainMonitor.notifyAll(); |
| | | } |
| | | synchronized (this) |
| | | { |
| | | /* check if we are connected every second */ |
| | |
| | | { |
| | | replicationServerDomain = new ReplicationServerDomain(baseDn, this); |
| | | baseDNs.put(baseDn, replicationServerDomain); |
| | | synchronized (domainMonitor) |
| | | { |
| | | synchronized (this) |
| | | { |
| | | // kick up the connect thread so that this new domain |
| | | // gets connected to all the Replication Servers. |
| | | this.notify(); |
| | | } |
| | | try |
| | | { |
| | | // wait for the connect thread to signal that it finished its job |
| | | domainMonitor.wait(500); |
| | | } catch (InterruptedException e) |
| | | { |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | domain1 = new FakeReplicationDomain( |
| | | testService, domain1ServerId, servers, 100, 1000, rcvQueue1); |
| | | |
| | | ArrayList<String> servers2 = new ArrayList<String>(1); |
| | | servers2.add("localhost:" + replServerPort2); |
| | | |
| | | BlockingQueue<UpdateMsg> rcvQueue2 = new LinkedBlockingQueue<UpdateMsg>(); |
| | | domain2 = new FakeReplicationDomain( |
| | | testService, domain2ServerId, servers, 100, 1000, rcvQueue2); |
| | | testService, domain2ServerId, servers2, 100, 1000, rcvQueue2); |
| | | |
| | | /* |
| | | * Publish a message from domain1, |