/** * Gets the server address. * * @return the server address */ public ServerAddress getServerAddress() { return connectionId.getServerId().getAddress(); }
/** * Creates a new connectionId with the set server value * * @param serverValue the server value * @return the new connection id * @since 3.8 */ public ConnectionId withServerValue(final int serverValue) { isTrue("server value is null", this.serverValue == null); return new ConnectionId(serverId, localValue, serverValue); }
return false; if (!connectionId.equals(that.connectionId)) { return false;
private ConnectionDescription applyGetLastErrorResult(final BsonDocument getLastErrorResult, final ConnectionDescription connectionDescription) { ConnectionId connectionId; if (getLastErrorResult.containsKey("connectionId")) { connectionId = connectionDescription.getConnectionId().withServerValue(getLastErrorResult.getNumber("connectionId").intValue()); } else { connectionId = connectionDescription.getConnectionId(); } return connectionDescription.withConnectionId(connectionId); }
@Override public int hashCode() { int result = connectionId.hashCode(); result = 31 * result + serverVersion.hashCode(); result = 31 * result + maxBatchCount; result = 31 * result + serverType.hashCode(); result = 31 * result + maxBatchCount; result = 31 * result + maxDocumentSize; result = 31 * result + maxMessageSize; result = 31 * result + compressors.hashCode(); return result; }
private ConnectionDescription applyGetLastErrorResult(final BsonDocument getLastErrorResult, final ConnectionDescription connectionDescription) { ConnectionId connectionId; if (getLastErrorResult.containsKey("connectionId")) { connectionId = connectionDescription.getConnectionId().withServerValue(getLastErrorResult.getNumber("connectionId").intValue()); } else { connectionId = connectionDescription.getConnectionId(); } return connectionDescription.withConnectionId(connectionId); }
@Override public int hashCode() { int result = connectionId.hashCode(); result = 31 * result + serverVersion.hashCode(); result = 31 * result + maxBatchCount; result = 31 * result + serverType.hashCode(); result = 31 * result + maxBatchCount; result = 31 * result + maxDocumentSize; result = 31 * result + maxMessageSize; result = 31 * result + compressors.hashCode(); return result; }
private ConnectionPoolStatistics getStatistics(final ConnectionId connectionId) { return getStatistics(connectionId.getServerId()); }
/** * Construct a defaulted connection description instance. * * @param serverId the server address */ public ConnectionDescription(final ServerId serverId) { this(new ConnectionId(serverId), new ServerVersion(), 0, ServerType.UNKNOWN, DEFAULT_MAX_WRITE_BATCH_SIZE, getDefaultMaxDocumentSize(), DEFAULT_MAX_MESSAGE_SIZE, Collections.<String>emptyList()); }
return false; if (!connectionId.equals(that.connectionId)) { return false;
/** * Gets the server address. * * @return the server address */ public ServerAddress getServerAddress() { return connectionId.getServerId().getAddress(); }
/** * Creates a new connectionId with the set server value * * @param serverValue the server value * @return the new connection id * @since 3.8 */ public ConnectionId withServerValue(final int serverValue) { isTrue("server value is null", this.serverValue == null); return new ConnectionId(serverId, localValue, serverValue); }
private ConnectionPoolStatistics getStatistics(final ConnectionId connectionId) { return getStatistics(connectionId.getServerId()); }
/** * Construct a defaulted connection description instance. * * @param serverId the server address */ public ConnectionDescription(final ServerId serverId) { this(new ConnectionId(serverId), new ServerVersion(), 0, ServerType.UNKNOWN, DEFAULT_MAX_WRITE_BATCH_SIZE, getDefaultMaxDocumentSize(), DEFAULT_MAX_MESSAGE_SIZE, Collections.<String>emptyList()); }
@Override public void connectionCheckedOut(final ConnectionCheckedOutEvent event) { metrics.compute(event.getConnectionId().getServerId(), (serverId, metric) -> metric.incCheckedOutCount()); }
@Override public void connectionRemoved(final ConnectionRemovedEvent event) { metrics.compute(event.getConnectionId().getServerId(), (serverId, metric) -> metric.decPoolSize()); }
@Override public void connectionRemoved(final ConnectionRemovedEvent event) { metrics.compute(event.getConnectionId().getServerId(), (serverId, metric) -> metric.decPoolSize()); }
@Override public void connectionAdded(final ConnectionAddedEvent event) { metrics.compute(event.getConnectionId().getServerId(), (serverId, metric) -> metric.incPoolSize()); }
@Override public void connectionCheckedOut(final ConnectionCheckedOutEvent event) { metrics.compute(event.getConnectionId().getServerId(), (serverId, metric) -> metric.incCheckedOutCount()); }
@Override public void connectionCheckedIn(final ConnectionCheckedInEvent event) { metrics.compute(event.getConnectionId().getServerId(), (serverId, metric) -> metric.decCheckedOutCount()); }