Search in sources :

Example 1 with StressThread

use of org.apache.cassandra.stress.server.StressThread in project eiger by wlloyd.

the class StressServer method main.

public static void main(String[] args) throws Exception {
    ServerSocket serverSocket = null;
    CommandLineParser parser = new PosixParser();
    InetAddress address = InetAddress.getByName("127.0.0.1");
    try {
        CommandLine cmd = parser.parse(availableOptions, args);
        if (cmd.hasOption("h")) {
            address = InetAddress.getByName(cmd.getOptionValue("h"));
        }
    } catch (ParseException e) {
        System.err.printf("Usage: ./bin/stressd start|stop|status [-h <host>]");
        System.exit(1);
    }
    try {
        serverSocket = new ServerSocket(2159, 0, address);
    } catch (IOException e) {
        System.err.printf("Could not listen on port: %s:2159.%n", address.getHostAddress());
        System.exit(1);
    }
    // one across everything here (though that's probably not what we'd want)
    for (; ; ) new StressThread(serverSocket.accept(), new ClientContext()).start();
}
Also used : CommandLine(org.apache.commons.cli.CommandLine) PosixParser(org.apache.commons.cli.PosixParser) ClientContext(org.apache.cassandra.client.ClientContext) StressThread(org.apache.cassandra.stress.server.StressThread) ServerSocket(java.net.ServerSocket) CommandLineParser(org.apache.commons.cli.CommandLineParser) ParseException(org.apache.commons.cli.ParseException) IOException(java.io.IOException) InetAddress(java.net.InetAddress)

Aggregations

IOException (java.io.IOException)1 InetAddress (java.net.InetAddress)1 ServerSocket (java.net.ServerSocket)1 ClientContext (org.apache.cassandra.client.ClientContext)1 StressThread (org.apache.cassandra.stress.server.StressThread)1 CommandLine (org.apache.commons.cli.CommandLine)1 CommandLineParser (org.apache.commons.cli.CommandLineParser)1 ParseException (org.apache.commons.cli.ParseException)1 PosixParser (org.apache.commons.cli.PosixParser)1