blob: 9d87a6f68f4a30239ecaf5402becb8853aeafe5d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespastat;
/**
* Main application class
*
* @author bjorncs
*/
public class Main {
private Main() {
}
public static void main(String[] args) {
CommandLineOptions options = new CommandLineOptions();
try {
ClientParameters params = options.parseCommandLineArguments(args);
if (params.help) {
options.printHelp();
return;
}
BucketStatsRetriever retriever = new BucketStatsRetriever(
new DocumentAccessFactory(),
params.route,
createShutdownHookRegistrar());
BucketStatsPrinter printer = new BucketStatsPrinter(retriever, System.out);
printer.retrieveAndPrintBucketStats(params.selectionType, params.id, params.dumpData);
} catch (IllegalArgumentException e) {
System.err.printf("Failed to parse command line arguments: %s.\n", e.getMessage());
} catch (BucketStatsException e) {
System.err.println(e.getMessage());
}
}
private static BucketStatsRetriever.ShutdownHookRegistrar createShutdownHookRegistrar() {
return runnable -> Runtime.getRuntime().addShutdownHook(new Thread(runnable));
}
}
|