NIFI-632 moving thread startup from constructor to initialize methods

Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/e1a59c47
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/e1a59c47
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/e1a59c47

Branch: refs/heads/develop
Commit: e1a59c47b7373c1165cc10623e4a2c945e470a4b
Parents: 53b86d7
Author: danbress <dbr...@onyxconsults.com>
Authored: Sat Jun 13 12:22:38 2015 -0400
Committer: danbress <dbr...@onyxconsults.com>
Committed: Sat Jun 13 12:22:38 2015 -0400

----------------------------------------------------------------------
 .../repository/FileSystemRepository.java        | 34 ++++++++++----------
 .../repository/VolatileContentRepository.java   |  8 ++---
 2 files changed, 21 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e1a59c47/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java
----------------------------------------------------------------------
diff --git 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java
 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java
index 3a03fad..1171636 100644
--- 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java
+++ 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java
@@ -130,7 +130,6 @@ public class FileSystemRepository implements 
ContentRepository {
         final String maxArchiveRetentionPeriod = 
properties.getProperty(NiFiProperties.CONTENT_ARCHIVE_MAX_RETENTION_PERIOD);
         final String maxArchiveSize = 
properties.getProperty(NiFiProperties.CONTENT_ARCHIVE_MAX_USAGE_PERCENTAGE);
         final String archiveBackPressureSize = 
properties.getProperty(NiFiProperties.CONTENT_ARCHIVE_BACK_PRESSURE_PERCENTAGE);
-        final String archiveCleanupFrequency = 
properties.getProperty(NiFiProperties.CONTENT_ARCHIVE_CLEANUP_FREQUENCY);
 
         if ("true".equalsIgnoreCase(enableArchiving)) {
             archiveData = true;
@@ -193,6 +192,23 @@ public class FileSystemRepository implements 
ContentRepository {
         LOG.info("Initializing FileSystemRepository with 'Always Sync' set to 
{}", alwaysSync);
         initializeRepository();
 
+        containerCleanupExecutor = new FlowEngine(containers.size(), "Cleanup 
FileSystemRepository Container", true);
+    }
+
+    @Override
+    public void initialize(final ContentClaimManager claimManager) {
+        this.contentClaimManager = claimManager;
+
+        final NiFiProperties properties = NiFiProperties.getInstance();
+
+        final Map<String, Path> fileRespositoryPaths = 
properties.getContentRepositoryPaths();
+
+        executor.scheduleWithFixedDelay(new BinDestructableClaims(), 1, 1, 
TimeUnit.SECONDS);
+        for (int i = 0; i < fileRespositoryPaths.size(); i++) {
+            executor.scheduleWithFixedDelay(new 
ArchiveOrDestroyDestructableClaims(), 1, 1, TimeUnit.SECONDS);
+        }
+
+        final String archiveCleanupFrequency = 
properties.getProperty(NiFiProperties.CONTENT_ARCHIVE_CLEANUP_FREQUENCY);
         final long cleanupMillis;
         if (archiveCleanupFrequency == null) {
             cleanupMillis = 1000L;
@@ -203,8 +219,6 @@ public class FileSystemRepository implements 
ContentRepository {
                 throw new RuntimeException("Invalid value set for property " + 
NiFiProperties.CONTENT_ARCHIVE_CLEANUP_FREQUENCY);
             }
         }
-
-        containerCleanupExecutor = new FlowEngine(containers.size(), "Cleanup 
FileSystemRepository Container", true);
         for (final Map.Entry<String, Path> containerEntry : 
containers.entrySet()) {
             final String containerName = containerEntry.getKey();
             final Path containerPath = containerEntry.getValue();
@@ -214,20 +228,6 @@ public class FileSystemRepository implements 
ContentRepository {
     }
 
     @Override
-    public void initialize(final ContentClaimManager claimManager) {
-        this.contentClaimManager = claimManager;
-
-        final NiFiProperties properties = NiFiProperties.getInstance();
-
-        final Map<String, Path> fileRespositoryPaths = 
properties.getContentRepositoryPaths();
-
-        executor.scheduleWithFixedDelay(new BinDestructableClaims(), 1, 1, 
TimeUnit.SECONDS);
-        for (int i = 0; i < fileRespositoryPaths.size(); i++) {
-            executor.scheduleWithFixedDelay(new 
ArchiveOrDestroyDestructableClaims(), 1, 1, TimeUnit.SECONDS);
-        }
-    }
-
-    @Override
     public void shutdown() {
         executor.shutdown();
         containerCleanupExecutor.shutdown();

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/e1a59c47/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/VolatileContentRepository.java
----------------------------------------------------------------------
diff --git 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/VolatileContentRepository.java
 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/VolatileContentRepository.java
index 5971865..6109ba3 100644
--- 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/VolatileContentRepository.java
+++ 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/VolatileContentRepository.java
@@ -118,15 +118,15 @@ public class VolatileContentRepository implements 
ContentRepository {
         }
 
         memoryManager = new MemoryManager(maxBytes, blockSize);
-
-        for (int i = 0; i < 3; i++) {
-            executor.scheduleWithFixedDelay(new CleanupOldClaims(), 1000, 10, 
TimeUnit.MILLISECONDS);
-        }
     }
 
     @Override
     public void initialize(final ContentClaimManager claimManager) {
         this.claimManager = claimManager;
+
+        for (int i = 0; i < 3; i++) {
+            executor.scheduleWithFixedDelay(new CleanupOldClaims(), 1000, 10, 
TimeUnit.MILLISECONDS);
+        }
     }
 
     @Override

Reply via email to