Repository: incubator-nifi Updated Branches: refs/heads/develop d6c02a564 -> a183d88f2
NIFI-44: Removed the swap directory property and always use the 'swap' directory under the flowfile repo Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/394c7116 Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/394c7116 Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/394c7116 Branch: refs/heads/develop Commit: 394c7116d1ac134265bd2264b78550f485c62996 Parents: 4399177 Author: Mark Payne <marka...@hotmail.com> Authored: Tue Dec 30 16:30:13 2014 -0500 Committer: Mark Payne <marka...@hotmail.com> Committed: Tue Dec 30 16:30:13 2014 -0500 ---------------------------------------------------------------------- assembly/pom.xml | 1 - .../main/java/org/apache/nifi/util/NiFiProperties.java | 10 ---------- .../org/apache/nifi/controller/FileSystemSwapManager.java | 7 +++++-- .../resources/src/main/resources/conf/nifi.properties | 1 - 4 files changed, 5 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/394c7116/assembly/pom.xml ---------------------------------------------------------------------- diff --git a/assembly/pom.xml b/assembly/pom.xml index 7f7f695..5a3f263 100644 --- a/assembly/pom.xml +++ b/assembly/pom.xml @@ -235,7 +235,6 @@ <nifi.flowfile.repository.always.sync>false</nifi.flowfile.repository.always.sync> <nifi.swap.manager.implementation>org.apache.nifi.controller.FileSystemSwapManager</nifi.swap.manager.implementation> <nifi.queue.swap.threshold>20000</nifi.queue.swap.threshold> - <nifi.swap.storage.directory>./flowfile_repository/swap</nifi.swap.storage.directory> <nifi.swap.in.period>5 sec</nifi.swap.in.period> <nifi.swap.in.threads>1</nifi.swap.in.threads> <nifi.swap.out.period>5 sec</nifi.swap.out.period> http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/394c7116/commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java ---------------------------------------------------------------------- diff --git a/commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java b/commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java index 6fdc4c1..ddceb18 100644 --- a/commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java +++ b/commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java @@ -84,7 +84,6 @@ public class NiFiProperties extends Properties { public static final String FLOWFILE_REPOSITORY_CHECKPOINT_INTERVAL = "nifi.flowfile.repository.checkpoint.interval"; public static final String FLOWFILE_SWAP_MANAGER_IMPLEMENTATION = "nifi.swap.manager.implementation"; public static final String QUEUE_SWAP_THRESHOLD = "nifi.queue.swap.threshold"; - public static final String SWAP_STORAGE_LOCATION = "nifi.swap.storage.directory"; public static final String SWAP_IN_THREADS = "nifi.swap.in.threads"; public static final String SWAP_IN_PERIOD = "nifi.swap.in.period"; public static final String SWAP_OUT_THREADS = "nifi.swap.out.threads"; @@ -314,15 +313,6 @@ public class NiFiProperties extends Properties { } } - public File getSwapStorageLocation() { - final String location = getProperty(SWAP_STORAGE_LOCATION); - if (location == null) { - return new File(DEFAULT_SWAP_STORAGE_LOCATION); - } else { - return new File(location); - } - } - public Integer getIntegerProperty(final String propertyName, final Integer defaultValue) { final String value = getProperty(propertyName); if (value == null) { http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/394c7116/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/FileSystemSwapManager.java ---------------------------------------------------------------------- diff --git a/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/FileSystemSwapManager.java b/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/FileSystemSwapManager.java index 758a9ab..e1d80b0 100644 --- a/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/FileSystemSwapManager.java +++ b/nar-bundles/framework-bundle/framework/core/src/main/java/org/apache/nifi/controller/FileSystemSwapManager.java @@ -28,6 +28,7 @@ import java.io.FilenameFilter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.nio.file.Path; import java.util.ArrayList; import java.util.Collection; import java.util.Comparator; @@ -103,14 +104,16 @@ public class FileSystemSwapManager implements FlowFileSwapManager { private static final Logger logger = LoggerFactory.getLogger(FileSystemSwapManager.class); public FileSystemSwapManager() { - this.storageDirectory = NiFiProperties.getInstance().getSwapStorageLocation(); + final NiFiProperties properties = NiFiProperties.getInstance(); + final Path flowFileRepoPath = properties.getFlowFileRepositoryPath(); + + this.storageDirectory = flowFileRepoPath.resolve("swap").toFile(); if (!storageDirectory.exists() && !storageDirectory.mkdirs()) { throw new RuntimeException("Cannot create Swap Storage directory " + storageDirectory.getAbsolutePath()); } swapQueueIdentifierExecutor = new FlowEngine(1, "Identifies Queues for FlowFile Swapping"); - final NiFiProperties properties = NiFiProperties.getInstance(); swapInMillis = FormatUtils.getTimeDuration(properties.getSwapInPeriod(), TimeUnit.MILLISECONDS); swapOutMillis = FormatUtils.getTimeDuration(properties.getSwapOutPeriod(), TimeUnit.MILLISECONDS); swapOutThreadCount = properties.getSwapOutThreads(); http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/394c7116/nar-bundles/framework-bundle/framework/resources/src/main/resources/conf/nifi.properties ---------------------------------------------------------------------- diff --git a/nar-bundles/framework-bundle/framework/resources/src/main/resources/conf/nifi.properties b/nar-bundles/framework-bundle/framework/resources/src/main/resources/conf/nifi.properties index 7bd5ca1..248c0b9 100644 --- a/nar-bundles/framework-bundle/framework/resources/src/main/resources/conf/nifi.properties +++ b/nar-bundles/framework-bundle/framework/resources/src/main/resources/conf/nifi.properties @@ -45,7 +45,6 @@ nifi.flowfile.repository.always.sync=${nifi.flowfile.repository.always.sync} nifi.swap.manager.implementation=${nifi.swap.manager.implementation} nifi.queue.swap.threshold=${nifi.queue.swap.threshold} -nifi.swap.storage.directory=${nifi.swap.storage.directory} nifi.swap.in.period=${nifi.swap.in.period} nifi.swap.in.threads=${nifi.swap.in.threads} nifi.swap.out.period=${nifi.swap.out.period}