예제 #1
0
    public Manager(Cluster cluster, Collection<Host> hosts) {
      this.cluster = cluster;

      this.pools = new ConcurrentHashMap<Host, HostConnectionPool>(hosts.size());
      this.loadBalancer = cluster.manager.configuration.getPolicies().getLoadBalancingPolicy();
      this.poolsState = new HostConnectionPool.PoolState();

      for (Host host : hosts) addHost(host);
    }
예제 #2
0
    public Manager(Cluster cluster, Collection<Host> hosts) {
      this.cluster = cluster;

      this.pools = new ConcurrentHashMap<Host, HostConnectionPool>(hosts.size());
      this.poolsState = new HostConnectionPool.PoolState();

      // Create pool to initial nodes (and wait for them to be created)
      for (Host host : hosts) {
        try {
          addOrRenewPool(host).get();
        } catch (ExecutionException e) {
          // This is not supposed to happen
          throw new DriverInternalError(e);
        } catch (InterruptedException e) {
          Thread.currentThread().interrupt();
        }
      }
    }