Package voldemort.cluster.failuredetector

Examples of voldemort.cluster.failuredetector.FailureDetector


     */
    @Test
    public void testConfigureNodesLocalHost() throws Exception {
        List<Node> nodes = getTestNodes();
        Cluster cluster = new Cluster("test-route-all-local-pref-cluster", nodes);
        FailureDetector failureDetector = new ThresholdFailureDetector(new FailureDetectorConfig().setCluster(cluster));
        RoutingStrategy routingStrategy = new RouteToAllLocalPrefStrategy(cluster.getNodes());
        BasicPipelineData<byte[]> pipelineData = new BasicPipelineData<byte[]>();
        ConfigureNodesLocalHost<byte[], BasicPipelineData<byte[]>> action = new ConfigureNodesLocalHost<byte[], BasicPipelineData<byte[]>>(pipelineData,
                                                                                                                                           Event.COMPLETED,
                                                                                                                                           failureDetector,
View Full Code Here


        }

        FailureDetectorConfig failureDetectorConfig = new FailureDetectorConfig().setImplementationClassName(BannagePeriodFailureDetector.class.getName())
                                                                                 .setCluster(cluster)
                                                                                 .setStoreVerifier(MutableStoreVerifier.create(stores));
        FailureDetector failureDetector = FailureDetectorUtils.create(failureDetectorConfig, false);

        ExecutorService routedStoreThreadPool = Executors.newFixedThreadPool(clientConfig.getMaxThreads());
        RoutedStoreFactory routedStoreFactory = new RoutedStoreFactory(routedStoreThreadPool);
        RoutedStoreConfig routedStoreConfig = new RoutedStoreConfig(clientConfig);

        final RoutedStore routedStore = routedStoreFactory.create(cluster,
                                                                  storeDefinition,
                                                                  stores,
                                                                  failureDetector,
                                                                  routedStoreConfig);

        ExecutorService runner = Executors.newFixedThreadPool(numClients);
        long start = System.nanoTime();

        try {
            for(int i = 0; i < numClients; i++) {
                runner.submit(new Runnable() {

                    public void run() {

                        for(int i = 0; i < numKeys; i++) {
                            ByteArray key = new ByteArray(("test-key-" + i).getBytes());
                            try {
                                routedStore.get(key, null);
                            } catch(VoldemortException e) {
                                //
                            }
                        }
                    }

                });
            }

            runner.shutdown();
            runner.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
            long time = (System.nanoTime() - start) / Time.NS_PER_MS;

            System.err.println("Time: " + time + " ms.");
        } finally {
            runner.shutdown();
        }

        if(failureDetector != null)
            failureDetector.destroy();

        for(VoldemortServer server: serverMap.values())
            server.stop();

        if(routedStoreThreadPool != null)
View Full Code Here

        /*
         * Check if we need to retrieve a reference to the failure detector. For
         * system stores - the FD reference would be passed in.
         */
        FailureDetector failureDetectorRef = fd;
        if(failureDetectorRef == null) {
            failureDetectorRef = getFailureDetector();
        } else {
            logger.debug("Using existing failure detector.");
        }
View Full Code Here

                                                             bootstrapUrls);
            this.cluster = clusterMapper.readCluster(new StringReader(clusterXml), false);
        }

        // first check: avoids locking as the field is volatile
        FailureDetector result = failureDetector;

        if(result == null) {
            synchronized(this) {
                // second check: avoids double initialization
                result = failureDetector;
View Full Code Here

TOP

Related Classes of voldemort.cluster.failuredetector.FailureDetector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.