From a5131f44a6afa554af8f4c82c7ffd3d4ceac1bd4 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Fri, 04 Feb 2011 12:50:58 +0000
Subject: [PATCH] OPEN - issue OPENDJ-26: Fix OpenDS issue 4585: ConcurrentModificationException in ReplicationBroker https://bugster.forgerock.org/jira/browse/OPENDJ-26
---
opends/src/server/org/opends/server/replication/protocol/HeartbeatThread.java | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/protocol/HeartbeatThread.java b/opends/src/server/org/opends/server/replication/protocol/HeartbeatThread.java
index 8b97568..778a5a4 100644
--- a/opends/src/server/org/opends/server/replication/protocol/HeartbeatThread.java
+++ b/opends/src/server/org/opends/server/replication/protocol/HeartbeatThread.java
@@ -23,6 +23,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2011 ForgeRock AS
*/
package org.opends.server.replication.protocol;
@@ -50,25 +51,25 @@
/**
* For test purposes only to simulate loss of heartbeats.
*/
- static private boolean heartbeatsDisabled = false;
+ private static volatile boolean heartbeatsDisabled = false;
/**
* The session on which heartbeats are to be sent.
*/
- private ProtocolSession session;
+ private final ProtocolSession session;
/**
* The time in milliseconds between heartbeats.
*/
- private long heartbeatInterval;
+ private final long heartbeatInterval;
/**
* Set this to stop the thread.
*/
- private Boolean shutdown = false;
- private final Object shutdown_lock = new Object();
+ private volatile boolean shutdown = false;
+ private final Object shutdownLock = new Object();
/**
@@ -136,11 +137,11 @@
TRACER.debugVerbose("Heartbeat thread sleeping for %d", sleepTime);
}
- synchronized (shutdown_lock)
+ synchronized (shutdownLock)
{
if (!shutdown)
{
- shutdown_lock.wait(sleepTime);
+ shutdownLock.wait(sleepTime);
}
}
}
@@ -174,10 +175,10 @@
*/
public void shutdown()
{
- synchronized (shutdown_lock)
+ synchronized (shutdownLock)
{
shutdown = true;
- shutdown_lock.notifyAll();
+ shutdownLock.notifyAll();
if (debugEnabled())
{
TRACER.debugInfo("Going to notify Heartbeat thread.");
--
Gitblit v1.10.0