Package com.netflix.astyanax.connectionpool

Examples of com.netflix.astyanax.connectionpool.Host


    @Test
    public void testGoodFast() {
        ConnectionPool<TestClient> pool = createPool();

        pool.addHost(new Host("127.0.0.1", TestHostType.GOOD_SLOW.ordinal()),
                true);

        for (int i = 0; i < 10; i++) {
            try {
                pool.executeWithFailover(dummyOperation, RunOnce.get());
View Full Code Here


    @Test
    public void testRestartedCluster() {
        ConnectionPool<TestClient> pool = createPool();

        Host host1 = new Host("127.0.0.1", TestHostType.GOOD_FAST.ordinal());
        List<Host> ring1 = Lists.newArrayList(host1);

        Host host2 = new Host("127.0.0.2", TestHostType.GOOD_FAST.ordinal());
        List<Host> ring2 = Lists.newArrayList(host2);

        List<Host> ring3 = Lists.newArrayList();

        pool.setHosts(ring1);
View Full Code Here

         * RoundRobinConnectionPoolImpl<MockClient>(config, new
         * MockConnectionFactory(config));
         */
        ConnectionPool<TestClient> pool = createPool();
       
        Host host1 = new Host("127.0.0.1",
                TestHostType.CONNECT_FAIL_FIRST.ordinal());
        List<Host> ring1 = Lists.newArrayList(host1);

        OperationResult<String> result;

View Full Code Here

    @Test
    @Ignore
    public void testConnectionAborted() {
        ConnectionPool<TestClient> pool = createPool();

        Host host = new Host("127.0.0.1",
                TestHostType.ABORTED_CONNECTION.ordinal());
        pool.addHost(host, true);

        OperationResult<String> result;
View Full Code Here

        RingDescribeHostSupplier ringSupplier = new RingDescribeHostSupplier(keyspaceContext.getEntity(), 9160);
        List<Host> hosts = ringSupplier.get();
        Assert.assertEquals(1, hosts.get(0).getTokenRanges().size());
        LOG.info(hosts.toString());
       
        Supplier<List<Host>> sourceSupplier1 = Suppliers.ofInstance((List<Host>)Lists.newArrayList(new Host("127.0.0.1", 9160)));
        Supplier<List<Host>> sourceSupplier2 = Suppliers.ofInstance((List<Host>)Lists.newArrayList(new Host("127.0.0.2", 9160)));
       
        // 127.0.0.1
        LOG.info(sourceSupplier1.get().toString());
       
        // 127.0.0.2
View Full Code Here

        try {
            Map<String, Host> ipToHost = Maps.newHashMap();

            for (TokenRange range : keyspace.describeRing(dc, rack)) {
                for (String endpoint : range.getEndpoints()) {
                    Host host = ipToHost.get(endpoint);
                    if (host == null) {
                        host = new Host(endpoint, defaultPort);
                        ipToHost.put(endpoint, host);
                    }
                   
                    host.getTokenRanges().add(range);
                }
            }
           
            previousHosts = Lists.newArrayList(ipToHost.values());
            return previousHosts;
View Full Code Here

    Supplier<List<Host>> HostSupplier = new Supplier<List<Host>>() {

      @Override
      public List<Host> get() {
        Host host = new Host(SEEDS, -1);
        return Collections.singletonList(host);
      }
      };
     
      AstyanaxContext<Cluster> context = new AstyanaxContext.Builder()
View Full Code Here

    Supplier<List<Host>> HostSupplier = new Supplier<List<Host>>() {

      @Override
      public List<Host> get() {
        Host host = new Host(SEEDS, -1);
        return Collections.singletonList(host);
      }
      };
     
      AstyanaxContext<Cluster> context = new AstyanaxContext.Builder()
View Full Code Here

    Supplier<List<Host>> HostSupplier = new Supplier<List<Host>>() {

      @Override
      public List<Host> get() {
        Host host = new Host(SEEDS, -1);
        return Collections.singletonList(host);
      }
      };
     
      ProtocolOptions protocolOptions = new ProtocolOptions(9042);
View Full Code Here

    Supplier<List<Host>> HostSupplier = new Supplier<List<Host>>() {

      @Override
      public List<Host> get() {
        Host host = new Host(SEEDS, 9160);
        return Collections.singletonList(host);
      }
      };
     
      AstyanaxContext<Keyspace> context = new AstyanaxContext.Builder()
View Full Code Here

TOP

Related Classes of com.netflix.astyanax.connectionpool.Host

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.