qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lqu...@apache.org
Subject svn commit: r1753192 - in /qpid/java/trunk: bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/ broker-core/src/main/java/org/apache/qpid/server/store/preferences/ broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/...
Date Mon, 18 Jul 2016 10:02:39 GMT
Author: lquack
Date: Mon Jul 18 10:02:39 2016
New Revision: 1753192

URL: http://svn.apache.org/viewvc?rev=1753192&view=rev
Log:
QPID-7335: [Java Broker] Ensure thread safety of PreferenceStore operations

Modified:
    qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBPreferenceStore.java
    qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBConfigurationStore.java
    qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBPreferenceStore.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/AbstractJDBCPreferenceStore.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/JsonFilePreferenceStore.java
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/PreferenceRecordImpl.java
    qpid/java/trunk/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyConfigurationStore.java
    qpid/java/trunk/broker-plugins/derby-store/src/test/java/org/apache/qpid/server/store/derby/DerbyPreferenceStoreTest.java
    qpid/java/trunk/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/GenericJDBCConfigurationStore.java

Modified: qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBPreferenceStore.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBPreferenceStore.java?rev=1753192&r1=1753191&r2=1753192&view=diff
==============================================================================
--- qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBPreferenceStore.java
(original)
+++ qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBPreferenceStore.java
Mon Jul 18 10:02:39 2016
@@ -28,6 +28,7 @@ import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.UUID;
 import java.util.concurrent.atomic.AtomicReference;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import com.sleepycat.bind.tuple.LongBinding;
 import com.sleepycat.bind.tuple.StringBinding;
