Skip to content

Commit

Permalink
Merge pull request #516 from jewzaam/fix-servo-publisher-singleton-init
Browse files Browse the repository at this point in the history
Updated HystrixServoMetricsPublisher initalization of singleton
  • Loading branch information
mattrjacobs committed Jan 16, 2015
2 parents ad0c9de + c728638 commit ef3735f
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,24 @@
*/
public class HystrixServoMetricsPublisher extends HystrixMetricsPublisher {

private static HystrixServoMetricsPublisher INSTANCE = new HystrixServoMetricsPublisher();
private static HystrixServoMetricsPublisher INSTANCE = null;

public static HystrixServoMetricsPublisher getInstance() {
if (INSTANCE == null) {
HystrixServoMetricsPublisher temp = createInstance();
INSTANCE = temp;
}
return INSTANCE;
}

private static synchronized HystrixServoMetricsPublisher createInstance() {
if (INSTANCE == null) {
return new HystrixServoMetricsPublisher();
} else {
return INSTANCE;
}
}

private HystrixServoMetricsPublisher() {
}

Expand Down

0 comments on commit ef3735f

Please sign in to comment.