Example usage for org.apache.cassandra.tools.nodetool GetTimeout TIMEOUT_TYPES

List of usage examples for org.apache.cassandra.tools.nodetool GetTimeout TIMEOUT_TYPES

Introduction

In this page you can find the example usage for org.apache.cassandra.tools.nodetool GetTimeout TIMEOUT_TYPES.

Prototype

String TIMEOUT_TYPES

To view the source code for org.apache.cassandra.tools.nodetool GetTimeout TIMEOUT_TYPES.

Click Source Link

Usage

From source file:com.wenyu.clustertools.SetTimeout.java

License:Apache License

@Override
public void execute() {
    checkArgument(args.size() == 2,/*ww  w . ja  v  a 2  s .  c  o  m*/
            "Timeout type followed by value in ms (0 disables socket streaming timeout)."
                    + " Type should be one of (" + GetTimeout.TIMEOUT_TYPES + ")");

    ExecutorService executor = Executors.newFixedThreadPool(parallel);

    Map<Node, Future<String>> futures = new HashMap<>();
    for (ClusterToolCmd.Node node : nodes) {
        futures.put(node, executor.submit(new Executor(node)));
    }

    for (Map.Entry<ClusterToolCmd.Node, Future<String>> future : futures.entrySet()) {
        try {
            String result = future.getValue().get(Constants.MAX_PARALLEL_WAIT_IN_SEC, TimeUnit.SECONDS);
            System.out.println(result);
        } catch (Exception ex) {
            System.out
                    .println(String.format("%s failed with error: %s", future.getKey().server, ex.toString()));
            ex.printStackTrace();
        }
    }
}

From source file:com.wenyu.utils.ClusterToolNodeProbe.java

License:Apache License

public long getTimeout(String type) {
    switch (type) {
    case "misc":
        return ssProxy.getRpcTimeout();
    case "read":
        return ssProxy.getReadRpcTimeout();
    case "range":
        return ssProxy.getRangeRpcTimeout();
    case "write":
        return ssProxy.getWriteRpcTimeout();
    case "counterwrite":
        return ssProxy.getCounterWriteRpcTimeout();
    case "cascontention":
        return ssProxy.getCasContentionTimeout();
    case "truncate":
        return ssProxy.getTruncateRpcTimeout();
    case "streamingsocket":
        return (long) ssProxy.getStreamingSocketTimeout();
    default:/*from w  ww . j  a v  a2s . c  om*/
        throw new RuntimeException("Timeout type requires one of (" + GetTimeout.TIMEOUT_TYPES + ")");
    }
}

From source file:com.wenyu.utils.ClusterToolNodeProbe.java

License:Apache License

public void setTimeout(String type, long value) {
    if (value < 0)
        throw new RuntimeException("timeout must be non-negative");

    switch (type) {
    case "misc":
        ssProxy.setRpcTimeout(value);/*from ww  w .jav a  2 s . c  o  m*/
        break;
    case "read":
        ssProxy.setReadRpcTimeout(value);
        break;
    case "range":
        ssProxy.setRangeRpcTimeout(value);
        break;
    case "write":
        ssProxy.setWriteRpcTimeout(value);
        break;
    case "counterwrite":
        ssProxy.setCounterWriteRpcTimeout(value);
        break;
    case "cascontention":
        ssProxy.setCasContentionTimeout(value);
        break;
    case "truncate":
        ssProxy.setTruncateRpcTimeout(value);
        break;
    case "streamingsocket":
        if (value > Integer.MAX_VALUE)
            throw new RuntimeException("streamingsocket timeout must be less than " + Integer.MAX_VALUE);
        ssProxy.setStreamingSocketTimeout((int) value);
        break;
    default:
        throw new RuntimeException("Timeout type requires one of (" + GetTimeout.TIMEOUT_TYPES + ")");
    }
}