@@ -55,7 +56,8 @@ abstract class AbstractBDBPreferenceStor
 {
     private static final String PREFERENCES_DB_NAME = "USER_PREFERENCES";
     private static final String PREFERENCES_VERSION_DB_NAME = "USER_PREFERENCES_VERSION";
-    private AtomicReference<StoreState> _storeState = new AtomicReference<>(StoreState.CLOSED);
+    private final AtomicReference<StoreState> _storeState = new AtomicReference<>(StoreState.CLOSED);
+    private final ReentrantReadWriteLock _useOrCloseRWLock = new ReentrantReadWriteLock(true);
 
     @Override
     public Collection<PreferenceRecord> openAndLoad(final PreferenceStoreUpdater updater)
throws StoreException
@@ -107,36 +109,45 @@ abstract class AbstractBDBPreferenceStor
     @Override
     public void updateOrCreate(final Collection<PreferenceRecord> preferenceRecords)
     {
-        if (!getStoreState().equals(StoreState.OPENED))
+        _useOrCloseRWLock.readLock().lock();
+        try
         {
-            throw new IllegalStateException("PreferenceStore is not opened");
-        }
+            if (!getStoreState().equals(StoreState.OPENED))
+            {
+                throw new IllegalStateException("PreferenceStore is not opened");
+            }
 
-        if (preferenceRecords.isEmpty())
-        {
-            return;
-        }
+            if (preferenceRecords.isEmpty())
+            {
+                return;
+            }
 
-        EnvironmentFacade environmentFacade = getEnvironmentFacade();
-        Transaction txn = null;
-        try
-        {
-            txn = environmentFacade.beginTransaction(null);
-            updateOrCreateInternal(txn, preferenceRecords);
-            txn.commit();
-            txn = null;
-        }
-        catch (RuntimeException e)
-        {
-            throw environmentFacade.handleDatabaseException("Error on preferences updateOrCreate:
" + e.getMessage(),
-                                                            e);
+            EnvironmentFacade environmentFacade = getEnvironmentFacade();
+            Transaction txn = null;
+            try
+            {
+                txn = environmentFacade.beginTransaction(null);
+                updateOrCreateInternal(txn, preferenceRecords);
+                txn.commit();
+                txn = null;
+            }
+            catch (RuntimeException e)
+            {
+                throw environmentFacade.handleDatabaseException("Error on preferences updateOrCreate:
"
+                                                                + e.getMessage(),
+                                                                e);
+            }
+            finally
+            {
+                if (txn != null)
+                {
+                    abortTransactionSafely(txn, environmentFacade);
+                }
+            }
         }
         finally
         {
-            if (txn != null)
-            {
-                abortTransactionSafely(txn, environmentFacade);
-            }
+            _useOrCloseRWLock.readLock().unlock();
         }
     }
 
@@ -144,88 +155,117 @@ abstract class AbstractBDBPreferenceStor
     public void replace(final Collection<UUID> preferenceRecordsToRemove,
                         final Collection<PreferenceRecord> preferenceRecordsToAdd)
     {
-        if (!getStoreState().equals(StoreState.OPENED))
+        _useOrCloseRWLock.readLock().lock();
+        try
         {
-            throw new IllegalStateException("PreferenceStore is not opened");
-        }
+            if (!getStoreState().equals(StoreState.OPENED))
+            {
+                throw new IllegalStateException("PreferenceStore is not opened");
+            }
 
-        if (preferenceRecordsToRemove.isEmpty() && preferenceRecordsToAdd.isEmpty())
-        {
-            return;
-        }
+            if (preferenceRecordsToRemove.isEmpty() && preferenceRecordsToAdd.isEmpty())
+            {
+                return;
+            }
 
-        EnvironmentFacade environmentFacade = getEnvironmentFacade();
-        Transaction txn = null;
-        try
-        {
-            txn = environmentFacade.beginTransaction(null);
-            Database preferencesDb = getPreferencesDb();
-            DatabaseEntry key = new DatabaseEntry();
-            UUIDTupleBinding keyBinding = UUIDTupleBinding.getInstance();
-            for (UUID id : preferenceRecordsToRemove)
+            EnvironmentFacade environmentFacade = getEnvironmentFacade();
+            Transaction txn = null;
+            try
             {
-                getLogger().debug("Removing preference {}", id);
-                keyBinding.objectToEntry(id, key);
-                OperationStatus status = preferencesDb.delete(txn, key);
-                if (status == OperationStatus.NOTFOUND)
+                txn = environmentFacade.beginTransaction(null);
+                Database preferencesDb = getPreferencesDb();
+                DatabaseEntry key = new DatabaseEntry();
+                UUIDTupleBinding keyBinding = UUIDTupleBinding.getInstance();
+                for (UUID id : preferenceRecordsToRemove)
                 {
-                    getLogger().debug("Preference {} not found", id);
+                    getLogger().debug("Removing preference {}", id);
+                    keyBinding.objectToEntry(id, key);
+                    OperationStatus status = preferencesDb.delete(txn, key);
+                    if (status == OperationStatus.NOTFOUND)
+                    {
+                        getLogger().debug("Preference {} not found", id);
+                    }
+                }
+                updateOrCreateInternal(txn, preferenceRecordsToAdd);
+                txn.commit();
+                txn = null;
+            }
+            catch (RuntimeException e)
+            {
+                throw environmentFacade.handleDatabaseException("Error on replacing of preferences:
" + e.getMessage(),
+                                                                e);
+            }
+            finally
+            {
+                if (txn != null)
+                {
+                    abortTransactionSafely(txn, environmentFacade);
                 }
             }
-            updateOrCreateInternal(txn, preferenceRecordsToAdd);
-            txn.commit();
-            txn = null;
-        }
-        catch (RuntimeException e)
-        {
-            throw environmentFacade.handleDatabaseException("Error on replacing of preferences:
" + e.getMessage(), e);
         }
         finally
         {
-            if (txn != null)
-            {
-                abortTransactionSafely(txn, environmentFacade);
-            }
+            _useOrCloseRWLock.readLock().unlock();
         }
     }
 
     @Override
     public void onDelete()
     {
-        close();
-        doDelete();
+        _useOrCloseRWLock.writeLock().lock();
+        try
+        {
+            close();
+            doDelete();
+        }
+        finally
+        {
+            _useOrCloseRWLock.writeLock().unlock();
+        }
     }
 
-    protected abstract void doDelete();
-
-    protected abstract EnvironmentFacade getEnvironmentFacade();
-
-    protected abstract Logger getLogger();
-
-    boolean closeInternal()
+    @Override
+    public void close()
     {
-        while (true)
+        _useOrCloseRWLock.writeLock().lock();
+        try
         {
-            StoreState storeState = getStoreState();
-            if (storeState.equals(StoreState.OPENED) || storeState.equals(StoreState.ERRORED))
+            while (true)
             {
-                if (_storeState.compareAndSet(storeState, StoreState.CLOSING))
+                StoreState storeState = getStoreState();
+                if (storeState.equals(StoreState.OPENED) || storeState.equals(StoreState.ERRORED))
                 {
-                    break;
+                    if (_storeState.compareAndSet(storeState, StoreState.CLOSING))
+                    {
+                        break;
+                    }
+                }
+                else if (storeState.equals(StoreState.CLOSED) || storeState.equals(StoreState.CLOSING))
+                {
+                    return;
                 }
             }
-            else if (storeState.equals(StoreState.CLOSED) || storeState.equals(StoreState.CLOSING))
-            {
-                return false;
-            }
-        }
 
-        getEnvironmentFacade().closeDatabase(PREFERENCES_DB_NAME);
+            getEnvironmentFacade().closeDatabase(PREFERENCES_DB_NAME);
+
+            doClose();
+            _storeState.set(StoreState.CLOSED);
 
-        _storeState.set(StoreState.CLOSED);
-        return true;
+        }
+        finally
+        {
+            _useOrCloseRWLock.writeLock().unlock();
+        }
     }
 
+    protected abstract void doClose();
+
+    protected abstract void doDelete();
+
+    protected abstract EnvironmentFacade getEnvironmentFacade();
+
+    protected abstract Logger getLogger();
+
     StoreState getStoreState()
     {
         return _storeState.get();

Modified: qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBConfigurationStore.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBConfigurationStore.java?rev=1753192&r1=1753191&r2=1753192&view=diff
==============================================================================
--- qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBConfigurationStore.java
(original)
+++ qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBConfigurationStore.java
Mon Jul 18 10:02:39 2016
@@ -632,9 +632,9 @@ public class BDBConfigurationStore imple
         }
 
         @Override
-        public void close()
+        protected void doClose()
         {
-            closeInternal();
+            // noop
         }
 
         @Override

Modified: qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBPreferenceStore.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBPreferenceStore.java?rev=1753192&r1=1753191&r2=1753192&view=diff
==============================================================================
--- qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBPreferenceStore.java
(original)
+++ qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBPreferenceStore.java
Mon Jul 18 10:02:39 2016
@@ -117,19 +117,16 @@ public class BDBPreferenceStore extends
     }
 
     @Override
