Search in sources :

Example 11 with SKGridConfiguration

use of com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration in project SilverKing by Morgan-Stanley.

the class HealthMonitor method main.

// ////////////////////////
public static void main(String[] args) {
    try {
        CmdLineParser parser;
        HealthMonitorOptions options;
        HealthMonitor healthMonitor;
        SKGridConfiguration gc;
        options = new HealthMonitorOptions();
        parser = new CmdLineParser(options);
        try {
            ConvictionLimits convictionLimits;
            parser.parseArgument(args);
            gc = SKGridConfiguration.parseFile(options.gridConfig);
            convictionLimits = ConvictionLimits.parse(options.convictionLimits);
            LogStreamConfig.configureLogStreams(gc, logFileName);
            healthMonitor = new HealthMonitor(gc, gc.getClientDHTConfiguration().getZKConfig(), options.watchIntervalSeconds, options.guiltThreshold, options.doctorRoundIntervalSeconds, options.forceInclusionOfUnsafeExcludedServers, convictionLimits, options.doctorNodeStartupTimeoutSeconds, options.disableAddition);
            healthMonitor.monitor();
        } catch (CmdLineException cle) {
            System.err.println(cle.getMessage());
            parser.printUsage(System.err);
            System.exit(-1);
        }
    } catch (Exception e) {
        e.printStackTrace();
        System.exit(-1);
    }
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) SKGridConfiguration(com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration) CmdLineException(org.kohsuke.args4j.CmdLineException) KeeperException(org.apache.zookeeper.KeeperException) IOException(java.io.IOException) CmdLineException(org.kohsuke.args4j.CmdLineException)

Example 12 with SKGridConfiguration

use of com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration in project SilverKing by Morgan-Stanley.

the class MemoizedFibonacci method main.

public static void main(String[] args) {
    try {
        if (args.length != 2) {
            usage();
        } else {
            MemoizedFibonacci fib;
            SKGridConfiguration gridConfig;
            int n;
            int fn;
            gridConfig = SKGridConfiguration.parseFile(args[0]);
            n = Integer.parseInt(args[1]);
            if (n < 1) {
                System.out.printf("n must be >= 1 for this demo\n");
            } else {
                fib = new MemoizedFibonacci(gridConfig);
                fn = fib.fibonacci(n);
                System.out.printf("fibonacci(%d) = %d", n, fn);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : SKGridConfiguration(com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration) IOException(java.io.IOException) ClientException(com.ms.silverking.cloud.dht.client.ClientException)

Example 13 with SKGridConfiguration

use of com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration in project SilverKing by Morgan-Stanley.

the class ProducerConsumer method main.

public static void main(String[] args) {
    try {
        if (args.length != 4) {
            usage();
        } else {
            ProducerConsumer pc;
            SKGridConfiguration gridConfig;
            Mode mode;
            int startKey;
            int endKey;
            gridConfig = SKGridConfiguration.parseFile(args[0]);
            mode = Mode.valueOf(args[1]);
            startKey = Integer.parseInt(args[2]);
            endKey = Integer.parseInt(args[3]);
            pc = new ProducerConsumer(gridConfig);
            pc.run(mode, startKey, endKey);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : SKGridConfiguration(com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration) PutException(com.ms.silverking.cloud.dht.client.PutException) IOException(java.io.IOException) RetrievalException(com.ms.silverking.cloud.dht.client.RetrievalException) ClientException(com.ms.silverking.cloud.dht.client.ClientException)

Example 14 with SKGridConfiguration

use of com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration in project SilverKing by Morgan-Stanley.

the class AsyncMemoizedFibonacci method main.

public static void main(String[] args) {
    try {
        if (args.length != 2) {
            usage();
        } else {
            AsyncMemoizedFibonacci fib;
            SKGridConfiguration gridConfig;
            int n;
            int fn;
            gridConfig = SKGridConfiguration.parseFile(args[0]);
            n = Integer.parseInt(args[1]);
            if (n < 1) {
                System.out.printf("n must be >= 1 for this demo\n");
            } else {
                fib = new AsyncMemoizedFibonacci(gridConfig);
                fn = fib.fibonacci(n);
                System.out.printf("fibonacci(%d) = %d", n, fn);
                System.out.printf("\nWaiting for async writes to complete...\n");
                fib.waitForAsyncWrites();
                System.out.printf("Async writes are complete\n");
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : SKGridConfiguration(com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration) IOException(java.io.IOException) ClientException(com.ms.silverking.cloud.dht.client.ClientException) WaitForCompletionException(com.ms.silverking.cloud.dht.client.WaitForCompletionException)

Example 15 with SKGridConfiguration

use of com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration in project SilverKing by Morgan-Stanley.

the class ExclusionFileMonitor method main.

// ////////////////////
public static void main(String[] args) {
    try {
        CmdLineParser parser;
        ExclusionFileMonitorOptions options;
        ExclusionFileMonitor exclusionFileMonitor;
        SKGridConfiguration gc;
        options = new ExclusionFileMonitorOptions();
        parser = new CmdLineParser(options);
        try {
            parser.parseArgument(args);
            gc = SKGridConfiguration.parseFile(options.gridConfig);
            LogStreamConfig.configureLogStreams(gc, logFileName);
            exclusionFileMonitor = new ExclusionFileMonitor(gc, options.watchIntervalSeconds, options.exclusionFile);
            exclusionFileMonitor.monitor();
        } catch (CmdLineException cle) {
            System.err.println(cle.getMessage());
            parser.printUsage(System.err);
            System.exit(-1);
        }
    } catch (Exception e) {
        e.printStackTrace();
        System.exit(-1);
    }
}
Also used : CmdLineParser(org.kohsuke.args4j.CmdLineParser) SKGridConfiguration(com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration) CmdLineException(org.kohsuke.args4j.CmdLineException) KeeperException(org.apache.zookeeper.KeeperException) IOException(java.io.IOException) CmdLineException(org.kohsuke.args4j.CmdLineException)

Aggregations

SKGridConfiguration (com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration)22 IOException (java.io.IOException)18 KeeperException (org.apache.zookeeper.KeeperException)11 ClientException (com.ms.silverking.cloud.dht.client.ClientException)10 CmdLineException (org.kohsuke.args4j.CmdLineException)8 CmdLineParser (org.kohsuke.args4j.CmdLineParser)8 RetrievalException (com.ms.silverking.cloud.dht.client.RetrievalException)4 PutException (com.ms.silverking.cloud.dht.client.PutException)3 File (java.io.File)3 ConvergencePoint (com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint)2 NamespaceVersionMode (com.ms.silverking.cloud.dht.NamespaceVersionMode)1 VersionConstraint (com.ms.silverking.cloud.dht.VersionConstraint)1 ClientDHTConfiguration (com.ms.silverking.cloud.dht.client.ClientDHTConfiguration)1 OperationException (com.ms.silverking.cloud.dht.client.OperationException)1 WaitForCompletionException (com.ms.silverking.cloud.dht.client.WaitForCompletionException)1 RingID (com.ms.silverking.cloud.dht.daemon.storage.convergence.RingID)1 RingIDAndVersionPair (com.ms.silverking.cloud.dht.daemon.storage.convergence.RingIDAndVersionPair)1 IneligibleServerException (com.ms.silverking.cloud.dht.meta.IneligibleServerException)1 MetaToolOptions (com.ms.silverking.cloud.management.MetaToolOptions)1 RingRegion (com.ms.silverking.cloud.ring.RingRegion)1