Search in sources :

Example 1 with HostAndPort

use of com.ms.silverking.net.HostAndPort in project SilverKing by Morgan-Stanley.

the class ByteBufferNetTest method main.

/**
 * @param args
 */
public static void main(String[] args) {
    try {
        if (args.length != 3) {
            displayUsage();
            return;
        } else {
            Mode mode;
            double durationSeconds;
            Log.setLevel(Level.ALL);
            LWTPoolProvider.createDefaultWorkPools();
            mode = Mode.valueOf(args[0]);
            durationSeconds = Double.parseDouble(args[2]);
            switch(mode) {
                case Server:
                    if (args.length != 3) {
                        displayUsage();
                    } else {
                        ByteBufferNetTest bbnTest;
                        int port;
                        port = Integer.parseInt(args[1]);
                        bbnTest = new ByteBufferNetTest(mode, port);
                        ThreadUtil.sleepSeconds(durationSeconds);
                    }
                    break;
                case Client:
                    if (args.length != 3) {
                        displayUsage();
                    } else {
                        ByteBufferNetTest bbnTest;
                        HostAndPort serverAddr;
                        serverAddr = new HostAndPort(args[1]);
                        bbnTest = new ByteBufferNetTest(mode, 0);
                        bbnTest.runClient(serverAddr, durationSeconds);
                    }
                    break;
                default:
                    throw new RuntimeException("panic");
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : HostAndPort(com.ms.silverking.net.HostAndPort) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException)

Example 2 with HostAndPort

use of com.ms.silverking.net.HostAndPort in project SilverKing by Morgan-Stanley.

the class DevTest method main.

/**
 * @param args
 */
public static void main(String[] args) {
    try {
        if (args.length != 9) {
            System.out.println("args: <zkLocs> <dhtName> <valueSize> <numKeys> <reps> <namespace> <compression> <checksum> <tests>");
            return;
        } else {
            HostAndPort[] zkLocs;
            String dhtName;
            int valueSize;
            int numKeys;
            int reps;
            String namespace;
            Compression compression;
            ChecksumType checksumType;
            EnumSet<Test> tests;
            LWTPoolProvider.createDefaultWorkPools();
            zkLocs = HostAndPort.parseMultiple(args[0]);
            dhtName = args[1];
            valueSize = Integer.parseInt(args[2]);
            numKeys = Integer.parseInt(args[3]);
            reps = Integer.parseInt(args[4]);
            namespace = args[5];
            compression = Compression.valueOf(args[6]);
            checksumType = ChecksumType.valueOf(args[7]);
            tests = parseTests(args[8]);
            // Log.setLevelAll();
            new DevTest(zkLocs, dhtName, valueSize).test(numKeys, reps, namespace, compression, checksumType, tests);
        // ThreadUtil.sleep(60000);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : HostAndPort(com.ms.silverking.net.HostAndPort) Compression(com.ms.silverking.cloud.dht.client.Compression) ChecksumType(com.ms.silverking.cloud.dht.client.ChecksumType)

Aggregations

HostAndPort (com.ms.silverking.net.HostAndPort)2 ChecksumType (com.ms.silverking.cloud.dht.client.ChecksumType)1 Compression (com.ms.silverking.cloud.dht.client.Compression)1 IOException (java.io.IOException)1 UnknownHostException (java.net.UnknownHostException)1