brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject brooklyn-server git commit: Fix NPE in forcePersistNow
Date Thu, 28 Apr 2016 13:39:52 GMT
Repository: brooklyn-server
Updated Branches:
  refs/heads/0.9.x b468717b3 -> 0b371e34b


Fix NPE in forcePersistNow


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/0b371e34
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/0b371e34
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/0b371e34

Branch: refs/heads/0.9.x
Commit: 0b371e34ba15f4d7ccc516df63e7ec0a1b43eddf
Parents: b468717
Author: Andrew Donald Kennedy <andrew.kennedy@cloudsoftcorp.com>
Authored: Wed Apr 20 10:00:50 2016 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Thu Apr 28 14:38:34 2016 +0100

----------------------------------------------------------------------
 .../brooklyn/core/mgmt/rebind/RebindManagerImpl.java      | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/0b371e34/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/RebindManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/RebindManagerImpl.java
b/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/RebindManagerImpl.java
index 5525981..48365d4 100644
--- a/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/RebindManagerImpl.java
+++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/RebindManagerImpl.java
@@ -435,17 +435,23 @@ public class RebindManagerImpl implements RebindManager {
         persistenceRealChangeListener.waitForPendingComplete(timeout, canTrigger);
         persistenceStoreAccess.waitForWritesCompleted(timeout);
     }
+
     @Override
     @VisibleForTesting
     public void forcePersistNow() {
         forcePersistNow(false, null);
     }
+
     @Override
     @VisibleForTesting
     public void forcePersistNow(boolean full, PersistenceExceptionHandler exceptionHandler)
{
+        if (persistenceStoreAccess == null || persistenceRealChangeListener == null) {
+            LOG.info("Skipping forced persist; no persistence mechanism available");
+            return;
+        }
         if (full) {
             BrooklynMementoRawData memento = BrooklynPersistenceUtils.newStateMemento(managementContext,
MementoCopyMode.LOCAL);
-            if (exceptionHandler==null) {
+            if (exceptionHandler == null) {
                 exceptionHandler = persistenceRealChangeListener.getExceptionHandler();
             }
             persistenceStoreAccess.checkpoint(memento, exceptionHandler);
@@ -455,7 +461,7 @@ public class RebindManagerImpl implements RebindManager {
             }
         }
     }
-    
+
     @Override
     public ChangeListener getChangeListener() {
         return persistencePublicChangeListener;


Mime
View raw message