-    public void close()
+    protected void doClose()
     {
-        if (closeInternal())
+        try
         {
-            try
-            {
-                _environmentFacade.close();
-                _environmentFacade = null;
-            }
-            catch (RuntimeException e)
-            {
-                throw new StoreException("Exception occurred on preference store close",
e);
-            }
+            _environmentFacade.close();
+            _environmentFacade = null;
+        }
+        catch (RuntimeException e)
+        {
+            throw new StoreException("Exception occurred on preference store close", e);
         }
     }
 

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/AbstractJDBCPreferenceStore.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/AbstractJDBCPreferenceStore.java?rev=1753192&r1=1753191&r2=1753192&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/AbstractJDBCPreferenceStore.java
(original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/AbstractJDBCPreferenceStore.java
Mon Jul 18 10:02:39 2016
@@ -35,6 +35,7 @@ import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.UUID;
 import java.util.concurrent.atomic.AtomicReference;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -64,6 +65,7 @@ public abstract class AbstractJDBCPrefer
     private static final String UPDATE_PREFERENCES = "UPDATE " + PREFERENCES_TABLE_NAME +
" SET attributes = ? WHERE id = ?";
 
     private final AtomicReference<StoreState> _storeState = new AtomicReference<>(StoreState.CLOSED);
+    private final ReentrantReadWriteLock _useOrCloseRWLock = new ReentrantReadWriteLock(true);
 
     @Override
     public Collection<PreferenceRecord> openAndLoad(final PreferenceStoreUpdater updater)
throws StoreException
@@ -118,74 +120,115 @@ public abstract class AbstractJDBCPrefer
     @Override
     public void updateOrCreate(final Collection<PreferenceRecord> preferenceRecords)
     {
-        if (!getStoreState().equals(StoreState.OPENED))
-        {
-            throw new IllegalStateException("PreferenceStore is not opened");
-        }
-
-        performSafeTransaction(new BaseAction<Connection, Exception>()
+        _useOrCloseRWLock.readLock().lock();
+        try
         {
-            @Override
-            public void performAction(final Connection connection) throws Exception
+            if (!getStoreState().equals(StoreState.OPENED))
             {
-                updateOrCreateInternal(connection, preferenceRecords);
+                throw new IllegalStateException("PreferenceStore is not opened");
             }
-        });
+
+            performSafeTransaction(new BaseAction<Connection, Exception>()
+            {
+                @Override
+                public void performAction(final Connection connection) throws Exception
+                {
+                    updateOrCreateInternal(connection, preferenceRecords);
+                }
+            });
+        }
+        finally
+        {
+            _useOrCloseRWLock.readLock().unlock();
+        }
     }
 
     @Override
     public void replace(final Collection<UUID> preferenceRecordsToRemove,
                         final Collection<PreferenceRecord> preferenceRecordsToAdd)
     {
-        if (!getStoreState().equals(StoreState.OPENED))
+        _useOrCloseRWLock.readLock().lock();
+        try
         {
-            throw new IllegalStateException("PreferenceStore is not opened");
-        }
+            if (!getStoreState().equals(StoreState.OPENED))
+            {
+                throw new IllegalStateException("PreferenceStore is not opened");
+            }
 
-        performSafeTransaction(new BaseAction<Connection, Exception>()
-        {
-            @Override
-            public void performAction(final Connection connection) throws Exception
+            performSafeTransaction(new BaseAction<Connection, Exception>()
             {
-                for (UUID id : preferenceRecordsToRemove)
+                @Override
+                public void performAction(final Connection connection) throws Exception
                 {
-                    try (PreparedStatement deleteStatement = connection.prepareStatement(DELETE_FROM_PREFERENCES))
+                    for (UUID id : preferenceRecordsToRemove)
                     {
-                        deleteStatement.setString(1, id.toString());
-                        int deletedCount = deleteStatement.executeUpdate();
-                        if (deletedCount == 1)
+                        try (PreparedStatement deleteStatement = connection.prepareStatement(DELETE_FROM_PREFERENCES))
                         {
-                            getLogger().debug(String.format("Failed to delete preference
with id %s : no such record", id));
+                            deleteStatement.setString(1, id.toString());
+                            int deletedCount = deleteStatement.executeUpdate();
+                            if (deletedCount == 1)
+                            {
+                                getLogger().debug(String.format(
+                                        "Failed to delete preference with id %s : no such
record",
+                                        id));
+                            }
                         }
                     }
+                    updateOrCreateInternal(connection, preferenceRecordsToAdd);
                 }
-                updateOrCreateInternal(connection, preferenceRecordsToAdd);
-            }
-        });
+            });
+        }
+        finally
+        {
+            _useOrCloseRWLock.readLock().unlock();
+        }
+    }
+
+    @Override
+    public void onDelete()
+    {
+        _useOrCloseRWLock.writeLock().lock();
+        try
+        {
+            close();
+            doDelete();
+        }
+        finally
+        {
+            _useOrCloseRWLock.writeLock().unlock();
+        }
     }
 
     @Override
     public void close()
     {
-        while (true)
+        _useOrCloseRWLock.writeLock().lock();
+        try
         {
-            StoreState storeState = getStoreState();
-            if (storeState.equals(StoreState.OPENED) || storeState.equals(StoreState.ERRORED))
+            while (true)
             {
-                if (_storeState.compareAndSet(storeState, StoreState.CLOSING))
+                StoreState storeState = getStoreState();
+                if (storeState.equals(StoreState.OPENED) || storeState.equals(StoreState.ERRORED))
                 {
-                    break;
+                    if (_storeState.compareAndSet(storeState, StoreState.CLOSING))
+                    {
+                        break;
+                    }
+                }
+                else if (storeState.equals(StoreState.CLOSED) || storeState.equals(StoreState.CLOSING))
+                {
+                    return;
                 }
             }
-            else if (storeState.equals(StoreState.CLOSED) || storeState.equals(StoreState.CLOSING))
-            {
-                return;
-            }
-        }
 
-        doClose();
+            doClose();
 
-        _storeState.set(StoreState.CLOSED);
+            _storeState.set(StoreState.CLOSED);
+        }
+        finally
+        {
+            _useOrCloseRWLock.writeLock().unlock();
+        }
     }
 
     protected void dropTables(final Connection connection) throws SQLException
