Package voldemort.client

Examples of voldemort.client.TimeoutConfig


                  nonblockingSlopStores,
                  cluster,
                  storeDef,
                  failureDetector,
                  true,
                  new TimeoutConfig(routingTimeoutInMs),
                  Zone.UNSET_ZONE_ID,
                  false,
                  new String(),
                  new ZoneAffinity());
View Full Code Here


        store = routedStoreFactory.create(cluster,
                                          storeDef,
                                          subStores,
                                          new NoopFailureDetector(),
                                          new RoutedStoreConfig().setTimeoutConfig(new TimeoutConfig(1000L)));
    }
View Full Code Here

    private RoutedStoreConfig createConfig(TimeoutConfig timeoutConfig) {
        return new RoutedStoreConfig().setTimeoutConfig(timeoutConfig);
    }

    private RoutedStoreConfig createConfig(long timeout) {
        return new RoutedStoreConfig().setTimeoutConfig(new TimeoutConfig(timeout));
    }
View Full Code Here

        }
        setFailureDetector(stores);

        routedStoreThreadPool = Executors.newFixedThreadPool(3);

        TimeoutConfig timeoutConfig = new TimeoutConfig(1500, true);
        // This means, the getall will only succeed on two of the nodes
        timeoutConfig.setOperationTimeout(VoldemortOpCode.GET_ALL_OP_CODE, 250);
        RoutedStoreFactory routedStoreFactory = createFactory();

        RoutedStore routedStore = routedStoreFactory.create(new Cluster("test", nodes),
                                                            definition,
                                                            stores,
                                                            failureDetector,
                                                            createConfig(timeoutConfig));
        /* do some puts so we have some data to test getalls */
        Map<ByteArray, byte[]> expectedValues = Maps.newHashMap();
        for(byte i = 1; i < 11; ++i) {
            ByteArray key = new ByteArray(new byte[] { i });
            byte[] value = new byte[] { (byte) (i + 50) };
            routedStore.put(key, Versioned.value(value), null);
            expectedValues.put(key, value);
        }

        /* 1. positive test; if partial is on, should get something back */
        Map<ByteArray, List<Versioned<byte[]>>> all = routedStore.getAll(expectedValues.keySet(),
                                                                         null);
        assert (expectedValues.size() > all.size());

        /* 2. negative test; if partial is off, should fail the whole operation */
        timeoutConfig.setPartialGetAllAllowed(false);
        try {
            all = routedStore.getAll(expectedValues.keySet(), null);
            fail("Should have failed");
        } catch(Exception e) {

View Full Code Here

        }
        setFailureDetector(stores);

        routedStoreThreadPool = Executors.newFixedThreadPool(3);

        TimeoutConfig timeoutConfig = new TimeoutConfig(1500, true);
        // This means, the getall will only succeed on two of the nodes
        timeoutConfig.setOperationTimeout(VoldemortOpCode.GET_ALL_OP_CODE, 250);
        RoutedStoreFactory routedStoreFactory = createFactory();

        List<Zone> zones = Lists.newArrayList();

        for(int i = 0; i < 3; i++) {
            LinkedList<Integer> zoneProximityList = Lists.newLinkedList();
            Set<Integer> zoneIds = Sets.newHashSet(0, 1, 2);
            zoneIds.remove(i);
            zoneProximityList.addAll(zoneIds);
            zones.add(new Zone(i, zoneProximityList));
        }

        RoutedStore routedStore = routedStoreFactory.create(new Cluster("test", nodes, zones),
                                                            definition,
                                                            stores,
                                                            failureDetector,
                                                            createConfig(timeoutConfig));
        /* do some puts so we have some data to test getalls */
        Map<ByteArray, byte[]> expectedValues = Maps.newHashMap();
        for(byte i = 1; i < 11; ++i) {
            ByteArray key = new ByteArray(new byte[] { i });
            byte[] value = new byte[] { (byte) (i + 50) };
            routedStore.put(key, Versioned.value(value), null);
            expectedValues.put(key, value);
        }

        /* 1. positive test; if partial is on, should get something back */
        Map<ByteArray, List<Versioned<byte[]>>> all = routedStore.getAll(expectedValues.keySet(),
                                                                         null);
        assert (expectedValues.size() > all.size());

        /* 2. negative test; if partial is off, should fail the whole operation */
        timeoutConfig.setPartialGetAllAllowed(false);
        try {
            all = routedStore.getAll(expectedValues.keySet(), null);
            fail("Should have failed");
        } catch(Exception e) {
            // Expected
View Full Code Here

        setFailureDetector(stores);

        routedStoreThreadPool = Executors.newFixedThreadPool(3);
        // with a 500ms general timeout and a 100ms get timeout, only get should
        // fail
        TimeoutConfig timeoutConfig = new TimeoutConfig(1500, false);
        timeoutConfig.setOperationTimeout(VoldemortOpCode.GET_OP_CODE, 100);
        RoutedStoreFactory routedStoreFactory = createFactory();

        RoutedStore routedStore = routedStoreFactory.create(new Cluster("test", nodes),
                                                            definition,
                                                            stores,
View Full Code Here

        ClientConfig config = new ClientConfig();
        if(options.has(CONNECTION_TIMEOUT))
            config.setConnectionTimeout((Integer) options.valueOf(CONNECTION_TIMEOUT),
                                        TimeUnit.MILLISECONDS);
        if(options.has(ROUTING_TIMEOUT))
            config.setTimeoutConfig(new TimeoutConfig(TimeUnit.MILLISECONDS.toMillis((Integer) options.valueOf(ROUTING_TIMEOUT)),
                                                      false));

        if(options.has(SOCKET_TIMEOUT))
            config.setSocketTimeout((Integer) options.valueOf(SOCKET_TIMEOUT),
                                    TimeUnit.MILLISECONDS);
View Full Code Here

        if(props.containsKey(ClientConfig.ROUTING_TIMEOUT_MS_PROPERTY))
            this.setTimeoutMs(props.getLong(ClientConfig.ROUTING_TIMEOUT_MS_PROPERTY, timeoutMs),
                              TimeUnit.MILLISECONDS);

        // By default, make all the timeouts equal to routing timeout
        timeoutConfig = new TimeoutConfig(timeoutMs, false);

        if(props.containsKey(ClientConfig.GETALL_ROUTING_TIMEOUT_MS_PROPERTY))
            timeoutConfig.setOperationTimeout(VoldemortOpCode.GET_ALL_OP_CODE,
                                              props.getInt(ClientConfig.GETALL_ROUTING_TIMEOUT_MS_PROPERTY));
View Full Code Here

        RoutedStore store = routedStoreFactory.create(cluster,
                                                      storeDef,
                                                      subStores,
                                                      failureDetector,
                                                      new RoutedStoreConfig().setTimeoutConfig(new TimeoutConfig(1000L,
                                                                                                                 false)));

        recordException(failureDetector, Iterables.get(cluster.getNodes(), 0));
        store.put(key, new Versioned<byte[]>(value), null);
        recordSuccess(failureDetector, Iterables.get(cluster.getNodes(), 0));
View Full Code Here

                                     testStores,
                                     socketTestStores,
                                     slopStores,
                                     socketSlopStores,
                                     failureDetector,
                                     new RoutedStoreConfig().setTimeoutConfig(new TimeoutConfig(1500L,
                                                                                                false)));

        // generate the keys
        for(int i = 0; i < 5; i++) {
            Set<Integer> nodesCovered = Sets.newHashSet();
View Full Code Here

TOP

Related Classes of voldemort.client.TimeoutConfig

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.