コード例 #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
    UpdatableNode(
        ServerAddress addr,
        List<UpdatableNode> all,
        AtomicReference<Logger> logger,
        Mongo mongo,
        MongoOptions mongoOptions,
        AtomicReference<String> setName,
        AtomicReference<String> lastPrimarySignal) {
      _addr = addr;
      _all = all;
      _mongoOptions = mongoOptions;
      _port = new DBPort(addr, null, _mongoOptions);
      _names.add(addr.toString());
      _logger = logger;
      _mongo = mongo;

      _setName = setName;
      _lastPrimarySignal = lastPrimarySignal;
    }
コード例 #3
0
 Node(ServerAddress addr) {
   _addr = addr;
   _port = new DBPort(addr, null, _mongoOptions);
   _names.add(addr.toString());
 }
コード例 #4
0
  /**
   * @param srv the server to compare
   * @return indication if the ServerAddress is the current Master/Primary
   */
  public boolean isMaster(ServerAddress srv) {
    if (srv == null) return false;

    return srv.equals(getMaster());
  }
コード例 #5
0
 private boolean _set(ServerAddress addr) {
   if (_curAddress == addr) return false;
   _curAddress = addr;
   _curPortPool = _portHolder.get(addr.getSocketAddress());
   return true;
 }