Search in sources :

Example 1 with SKGridConfiguration

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

the class MultiDHTExampleTest method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() throws ClientException, IOException {
    SKGridConfiguration gc = Util.getTestGridConfig();
    SKGridConfiguration[] gridConfigurations = { gc, gc };
    String[] preferredServers = { Util.getServer1(), Util.getServer2() };
    mDht = new MultiDHTExample(gridConfigurations, preferredServers);
}
Also used : SKGridConfiguration(com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration) BeforeClass(org.junit.BeforeClass)

Example 2 with SKGridConfiguration

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

the class DependencyWatcher method main.

/**
 * @param args
 */
public static void main(String[] args) {
    try {
        CmdLineParser parser;
        DependencyWatcherOptions options;
        DependencyWatcher dw;
        SKGridConfiguration gc;
        options = new DependencyWatcherOptions();
        parser = new CmdLineParser(options);
        try {
            parser.parseArgument(args);
            gc = SKGridConfiguration.parseFile(options.gridConfig);
            TopoRingConstants.setVerbose(true);
            dw = new DependencyWatcher(gc, options);
            ThreadUtil.sleepForever();
        } 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 3 with SKGridConfiguration

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

the class MasterModeDependencyWatcher method main.

public static void main(String[] args) {
    try {
        MasterModeDependencyWatcherOptions options;
        CmdLineParser parser;
        options = new MasterModeDependencyWatcherOptions();
        parser = new CmdLineParser(options);
        try {
            MasterModeDependencyWatcher dw;
            SKGridConfiguration gc;
            parser.parseArgument(args);
            gc = SKGridConfiguration.parseFile(options.gridConfig);
            TopoRingConstants.setVerbose(true);
            gc = SKGridConfiguration.parseFile(options.gridConfig);
            dw = new MasterModeDependencyWatcher(gc, options);
            ThreadUtil.sleepForever();
        } 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 4 with SKGridConfiguration

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

the class NamedRingConfigurationUtil method getRingName.

private static void getRingName(String gcName) throws IOException, KeeperException {
    SKGridConfiguration gc;
    NamedRingConfiguration ringConfig;
    gc = SKGridConfiguration.parseFile(gcName);
    ringConfig = fromGridConfiguration(gc);
    System.out.println(ringConfig.getRingName());
}
Also used : SKGridConfiguration(com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration)

Example 5 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 && args.length != 5) {
            System.out.println("args: <gridConfig> <id> <mode [Producer|Consumer]> <items> [delay]");
        } else {
            ProducerConsumer pc;
            Mode mode;
            int items;
            SKGridConfiguration gc;
            String id;
            int delay;
            gc = SKGridConfiguration.parseFile(args[0]);
            id = args[1];
            mode = Mode.valueOf(args[2]);
            items = Integer.parseInt(args[3]);
            if (args.length == 5) {
                delay = Integer.parseInt(args[4]);
            } else {
                delay = 0;
            }
            pc = new ProducerConsumer(gc, id, mode, delay);
            pc.run(items);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : NamespaceVersionMode(com.ms.silverking.cloud.dht.NamespaceVersionMode) SKGridConfiguration(com.ms.silverking.cloud.dht.gridconfig.SKGridConfiguration) VersionConstraint(com.ms.silverking.cloud.dht.VersionConstraint) IOException(java.io.IOException) PutException(com.ms.silverking.cloud.dht.client.PutException) RetrievalException(com.ms.silverking.cloud.dht.client.RetrievalException) ClientException(com.ms.silverking.cloud.dht.client.ClientException)

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