Search in sources :

Example 6 with ClientContext

use of org.apache.cassandra.client.ClientContext 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

ClientContext (org.apache.cassandra.client.ClientContext)6 ByteBuffer (java.nio.ByteBuffer)3 IOException (java.io.IOException)1 InetAddress (java.net.InetAddress)1 ServerSocket (java.net.ServerSocket)1 Socket (java.net.Socket)1 SocketException (java.net.SocketException)1 QueryPath (org.apache.cassandra.db.filter.QueryPath)1 MarshalException (org.apache.cassandra.db.marshal.MarshalException)1 StressThread (org.apache.cassandra.stress.server.StressThread)1 EvtAndLvt (org.apache.cassandra.utils.ColumnOrSuperColumnHelper.EvtAndLvt)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 Test (org.junit.Test)1