/** * Determines whether this address is the same as a given host. * * @param hostName the address to compare * @return if they are the same * @deprecated use the {@link #equals(Object)} method instead */ @Deprecated public boolean sameHost(final String hostName) { return equals(new ServerAddress(hostName)); } }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ServerCursor that = (ServerCursor) o; if (id != that.id) { return false; } if (!address.equals(that.address)) { return false; } return true; }
/** * Checks to see if a given server is the primary server in this replica set. * * @param serverAddress the server to compare * @return true if the given ServerAddress is the current Master/Primary */ public boolean isMaster(final ServerAddress serverAddress) { ServerAddress masterServerAddress = getMaster(); return masterServerAddress != null && masterServerAddress.equals(serverAddress); }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ServerId serverId = (ServerId) o; if (!address.equals(serverId.address)) { return false; } if (!clusterId.equals(serverId.clusterId)) { return false; } return true; }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } BulkWriteException that = (BulkWriteException) o; if (!writeErrors.equals(that.writeErrors)) { return false; } if (!serverAddress.equals(that.serverAddress)) { return false; } if (writeConcernError != null ? !writeConcernError.equals(that.writeConcernError) : that.writeConcernError != null) { return false; } if (!writeResult.equals(that.writeResult)) { return false; } return true; }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final MongoBulkWriteException that = (MongoBulkWriteException) o; if (!errors.equals(that.errors)) { return false; } if (!serverAddress.equals(that.serverAddress)) { return false; } if (writeConcernError != null ? !writeConcernError.equals(that.writeConcernError) : that.writeConcernError != null) { return false; } if (!writeResult.equals(that.writeResult)) { return false; } return true; }
@Override public List<ServerDescription> select(final ClusterDescription clusterDescription) { for (ServerDescription cur : clusterDescription.getServerDescriptions()) { if (cur.getAddress().equals(primaryPreferred.get(0).getAddress())) { return Collections.singletonList(cur); } } return Collections.emptyList(); } }).getConnection();
/** * Returns the ServerDescription for the server at the given address * * @param serverAddress the ServerAddress for a server in this cluster * @return the ServerDescription for this server * @deprecated Replace with a filter on ServerDescription in the caller */ @Deprecated public ServerDescription getByServerAddress(final ServerAddress serverAddress) { for (final ServerDescription cur : serverDescriptions) { if (cur.isOk() && cur.getAddress().equals(serverAddress)) { return cur; } } return null; }
return false; if (!address.equals(that.address)) { return false;
private void invalidateOldPrimaries(final ServerAddress newPrimary) { for (final ServerTuple serverTuple : addressToServerTupleMap.values()) { if (!serverTuple.description.getAddress().equals(newPrimary) && serverTuple.description.isPrimary()) { if (LOGGER.isInfoEnabled()) { LOGGER.info(format("Rediscovering type of existing primary %s", serverTuple.description.getAddress())); } serverTuple.server.invalidate(); } } }
if (serverAddress != null && !serverAddress.equals(primaryAddress)) { logger.info("Found new primary event in oplog, so stopping use of {} to continue with new primary {}", primaryAddress, serverAddress);
return true; if (!previous.getAddress().equals(current.getAddress())) { return true;
&& !newDescription.getAddress().equals(new ServerAddress(newDescription.getCanonicalAddress()))) { if (LOGGER.isInfoEnabled()) { LOGGER.info(format("Canonical address %s does not match server address. Removing %s from client view of cluster",
/** * Determines whether this address is the same as a given host. * * @param hostName the address to compare * @return if they are the same * @deprecated use the {@link #equals(Object)} method instead */ @Deprecated public boolean sameHost(final String hostName) { return equals(new ServerAddress(hostName)); } }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ServerCursor that = (ServerCursor) o; if (id != that.id) { return false; } if (!address.equals(that.address)) { return false; } return true; }
@Override public boolean equals(Object o) { if (!(o instanceof MongoDataSource)) { return false; } MongoDataSource other = (MongoDataSource)o; if (this.addrs.size() != other.addrs.size()) { return false; } for(int i = 0; i < this.addrs.size(); i++) { if (!this.addrs.get(i).equals(other.addrs.get(i))) { return false; } } return true; } }
/** * Checks to see if a given server is the primary server in this replica set. * * @param serverAddress the server to compare * @return true if the given ServerAddress is the current Master/Primary */ public boolean isMaster(final ServerAddress serverAddress) { ServerAddress masterServerAddress = getMaster(); return masterServerAddress != null && masterServerAddress.equals(serverAddress); }
@Override public List<ServerDescription> select(final ClusterDescription clusterDescription) { for (ServerDescription cur : clusterDescription.getServerDescriptions()) { if (cur.getAddress().equals(primaryPreferred.get(0).getAddress())) { return Collections.singletonList(cur); } } return Collections.emptyList(); } }).getConnection();
/** * Returns the ServerDescription for the server at the given address * * @param serverAddress the ServerAddress for a server in this cluster * @return the ServerDescription for this server * @deprecated Replace with a filter on ServerDescription in the caller */ @Deprecated public ServerDescription getByServerAddress(final ServerAddress serverAddress) { for (final ServerDescription cur : serverDescriptions) { if (cur.isOk() && cur.getAddress().equals(serverAddress)) { return cur; } } return null; }
private void invalidateOldPrimaries(final ServerAddress newPrimary) { for (final ServerTuple serverTuple : addressToServerTupleMap.values()) { if (!serverTuple.description.getAddress().equals(newPrimary) && serverTuple.description.isPrimary()) { if (LOGGER.isInfoEnabled()) { LOGGER.info(format("Rediscovering type of existing primary %s", serverTuple.description.getAddress())); } serverTuple.server.invalidate(); } } }