Improvement to RedisRunner

Reduced output produced on travis
changed wait time after runner the instance from 3 sec to 1.5 sec
pull/509/head
Rui Gu 9 years ago
parent cc9498994f
commit b6dc4a0891

@ -222,14 +222,14 @@ public class RedisRunner {
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line; String line;
try { try {
while (p.isAlive() && (line = reader.readLine()) != null) { while (p.isAlive() && (line = reader.readLine()) != null && !"true".equalsIgnoreCase(System.getProperty("travisEnv"))) {
System.out.println("REDIS PROCESS: " + line); System.out.println("REDIS PROCESS: " + line);
} }
} catch (IOException ex) { } catch (IOException ex) {
System.out.println("Exception: " + ex.getLocalizedMessage()); System.out.println("Exception: " + ex.getLocalizedMessage());
} }
}).start(); }).start();
Thread.sleep(3000); Thread.sleep(1500);
return new RedisProcess(p, runner); return new RedisProcess(p, runner);
} }
@ -681,7 +681,7 @@ public class RedisRunner {
public boolean deleteDBfileDir() { public boolean deleteDBfileDir() {
File f = new File(defaultDir); File f = new File(defaultDir);
if (f.exists()) { if (f.exists()) {
System.out.println("RedisRunner: Deleting directory " + defaultDir); System.out.println("REDIS RUNNER: Deleting directory " + defaultDir);
return f.delete(); return f.delete();
} }
return false; return false;
@ -692,7 +692,7 @@ public class RedisRunner {
if (f.exists()) { if (f.exists()) {
makeRandomDefaultDir(); makeRandomDefaultDir();
} else { } else {
System.out.println("RedisRunner: Making directory " + f.getAbsolutePath()); System.out.println("REDIS RUNNER: Making directory " + f.getAbsolutePath());
f.mkdirs(); f.mkdirs();
this.defaultDir = f.getAbsolutePath(); this.defaultDir = f.getAbsolutePath();
} }
@ -736,7 +736,7 @@ public class RedisRunner {
public static RedisRunner.RedisProcess startDefaultRedisTestInstance() throws IOException, InterruptedException { public static RedisRunner.RedisProcess startDefaultRedisTestInstance() throws IOException, InterruptedException {
if (defaultRedisInstance == null) { if (defaultRedisInstance == null) {
System.out.println("REDIS PROCESS: Starting up default instance..."); System.out.println("REDIS RUNNER: Starting up default instance...");
defaultRedisInstance = new RedisRunner().nosave().randomDir().run(); defaultRedisInstance = new RedisRunner().nosave().randomDir().run();
Runtime.getRuntime().addShutdownHook(new Thread(() -> { Runtime.getRuntime().addShutdownHook(new Thread(() -> {
try { try {
@ -750,14 +750,14 @@ public class RedisRunner {
public static int shutDownDefaultRedisTestInstance() throws InterruptedException { public static int shutDownDefaultRedisTestInstance() throws InterruptedException {
if (defaultRedisInstance != null) { if (defaultRedisInstance != null) {
System.out.println("REDIS PROCESS: Shutting down default instance..."); System.out.println("REDIS RUNNER: Shutting down default instance...");
try { try {
defaultRedisInstanceExitCode = defaultRedisInstance.stop(); defaultRedisInstanceExitCode = defaultRedisInstance.stop();
} finally { } finally {
defaultRedisInstance = null; defaultRedisInstance = null;
} }
} else { } else {
System.out.println("REDIS PROCESS: Default instance is already down with an exit code " + defaultRedisInstanceExitCode); System.out.println("REDIS RUNNER: Default instance is already down with an exit code " + defaultRedisInstanceExitCode);
} }
return defaultRedisInstanceExitCode; return defaultRedisInstanceExitCode;
} }

Loading…
Cancel
Save