summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Wall <kwall@apache.org>2014-01-07 17:47:24 +0000
committerKeith Wall <kwall@apache.org>2014-01-07 17:47:24 +0000
commitbe062bf83aef883a94bfc91ec1d4e8ba58890366 (patch)
treeaabd35f1c234458c2c5b4003fc689f6402aabcfc
parentce84d093cdba55fe6a92587d9a9176093e56ab72 (diff)
downloadqpid-python-be062bf83aef883a94bfc91ec1d4e8ba58890366.tar.gz
QPID-5211 - Broker logs spurious "No valid transition from state CLOSED to state CLOSING" on shutdown.
Merged from trunk with the following commands: svn merge -c 1555690 https://svn.apache.org/repos/asf/qpid/trunk/qpid svn merge -c 1555695 https://svn.apache.org/repos/asf/qpid/trunk/qpid git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/0.26@1556287 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java14
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java12
2 files changed, 18 insertions, 8 deletions
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java
index e772498ee9..df12af5a90 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java
@@ -25,6 +25,7 @@ import com.sleepycat.bind.tuple.IntegerBinding;
import com.sleepycat.bind.tuple.LongBinding;
import com.sleepycat.je.*;
import com.sleepycat.je.Transaction;
+
import java.io.File;
import java.lang.ref.SoftReference;
import java.nio.ByteBuffer;
@@ -37,7 +38,9 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;
+import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
+
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.log4j.Logger;
@@ -75,6 +78,8 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
put(EnvironmentConfig.STATS_COLLECT, "false"); // Turn off stats generation - feature introduced (and on by default) from BDB JE 5.0.84
}});
+ private final AtomicBoolean _closed = new AtomicBoolean(false);
+
private Environment _environment;
private static String CONFIGURED_OBJECTS = "CONFIGURED_OBJECTS";
@@ -384,9 +389,12 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
*/
public void close() throws Exception
{
- _stateManager.attainState(State.CLOSING);
- closeInternal();
- _stateManager.attainState(State.CLOSED);
+ if (_closed.compareAndSet(false, true))
+ {
+ _stateManager.attainState(State.CLOSING);
+ closeInternal();
+ _stateManager.attainState(State.CLOSED);
+ }
}
protected void closeInternal() throws Exception
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java
index 4a1452d86c..bc005b8de3 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/store/AbstractJDBCMessageStore.java
@@ -79,7 +79,7 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
private static final int DB_VERSION = 7;
private final AtomicLong _messageId = new AtomicLong(0);
- private AtomicBoolean _closed = new AtomicBoolean(false);
+ private final AtomicBoolean _closed = new AtomicBoolean(false);
private static final String CREATE_DB_VERSION_TABLE = "CREATE TABLE "+ DB_VERSION_TABLE_NAME + " ( version int not null )";
private static final String INSERT_INTO_DB_VERSION = "INSERT INTO "+ DB_VERSION_TABLE_NAME + " ( version ) VALUES ( ? )";
@@ -670,12 +670,14 @@ abstract public class AbstractJDBCMessageStore implements MessageStore, DurableC
@Override
public void close() throws Exception
{
- _closed.getAndSet(true);
- _stateManager.attainState(State.CLOSING);
+ if (_closed.compareAndSet(false, true))
+ {
+ _stateManager.attainState(State.CLOSING);
- doClose();
+ doClose();
- _stateManager.attainState(State.CLOSED);
+ _stateManager.attainState(State.CLOSED);
+ }
}