Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,27 @@ public static interface ThriftServerSupplier {
ServerAddress get() throws UnknownHostException;
}

public static void startServer(AbstractServer server, Logger LOG) throws Exception {
try {
server.runServer();
} catch (Exception e) {
System.err
.println(server.getClass().getSimpleName() + " died, exception thrown from runServer.");
e.printStackTrace();
LOG.error("{} died, exception thrown from runServer.", server.getClass().getSimpleName(), e);
throw e;
} finally {
try {
server.close();
} catch (Exception e) {
System.err.println("Exception thrown while closing " + server.getClass().getSimpleName());
e.printStackTrace();
LOG.error("Exception thrown while closing {}", server.getClass().getSimpleName(), e);
throw e;
}
}
}

private final MetricSource metricSource;
private final ServerContext context;
protected final String applicationName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1063,9 +1063,7 @@ public void run() {
}

public static void main(String[] args) throws Exception {
try (Compactor compactor = new Compactor(new ConfigOpts(), args)) {
compactor.runServer();
}
AbstractServer.startServer(new Compactor(new ConfigOpts(), args), LOG);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ public class SimpleGarbageCollector extends AbstractServer implements Iface {
}

public static void main(String[] args) throws Exception {
try (SimpleGarbageCollector gc = new SimpleGarbageCollector(new ConfigOpts(), args)) {
gc.runServer();
}
AbstractServer.startServer(new SimpleGarbageCollector(new ConfigOpts(), args), log);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,7 @@ public ThreadPoolExecutor getTabletRefreshThreadPool() {
}

public static void main(String[] args) throws Exception {
try (Manager manager = new Manager(new ConfigOpts(), ServerContext::new, args)) {
manager.runServer();
}
AbstractServer.startServer(new Manager(new ConfigOpts(), ServerContext::new, args), log);
}

protected Manager(ConfigOpts opts, Function<SiteConfiguration,ServerContext> serverContextFactory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,7 @@ public class Monitor extends AbstractServer implements Connection.Listener {
private final long START_TIME;

public static void main(String[] args) throws Exception {
try (Monitor monitor = new Monitor(new ConfigOpts(), args)) {
monitor.runServer();
}
AbstractServer.startServer(new Monitor(new ConfigOpts(), args), log);
}

Monitor(ConfigOpts opts, String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1137,9 +1137,7 @@ public BlockCacheConfiguration getBlockCacheConfiguration(AccumuloConfiguration
}

public static void main(String[] args) throws Exception {
try (ScanServer tserver = new ScanServer(new ConfigOpts(), args)) {
tserver.runServer();
}
AbstractServer.startServer(new ScanServer(new ConfigOpts(), args), LOG);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,7 @@ public PausedCompactionMetrics getPausedCompactionMetrics() {
private final ServerContext context;

public static void main(String[] args) throws Exception {
try (TabletServer tserver = new TabletServer(new ConfigOpts(), ServerContext::new, args)) {
tserver.runServer();
}
AbstractServer.startServer(new TabletServer(new ConfigOpts(), ServerContext::new, args), log);
}

protected TabletServer(ConfigOpts opts,
Expand Down