示例#1
0
 /** Returns a connection with the given service host. */
 private TCPConnection getConnection(ServiceAddress address) throws IOException {
   TCPConnection c;
   synchronized (connection_pool) {
     c = connection_pool.get(address);
     // If there isn't, establish a connection,
     if (c == null) {
       c = new TCPConnection();
       c.connect(password, network_interface, address);
       connection_pool.put(address, c);
     } else {
       c.addLock();
     }
   }
   return c;
 }