/* package */ HystrixMetricsPublisherCommand getPublisherForCommand(HystrixCommandKey commandKey, HystrixCommandGroupKey commandOwner, HystrixCommandMetrics metrics, HystrixCircuitBreaker circuitBreaker, HystrixCommandProperties properties) { // attempt to retrieve from cache first HystrixMetricsPublisherCommand publisher = commandPublishers.get(commandKey.name()); if (publisher != null) { return publisher; } else { synchronized (this) { HystrixMetricsPublisherCommand existingPublisher = commandPublishers.get(commandKey.name()); if (existingPublisher != null) { return existingPublisher; } else { HystrixMetricsPublisherCommand newPublisher = HystrixPlugins.getInstance().getMetricsPublisher().getMetricsPublisherForCommand(commandKey, commandOwner, metrics, circuitBreaker, properties); commandPublishers.putIfAbsent(commandKey.name(), newPublisher); newPublisher.initialize(); return newPublisher; } } } }
@Override public HystrixMetricsPublisherCommand getMetricsPublisherForCommand( HystrixCommandKey commandKey, HystrixCommandGroupKey commandGroupKey, HystrixCommandMetrics metrics, HystrixCircuitBreaker circuitBreaker, HystrixCommandProperties properties) { HystrixMetricsPublisherCommand delegate = metricsPublisherDelegate.getMetricsPublisherForCommand(commandKey, commandGroupKey, metrics, circuitBreaker, properties); return new HystrixPrometheusMetricsPublisherCommand( collector, commandKey, commandGroupKey, metrics, circuitBreaker, properties, exportProperties, exportDeprecatedMetrics, delegate); }
/* package */ HystrixMetricsPublisherCommand getPublisherForCommand(HystrixCommandKey commandKey, HystrixCommandGroupKey commandOwner, HystrixCommandMetrics metrics, HystrixCircuitBreaker circuitBreaker, HystrixCommandProperties properties) { // attempt to retrieve from cache first HystrixMetricsPublisherCommand publisher = commandPublishers.get(commandKey.name()); if (publisher != null) { return publisher; } else { synchronized (this) { HystrixMetricsPublisherCommand existingPublisher = commandPublishers.get(commandKey.name()); if (existingPublisher != null) { return existingPublisher; } else { HystrixMetricsPublisherCommand newPublisher = HystrixPlugins.getInstance().getMetricsPublisher().getMetricsPublisherForCommand(commandKey, commandOwner, metrics, circuitBreaker, properties); commandPublishers.putIfAbsent(commandKey.name(), newPublisher); newPublisher.initialize(); return newPublisher; } } } }