Permalink
Browse files

Refactor duplicated code

  • Loading branch information...
mkjsix committed Aug 9, 2018
1 parent 5ee1e90 commit 6ff027e3af5dbf10c81e657b2acd979fdbc84d61
Showing with 15 additions and 20 deletions.
  1. +15 −20 src/main/java/org/restheart/Bootstrapper.java
@@ -157,16 +157,7 @@ public static void main(final String[] args) {
startServer(false);
} else {
if (OSChecker.isWindows()) {
String instanceName = getInstanceName();
LOGGER.info(STARTING
+ ansi().fg(RED).bold().a(RESTHEART).reset().toString()
+ INSTANCE
+ ansi().fg(RED).bold().a(instanceName).reset().toString());
if (RESTHEART_VERSION != null) {
LOGGER.info(VERSION, ansi().fg(MAGENTA).bold().a(RESTHEART_VERSION).reset().toString());
}
logWindowsStart();
LOGGER.error("Fork is not supported on Windows");
@@ -220,6 +211,19 @@ public static void main(final String[] args) {
}
}
private static void logWindowsStart() {
String instanceName = getInstanceName();
LOGGER.info(STARTING
+ ansi().fg(RED).bold().a(RESTHEART).reset().toString()
+ INSTANCE
+ ansi().fg(RED).bold().a(instanceName).reset().toString());
if (RESTHEART_VERSION != null) {
LOGGER.info(VERSION, ansi().fg(MAGENTA).bold().a(RESTHEART_VERSION).reset().toString());
}
}
/**
* logs warning message if pid file exists
*
@@ -358,16 +362,7 @@ private static boolean hasForkOption(final String[] args) {
* @param fork
*/
private static void startServer(boolean fork) {
String instanceName = getInstanceName();
LOGGER.info(STARTING
+ ansi().fg(RED).bold().a(RESTHEART).reset().toString()
+ INSTANCE
+ ansi().fg(RED).bold().a(instanceName).reset().toString());
if (RESTHEART_VERSION != null) {
LOGGER.info(VERSION, ansi().fg(MAGENTA).bold().a(RESTHEART_VERSION).reset().toString());
}
logWindowsStart();
Path pidFilePath = FileUtils.getPidFilePath(
FileUtils.getFileAbsoultePathHash(CONF_FILE_PATH));

0 comments on commit 6ff027e

Please sign in to comment.