String getMBeanObjectName(final ServerId serverId) { String name = format("org.mongodb.driver:type=ConnectionPool,clusterId=%s,host=%s,port=%s", ensureValidValue(serverId.getClusterId().getValue()), ensureValidValue(serverId.getAddress().getHost()), serverId.getAddress().getPort()); if (serverId.getClusterId().getDescription() != null) { name = format("%s,description=%s", name, ensureValidValue(serverId.getClusterId().getDescription())); } return name; }
DefaultServerMonitor(final ServerId serverId, final ServerSettings serverSettings, final ClusterClock clusterClock, final ChangeListener<ServerDescription> serverStateListener, final InternalConnectionFactory internalConnectionFactory, final ConnectionPool connectionPool) { this.serverSettings = notNull("serverSettings", serverSettings); this.serverId = notNull("serverId", serverId); this.serverMonitorListener = getServerMonitorListener(serverSettings); this.clusterClock = notNull("clusterClock", clusterClock); this.serverStateListener = serverStateListener; this.internalConnectionFactory = notNull("internalConnectionFactory", internalConnectionFactory); this.connectionPool = connectionPool; monitor = new ServerMonitorRunnable(); monitorThread = new Thread(monitor, "cluster-" + this.serverId.getClusterId() + "-" + this.serverId.getAddress()); monitorThread.setDaemon(true); isClosed = false; }
String getMBeanObjectName(final ServerId serverId) { String name = format("org.mongodb.driver:type=ConnectionPool,clusterId=%s,host=%s,port=%s", ensureValidValue(serverId.getClusterId().getValue()), ensureValidValue(serverId.getAddress().getHost()), serverId.getAddress().getPort()); if (serverId.getClusterId().getDescription() != null) { name = format("%s,description=%s", name, ensureValidValue(serverId.getClusterId().getDescription())); } return name; }
DefaultServerMonitor(final ServerId serverId, final ServerSettings serverSettings, final ClusterClock clusterClock, final ChangeListener<ServerDescription> serverStateListener, final InternalConnectionFactory internalConnectionFactory, final ConnectionPool connectionPool) { this.serverSettings = notNull("serverSettings", serverSettings); this.serverId = notNull("serverId", serverId); this.serverMonitorListener = getServerMonitorListener(serverSettings); this.clusterClock = notNull("clusterClock", clusterClock); this.serverStateListener = serverStateListener; this.internalConnectionFactory = notNull("internalConnectionFactory", internalConnectionFactory); this.connectionPool = connectionPool; monitor = new ServerMonitorRunnable(); monitorThread = new Thread(monitor, "cluster-" + this.serverId.getClusterId() + "-" + this.serverId.getAddress()); monitorThread.setDaemon(true); isClosed = false; }
private PoolMetric(final ServerId serverId) { final String clusterId = serverId.getClusterId().getValue(); poolSizeGauge = DittoMetrics.gauge(metricName + POOL_PREFIX + POOL_SIZE) .tag(CLUSTER_ID_TAG, clusterId); poolSizeGauge.set(0L); checkOutCountGauge = DittoMetrics.gauge(metricName + POOL_PREFIX + CHECKED_OUT_COUNT) .tag(CLUSTER_ID_TAG, clusterId); checkOutCountGauge.set(0L); waitQueueGauge = DittoMetrics.gauge(metricName + POOL_PREFIX + WAIT_QUEUE_SIZE) .tag(CLUSTER_ID_TAG, clusterId); waitQueueGauge.set(0L); }
private PoolMetric(final ServerId serverId) { final String clusterId = serverId.getClusterId().getValue(); poolSizeGauge = DittoMetrics.gauge(metricName + POOL_PREFIX + POOL_SIZE) .tag(CLUSTER_ID_TAG, clusterId); poolSizeGauge.set(0L); checkOutCountGauge = DittoMetrics.gauge(metricName + POOL_PREFIX + CHECKED_OUT_COUNT) .tag(CLUSTER_ID_TAG, clusterId); checkOutCountGauge.set(0L); waitQueueGauge = DittoMetrics.gauge(metricName + POOL_PREFIX + WAIT_QUEUE_SIZE) .tag(CLUSTER_ID_TAG, clusterId); waitQueueGauge.set(0L); }