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; } }
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; }
Node(ServerAddress addr) { _addr = addr; _port = new DBPort(addr, null, _mongoOptions); _names.add(addr.toString()); }
/** * @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()); }
private boolean _set(ServerAddress addr) { if (_curAddress == addr) return false; _curAddress = addr; _curPortPool = _portHolder.get(addr.getSocketAddress()); return true; }