Skip to content

Commit

Permalink
Merge pull request #7 from cyberjso/dev
Browse files Browse the repository at this point in the history
Run DCC on the console acceptting telemetry mode as parameter
  • Loading branch information
diegopacheco authored Jan 12, 2017
2 parents 8bde48e + 4783600 commit a07e97c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,17 @@ public String toPrettyTelemetryJson(){
pritIfNotNull(" \"server\":\"" + server + "\",\r\n",server) +
pritIfNotNull(" \"seeds\":\"" + seeds + "\",\r\n",seeds) +
pritIfNotNull(" \"insertTime\":\"" + getInsertTime(insertTime) + "\",\r\n",insertTime) +
pritIfNotNull(" \"getTime\":\"" + new Double(getTime.replace("ms", "").trim()).intValue() + "\",\r\n",getTime) +
pritIfNotNull(" \"getTime\":\"" + new Double(getTime().replace("ms", "").trim()).intValue() + "\",\r\n",getTime) +
pritIfNotNull(" \"insertError\":\"" + resolveErrorTelemetry(insertError) + "\",\r\n",resolveErrorTelemetry(insertError)) +
pritIfNotNull(" \"getError\":\"" + resolveErrorTelemetry(getError) + "\",\r\n",resolveErrorTelemetry(getError)) +
" \"consistency\":\"" + resolveBoolean(consistency) + "\"\r\n" +
" }";
}

private String getTime() {
return getTime == null ? "0" : getTime;
}

private int getInsertTime(String insertTime) {
return (insertTime == null) ? 0 : new Double(insertTime.replace("ms", "").trim()).intValue();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,24 @@ public class DynomiteClusterCheckerMain {
public static void main(String[] args){
Long init = System.currentTimeMillis();
try{
String seeds = args[0];
Boolean isTelemetryMode = isTelemtryModeSet(args) ? true : false;
DynomiteClusterCheckerMain dcc = new DynomiteClusterCheckerMain();
//dcc.run(args[0],false);
//dcc.run("200.56.0.1:8101:rack1:local-dc:437425602",true);
dcc.run("227.0.0.1:8101:rack1:local-dc:437425602|127.0.0.1:8101:rack1:local-dc:437425602",false);
//dcc.run("jack.cats.com:8101:rack1:local-dc:437425602",false);
}finally {
dcc.run(seeds, isTelemetryMode);
} finally {
Long end = System.currentTimeMillis();
System.out.println("--");
System.out.println( "TIME TO RUN: " + TimeUnit.MILLISECONDS.toSeconds((end-init)) + " seconds");
}
}


private static boolean isTelemtryModeSet(String[] args) {
if (args.length < 2) return false;

String parameter = args[1];
return (parameter.equalsIgnoreCase("false") || parameter.equalsIgnoreCase("true"));
}

public String run(String seeds,boolean telemetryMode){

Long init = System.currentTimeMillis();
Expand Down

0 comments on commit a07e97c

Please sign in to comment.