Ejemplo n.º 1
0
 /**
  * This is the override of super method.
  *
  * @see
  *     org.apache.niolex.address.rpc.cli.pool.SimplePool#buildClients(org.apache.niolex.address.rpc.cli.NodeInfo)
  */
 @Override
 protected Set<RpcStub> buildClients(NodeInfo info) {
   Set<RpcStub> clientSet = RpcStubPool.getPool().getClients(info.getAddress());
   final int curMax = info.getWeight();
   for (int i = 0; i < curMax; ++i) {
     clientSet.add(new MockClient());
   }
   return clientSet;
 }
Ejemplo n.º 2
0
 @Test
 public void testReallyBuildError() throws Exception {
   NodeInfo info = new NodeInfo();
   info.setProtocol("network/json");
   InetSocketAddress address = new InetSocketAddress("localhost", 8809);
   info.setAddress(address);
   info.setWeight(1);
   FieldUtil.setValue(pool, "weightShare", 0.6);
   pool.buildSuperClients(info);
   Set<RpcStub> clientSet = RpcStubPool.getPool().getClients(info.getAddress());
   assertEquals(0, clientSet.size());
 }