RATIS-2006. Fix DM_EXIT in filestore Client (#1019)
diff --git a/ratis-examples/pom.xml b/ratis-examples/pom.xml
index 5e899f8..4078f62 100644
--- a/ratis-examples/pom.xml
+++ b/ratis-examples/pom.xml
@@ -122,13 +122,6 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
-
- <dependency>
- <groupId>com.github.spotbugs</groupId>
- <artifactId>spotbugs-annotations</artifactId>
- <scope>provided</scope>
- <optional>true</optional>
- </dependency>
</dependencies>
<build>
<plugins>
diff --git a/ratis-examples/src/main/java/org/apache/ratis/examples/filestore/cli/Client.java b/ratis-examples/src/main/java/org/apache/ratis/examples/filestore/cli/Client.java
index 086b791..1856fc9 100644
--- a/ratis-examples/src/main/java/org/apache/ratis/examples/filestore/cli/Client.java
+++ b/ratis-examples/src/main/java/org/apache/ratis/examples/filestore/cli/Client.java
@@ -18,7 +18,6 @@
package org.apache.ratis.examples.filestore.cli;
import com.beust.jcommander.Parameter;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.apache.ratis.RaftConfigKeys;
import org.apache.ratis.client.RaftClient;
import org.apache.ratis.client.RaftClientConfigKeys;
@@ -143,12 +142,10 @@
}
- @SuppressFBWarnings("DM_EXIT")
- protected void stop(List<FileStoreClient> clients) throws IOException {
+ protected void close(List<FileStoreClient> clients) throws IOException {
for (FileStoreClient client : clients) {
client.close();
}
- System.exit(0);
}
public String getPath(String fileName) {
diff --git a/ratis-examples/src/main/java/org/apache/ratis/examples/filestore/cli/DataStream.java b/ratis-examples/src/main/java/org/apache/ratis/examples/filestore/cli/DataStream.java
index 4e4b4db..b15b860 100644
--- a/ratis-examples/src/main/java/org/apache/ratis/examples/filestore/cli/DataStream.java
+++ b/ratis-examples/src/main/java/org/apache/ratis/examples/filestore/cli/DataStream.java
@@ -116,7 +116,8 @@
@Override
protected void operation(List<FileStoreClient> clients) throws IOException, ExecutionException, InterruptedException {
if (!checkParam()) {
- stop(clients);
+ close(clients);
+ return;
}
final ExecutorService executor = Executors.newFixedThreadPool(getNumThread());
@@ -136,7 +137,7 @@
System.out.println("Total data written: " + totalWrittenBytes + " bytes");
System.out.println("Total time taken: " + (endTime - startTime) + " millis");
- stop(clients);
+ close(clients);
}
private Map<String, CompletableFuture<List<CompletableFuture<DataStreamReply>>>> streamWrite(
diff --git a/ratis-examples/src/main/java/org/apache/ratis/examples/filestore/cli/LoadGen.java b/ratis-examples/src/main/java/org/apache/ratis/examples/filestore/cli/LoadGen.java
index 8225df9..42ffac4 100644
--- a/ratis-examples/src/main/java/org/apache/ratis/examples/filestore/cli/LoadGen.java
+++ b/ratis-examples/src/main/java/org/apache/ratis/examples/filestore/cli/LoadGen.java
@@ -64,7 +64,7 @@
System.out.println("Total data written: " + totalWrittenBytes + " bytes");
System.out.println("Total time taken: " + (endTime - startTime) + " millis");
- stop(clients);
+ close(clients);
}
long write(FileChannel in, long offset, FileStoreClient fileStoreClient, String path,