diff --git a/assembly/pom.xml b/assembly/pom.xml index 7f7f695652..5a3f263b6c 100644 --- a/assembly/pom.xml +++ b/assembly/pom.xml @@ -235,7 +235,6 @@ false org.apache.nifi.controller.FileSystemSwapManager 20000 - ./flowfile_repository/swap 5 sec 1 5 sec 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 6fdc4c1819..ddceb18509 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) { 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 758a9ab7bd..e1d80b062b 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(); 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 7bd5ca1d66..248c0b9c58 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}