brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From geom...@apache.org
Subject [1/2] brooklyn-server git commit: Fix memory leak in BrooklynPersistenceUtils
Date Tue, 25 Apr 2017 15:30:52 GMT
Repository: brooklyn-server
Updated Branches:
  refs/heads/master 547feec96 -> 022fb2fb3


Fix memory leak in BrooklynPersistenceUtils

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

Branch: refs/heads/master
Commit: 6dfb879660328903b6c8f9e4a679b24393893606
Parents: 547feec
Author: Aled Sage <aled.sage@gmail.com>
Authored: Tue Apr 25 15:18:22 2017 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Tue Apr 25 15:18:22 2017 +0100

----------------------------------------------------------------------
 .../core/mgmt/persist/BrooklynPersistenceUtils.java | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6dfb8796/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/BrooklynPersistenceUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/BrooklynPersistenceUtils.java
b/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/BrooklynPersistenceUtils.java
index 62030c8..1219e10 100644
--- a/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/BrooklynPersistenceUtils.java
+++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/BrooklynPersistenceUtils.java
@@ -106,9 +106,13 @@ public class BrooklynPersistenceUtils {
             destinationObjectStore,
             ((ManagementContextInternal)managementContext).getBrooklynProperties(),
             managementContext.getCatalogClassLoader());
-        PersistenceExceptionHandler exceptionHandler = PersistenceExceptionHandlerImpl.builder().build();
-        persister.enableWriteAccess();
-        persister.checkpoint(memento, exceptionHandler);
+        try {
+            PersistenceExceptionHandler exceptionHandler = PersistenceExceptionHandlerImpl.builder().build();
+            persister.enableWriteAccess();
+            persister.checkpoint(memento, exceptionHandler);
+        } finally {
+            persister.stop(true);
+        }
     }
 
     public static void writeManagerMemento(ManagementContext managementContext, ManagementPlaneSyncRecord
optionalPlaneRecord,
@@ -116,7 +120,11 @@ public class BrooklynPersistenceUtils {
         if (optionalPlaneRecord != null) {
             ManagementPlaneSyncRecordPersisterToObjectStore managementPersister = new ManagementPlaneSyncRecordPersisterToObjectStore(
                     managementContext, destinationObjectStore, managementContext.getCatalogClassLoader());
-            managementPersister.checkpoint(optionalPlaneRecord);
+            try {
+                managementPersister.checkpoint(optionalPlaneRecord);
+            } finally {
+                managementPersister.stop();
+            }
         }
     }
 


Mime
View raw message