@@ -201,6 +244,8 @@ public abstract class AbstractJDBCPrefer
         }
     }
 
+    protected abstract void doDelete();
+
     protected abstract void doClose();
 
     protected abstract Logger getLogger();

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/JsonFilePreferenceStore.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/JsonFilePreferenceStore.java?rev=1753192&r1=1753191&r2=1753192&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/JsonFilePreferenceStore.java
(original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/JsonFilePreferenceStore.java
Mon Jul 18 10:02:39 2016
@@ -26,7 +26,6 @@ import java.util.Collections;
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.UUID;
-import java.util.concurrent.atomic.AtomicReference;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.SerializationFeature;
@@ -42,8 +41,8 @@ public class JsonFilePreferenceStore ext
     private final String _storePath;
     private final String _posixFilePermissions;
     private final ObjectMapper _objectMapper;
-    private Map<UUID, StoredPreferenceRecord> _recordMap;
-    private AtomicReference<StoreState> _storeState = new AtomicReference<>(StoreState.CLOSED);
+    private final Map<UUID, StoredPreferenceRecord> _recordMap;
+    private StoreState _storeState = StoreState.CLOSED;
 
     public JsonFilePreferenceStore(String path, String posixFilePermissions)
     {
@@ -55,12 +54,12 @@ public class JsonFilePreferenceStore ext
     }
 
     @Override
-    public Collection<PreferenceRecord> openAndLoad(final PreferenceStoreUpdater updater)
throws StoreException
+    public synchronized Collection<PreferenceRecord> openAndLoad(final PreferenceStoreUpdater
updater) throws StoreException
     {
-        if (!_storeState.compareAndSet(StoreState.CLOSED, StoreState.OPENING))
+        if (_storeState != StoreState.CLOSED)
         {
             throw new IllegalStateException(String.format("PreferenceStore cannot be opened
when in state '%s'",
-                                                          _storeState.get()));
+                                                          _storeState));
         }
 
         try
