From ca243a420602b9f8b441e2d4d53b96601c756e97 Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Tue, 29 May 2007 10:04:40 +0000
Subject: [PATCH] Fix for 1323 : Error message on startup with synchronization enabled
---
opends/src/server/org/opends/server/replication/server/ServerHandler.java | 53 ++++++++++++++++++++++++++++++++++-------------------
1 files changed, 34 insertions(+), 19 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/server/ServerHandler.java b/opends/src/server/org/opends/server/replication/server/ServerHandler.java
index c9d2835..d308870 100644
--- a/opends/src/server/org/opends/server/replication/server/ServerHandler.java
+++ b/opends/src/server/org/opends/server/replication/server/ServerHandler.java
@@ -302,34 +302,49 @@
replicationCache = replicationServer.getReplicationCache(this.baseDn);
+ boolean started;
if (serverIsLDAPserver)
{
- replicationCache.startServer(this);
+ started = replicationCache.startServer(this);
}
else
{
- replicationCache.startReplicationServer(this);
+ started = replicationCache.startReplicationServer(this);
}
- writer = new ServerWriter(session, serverId, this, replicationCache);
-
- reader = new ServerReader(session, serverId, this,
- replicationCache);
-
- reader.start();
- writer.start();
-
- // Create a thread to send heartbeat messages.
- if (heartbeatInterval > 0)
+ if (started)
{
- heartbeatThread = new HeartbeatThread("replication Heartbeat",
- session, heartbeatInterval);
- heartbeatThread.start();
+ writer = new ServerWriter(session, serverId, this, replicationCache);
+
+ reader = new ServerReader(session, serverId, this,
+ replicationCache);
+
+ reader.start();
+ writer.start();
+
+ // Create a thread to send heartbeat messages.
+ if (heartbeatInterval > 0)
+ {
+ heartbeatThread = new HeartbeatThread("replication Heartbeat",
+ session, heartbeatInterval);
+ heartbeatThread.start();
+ }
+
+
+ DirectoryServer.deregisterMonitorProvider(getMonitorInstanceName());
+ DirectoryServer.registerMonitorProvider(this);
}
-
-
- DirectoryServer.deregisterMonitorProvider(getMonitorInstanceName());
- DirectoryServer.registerMonitorProvider(this);
+ else
+ {
+ // the connection is not valid, close it.
+ try
+ {
+ session.close();
+ } catch (IOException e1)
+ {
+ // ignore
+ }
+ }
}
catch (Exception e)
{
--
Gitblit v1.10.0