| | |
| | | // ID of the backend |
| | | private static final String backendId = "replicationChanges"; |
| | | |
| | | // At startup, the listen thread wait on this flag for the connet |
| | | // thread to look for other servers in the topology. |
| | | // TODO when a replication server is out of date (has old changes |
| | | // to receive from other servers, the listen thread should not accept |
| | | // connection from ldap servers. (issue 1302) |
| | | private boolean connectedInTopology = false; |
| | | private final Object connectedInTopologyLock = new Object(); |
| | | |
| | | /** |
| | | * The tracer object for the debug logger. |
| | | */ |
| | |
| | | void runListen() |
| | | { |
| | | Socket newSocket; |
| | | |
| | | // wait for the connect thread to find other replication |
| | | // servers in the topology before starting to accept connections |
| | | // from the ldap servers. |
| | | synchronized (connectedInTopologyLock) |
| | | { |
| | | if (connectedInTopology == false) |
| | | { |
| | | try |
| | | { |
| | | connectedInTopologyLock.wait(1000); |
| | | } catch (InterruptedException e) |
| | | { |
| | | } |
| | | } |
| | | } |
| | | |
| | | while ((shutdown == false) && (stopListen == false)) |
| | | { |
| | | // Wait on the replicationServer port. |
| | |
| | | } |
| | | } |
| | | } |
| | | synchronized (connectedInTopologyLock) |
| | | { |
| | | // wake up the listen thread if necessary. |
| | | if (connectedInTopology == false) |
| | | { |
| | | connectedInTopologyLock.notify(); |
| | | connectedInTopology = true; |
| | | } |
| | | } |
| | | try |
| | | { |
| | | synchronized (this) |
| | |
| | | // FIXME : Is it better to have the time to receive the ReplServerInfo |
| | | // from all the other replication servers since this info is necessary |
| | | // to route an early received total update request. |
| | | |
| | | try { Thread.sleep(300);} catch(Exception e) {} |
| | | if (debugEnabled()) |
| | | TRACER.debugInfo("RS " +getMonitorInstanceName()+ |
| | | " creates listen threads"); |
| | |
| | | // Add the replication backend |
| | | DirectoryServer.getConfigHandler().addEntry(backendConfigEntry, null); |
| | | } |
| | | ldifImportConfig.close(); |
| | | } |
| | | catch(Exception e) |
| | | { |