@@ -104,47 +103,34 @@ public class JsonFilePreferenceStore ext
                 _recordMap.put(preferenceRecord.getId(), preferenceRecord);
             }
 
-            _storeState.set(StoreState.OPENED);
+            _storeState = StoreState.OPENED;
 
             return records;
         }
         catch (Exception e)
         {
-            _storeState.set(StoreState.ERRORED);
+            _storeState = StoreState.ERRORED;
             close();
             throw e;
         }
     }
 
     @Override
-    public void close()
+    public synchronized void close()
     {
-        while (true)
+        if (_storeState != StoreState.CLOSED)
         {
-            StoreState storeState = _storeState.get();
-            if (storeState.equals(StoreState.OPENED) || storeState.equals(StoreState.ERRORED))
-            {
-                if (_storeState.compareAndSet(storeState, StoreState.CLOSING))
-                {
-                    break;
-                }
-            }
-            else if (storeState.equals(StoreState.CLOSED) || storeState.equals(StoreState.CLOSING))
-            {
-                return;
-            }
-        }
-
-        cleanup();
-        _recordMap.clear();
+            cleanup();
+            _recordMap.clear();
 
-        _storeState.set(StoreState.CLOSED);
+            _storeState = StoreState.CLOSED;
+        }
     }
 
     @Override
-    public void updateOrCreate(final Collection<PreferenceRecord> preferenceRecords)
+    public synchronized void updateOrCreate(final Collection<PreferenceRecord> preferenceRecords)
     {
-        if (!_storeState.get().equals(StoreState.OPENED))
+        if (_storeState != StoreState.OPENED)
         {
             throw new IllegalStateException("PreferenceStore is not opened");
         }
@@ -158,10 +144,10 @@ public class JsonFilePreferenceStore ext
     }
 
     @Override
