コード例 #1
0
  public DBTCPConnector(Mongo m, ServerAddress addr) throws MongoException {
    _mongo = m;
    _portHolder = new DBPortPool.Holder(m._options);
    _checkAddress(addr);

    _createLogger.info(addr.toString());

    if (addr.isPaired()) {
      _allHosts = new ArrayList<ServerAddress>(addr.explode());
      _createLogger.info("switch to paired mode : " + _allHosts + " -> " + _curAddress);
    } else {
      _set(addr);
      _allHosts = null;
    }
  }
コード例 #2
0
 private boolean _set(ServerAddress addr) {
   if (_curAddress == addr) return false;
   _curAddress = addr;
   _curPortPool = _portHolder.get(addr.getSocketAddress());
   return true;
 }