From 0a51f5fbeb5e99c52f1be8973ae656de34fab75f Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 14 Aug 2013 09:30:53 +0000
Subject: [PATCH] OPENDJ-1116 Introduce abstraction for the changelog DB
---
opends/src/server/org/opends/server/replication/server/ECLServerHandler.java | 58 +++++++++++++++++++++++++++-------------------------------
1 files changed, 27 insertions(+), 31 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java b/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java
index eb5ed4e..eae646a 100644
--- a/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java
+++ b/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java
@@ -365,20 +365,19 @@
if (getProtocolVersion() < ProtocolVersion.REPLICATION_PROTOCOL_V4)
{
// Peer DS uses protocol < V4 : send it a ReplServerStartMsg
- startMsg = new ReplServerStartMsg(getReplicationServerId(),
- getReplicationServerURL(), getBaseDN(), maxRcvWindow,
- replicationServerDomain.getDbServerState(),
- localGenerationId, sslEncryption, getLocalGroupId(),
- replicationServerDomain.getReplicationServer()
- .getDegradedStatusThreshold());
+ startMsg = new ReplServerStartMsg(getReplicationServerId(),
+ getReplicationServerURL(), getBaseDN(), maxRcvWindow,
+ replicationServerDomain.getDbServerState(),
+ localGenerationId, sslEncryption, getLocalGroupId(),
+ replicationServer.getDegradedStatusThreshold());
}
else
{
// Peer DS uses protocol V4 : send it a ReplServerStartDSMsg
- startMsg = new ReplServerStartDSMsg(getReplicationServerId(),
- getReplicationServerURL(), getBaseDN(), maxRcvWindow,
- new ServerState(), localGenerationId, sslEncryption,
- getLocalGroupId(), 0, replicationServer.getWeight(), 0);
+ startMsg = new ReplServerStartDSMsg(getReplicationServerId(),
+ getReplicationServerURL(), getBaseDN(), maxRcvWindow,
+ new ServerState(), localGenerationId, sslEncryption,
+ getLocalGroupId(), 0, replicationServer.getWeight(), 0);
}
send(startMsg);
@@ -556,15 +555,13 @@
catch(DirectoryException de)
{
TRACER.debugCaught(DebugLogLevel.ERROR, de);
- if (draftCNDbIter != null)
- draftCNDbIter.releaseCursor();
+ releaseIterator();
throw de;
}
catch(Exception e)
{
TRACER.debugCaught(DebugLogLevel.ERROR, e);
- if (draftCNDbIter != null)
- draftCNDbIter.releaseCursor();
+ releaseIterator();
throw new DirectoryException(
ResultCode.OPERATIONS_ERROR,
Message.raw(Category.SYNC,
@@ -917,11 +914,7 @@
{
if (debugEnabled())
TRACER.debugInfo(this + " shutdown()" + draftCNDbIter);
- if (this.draftCNDbIter != null)
- {
- draftCNDbIter.releaseCursor();
- draftCNDbIter = null;
- }
+ releaseIterator();
for (DomainContext domainCtxt : domainCtxts) {
if (!domainCtxt.unRegisterHandler()) {
logError(Message.raw(Category.SYNC, Severity.NOTICE,
@@ -934,6 +927,15 @@
domainCtxts = null;
}
+ private void releaseIterator()
+ {
+ if (this.draftCNDbIter != null)
+ {
+ this.draftCNDbIter.releaseCursor();
+ this.draftCNDbIter = null;
+ }
+ }
+
/**
* Request to shutdown the associated writer.
*/
@@ -1112,7 +1114,7 @@
{
session.publish(
new ErrorMsg(
- replicationServerDomain.getReplicationServer().getServerId(),
+ replicationServer.getServerId(),
serverId,
Message.raw(Category.SYNC, Severity.INFORMATION,
"Exception raised: " + e.getMessage())));
@@ -1130,11 +1132,9 @@
registerIntoDomain();
if (debugEnabled())
- TRACER.debugInfo(
- this.getClass().getCanonicalName()+ " " + operationId +
- " initialized: " +
- " " + dumpState() + " " +
- " " + clDomCtxtsToString(""));
+ TRACER.debugInfo(getClass().getCanonicalName() + " " + operationId
+ + " initialized: " + " " + dumpState() + " " + " "
+ + clDomCtxtsToString(""));
}
private void initializeChangelogSearch(StartECLSessionMsg msg)
@@ -1522,12 +1522,8 @@
searchPhase = UNDEFINED_PHASE;
}
- if (draftCNDbIter!=null)
- {
- // End of INIT_PHASE => always release the iterator
- draftCNDbIter.releaseCursor();
- draftCNDbIter = null;
- }
+ // End of INIT_PHASE => always release the iterator
+ releaseIterator();
}
/**
--
Gitblit v1.10.0