-    public void replace(final Collection<UUID> preferenceRecordsToRemove,
+    public synchronized void replace(final Collection<UUID> preferenceRecordsToRemove,
                         final Collection<PreferenceRecord> preferenceRecordsToAdd)
     {
-        if (!_storeState.get().equals(StoreState.OPENED))
+        if (_storeState != StoreState.OPENED)
         {
             throw new IllegalStateException("PreferenceStore is not opened");
         }
@@ -176,7 +162,7 @@ public class JsonFilePreferenceStore ext
     }
 
     @Override
-    public void onDelete()
+    public synchronized void onDelete()
     {
         close();
         delete(_storePath);
@@ -202,10 +188,10 @@ public class JsonFilePreferenceStore ext
 
     private enum StoreState
     {
-        CLOSED, OPENING, OPENED, CLOSING, ERRORED;
+        CLOSED, OPENED, ERRORED;
     }
 
-    public static class StoreContent
+    private static class StoreContent
     {
         private String _version;
         private StoredPreferenceRecord[] _preferences = new StoredPreferenceRecord[0];
@@ -243,7 +229,7 @@ public class JsonFilePreferenceStore ext
         }
     }
 
-    public static class StoredPreferenceRecord implements PreferenceRecord
+    private static class StoredPreferenceRecord implements PreferenceRecord
     {
         private UUID _id;
         private Map<String, Object> _attributes;

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/PreferenceRecordImpl.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/PreferenceRecordImpl.java?rev=1753192&r1=1753191&r2=1753192&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/PreferenceRecordImpl.java
(original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/store/preferences/PreferenceRecordImpl.java
Mon Jul 18 10:02:39 2016
@@ -19,6 +19,7 @@
 
 package org.apache.qpid.server.store.preferences;
 
+import java.util.Collections;
 import java.util.Map;
 import java.util.UUID;
 
@@ -49,6 +50,6 @@ public class PreferenceRecordImpl implem
     @Override
     public Map<String, Object> getAttributes()
     {
-        return _attributes;
+        return Collections.unmodifiableMap(_attributes);
     }
 }

Modified: qpid/java/trunk/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyConfigurationStore.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyConfigurationStore.java?rev=1753192&r1=1753191&r2=1753192&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyConfigurationStore.java
(original)
+++ qpid/java/trunk/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyConfigurationStore.java
Mon Jul 18 10:02:39 2016
@@ -275,7 +275,7 @@ public class DerbyConfigurationStore ext
         }
 
         @Override
-        public void onDelete()
+        protected void doDelete()
         {
             try
             {

Modified: qpid/java/trunk/broker-plugins/derby-store/src/test/java/org/apache/qpid/server/store/derby/DerbyPreferenceStoreTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/derby-store/src/test/java/org/apache/qpid/server/store/derby/DerbyPreferenceStoreTest.java?rev=1753192&r1=1753191&r2=1753192&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/derby-store/src/test/java/org/apache/qpid/server/store/derby/DerbyPreferenceStoreTest.java
(original)
+++ qpid/java/trunk/broker-plugins/derby-store/src/test/java/org/apache/qpid/server/store/derby/DerbyPreferenceStoreTest.java
Mon Jul 18 10:02:39 2016
@@ -304,7 +304,7 @@ public class DerbyPreferenceStoreTest ex
         }
 
         @Override
-        public void onDelete()
+        protected void doDelete()
         {
             // noop
         }

Modified: qpid/java/trunk/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/GenericJDBCConfigurationStore.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/GenericJDBCConfigurationStore.java?rev=1753192&r1=1753191&r2=1753192&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/GenericJDBCConfigurationStore.java
(original)
+++ qpid/java/trunk/broker-plugins/jdbc-store/src/main/java/org/apache/qpid/server/store/jdbc/GenericJDBCConfigurationStore.java
Mon Jul 18 10:02:39 2016
@@ -346,7 +346,7 @@ public class GenericJDBCConfigurationSto
         }
 
         @Override
-        public void onDelete()
+        protected void doDelete()
         {
             try
             {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message