This is an automated email from the ASF dual-hosted git repository.
szetszwo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ratis.git
The following commit(s) were added to refs/heads/master by this push:
new 859a41074 RATIS-2006. Fix DM_EXIT in filestore Client (#1019)
859a41074 is described below
commit 859a41074c9d896563c95d1451a44267276d72be
Author: Doroszlai, Attila <[email protected]>
AuthorDate: Thu Jan 18 02:01:47 2024 +0100
RATIS-2006. Fix DM_EXIT in filestore Client (#1019)
---
ratis-examples/pom.xml | 7 -------
.../main/java/org/apache/ratis/examples/filestore/cli/Client.java | 5 +----
.../java/org/apache/ratis/examples/filestore/cli/DataStream.java | 5 +++--
.../main/java/org/apache/ratis/examples/filestore/cli/LoadGen.java | 2 +-
4 files changed, 5 insertions(+), 14 deletions(-)
diff --git a/ratis-examples/pom.xml b/ratis-examples/pom.xml
index 5e899f8ff..4078f6260 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 086b791e4..1856fc9b5 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 @@ public abstract class Client extends SubCommandBase {
}
- @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 4e4b4dbc6..b15b86057 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 @@ public class DataStream extends Client {
@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 @@ public class DataStream extends Client {
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 8225df9ee..42ffac4e1 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 @@ public class LoadGen extends Client {
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,