Skip to content

Commit

Permalink
Update help message in SBK-RAM.
Browse files Browse the repository at this point in the history
Signed-off-by: Keshava Munegowda <keshava.gowda@gmail.com>
  • Loading branch information
kmgowda committed Jun 17, 2021
1 parent 58058f3 commit b6f13de
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 11 additions & 2 deletions sbk-ram/src/main/java/io/sbk/ram/impl/SbkRam.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import io.sbk.perl.impl.NanoSeconds;
import io.sbk.system.Printer;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.UnrecognizedOptionException;

import java.io.IOException;
import java.util.Arrays;
Expand Down Expand Up @@ -165,11 +166,19 @@ private static Benchmark createBenchmark(final String[] args, final String appli

params = new SbkRamParameters(appName, ramConfig.maxConnections);
logger.addArgs(params);
params.parseArgs(args);
try {
params.parseArgs(args);
logger.parseArgs(params);
} catch (UnrecognizedOptionException ex) {
Printer.log.error(ex.toString());
params.printHelp();
throw new InstantiationException("print help !");
}
if (params.hasOption("help")) {
params.printHelp();
throw new InstantiationException("print help !");
}
logger.parseArgs(params);

TimeUnit timeUnit = logger.getTimeUnit();
if (timeUnit == TimeUnit.mcs) {
time = new MicroSeconds();
Expand Down
4 changes: 2 additions & 2 deletions sbk-ram/src/main/java/io/sbk/ram/impl/SbkRamParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.UnrecognizedOptionException;


/**
Expand Down Expand Up @@ -51,8 +52,7 @@ public void parseArgs(String[] args) throws ParseException, IllegalArgumentExcep
storageName = getOptionValue("class", null);

if (storageName == null) {
throw new IllegalArgumentException("storage class name is NOT supplied! " +
", run with '-help' to see the options.");
throw new UnrecognizedOptionException("storage 'class' name is NOT supplied! ");
}

String actionString = getOptionValue("action", "r");
Expand Down

0 comments on commit b6f13de

Please sign in to comment.