Code example for AtomicReference

public enum DefaultMetricsSystem { 
  INSTANCE; // the singleton
  private AtomicReference<MetricsSystem> impl =
      new AtomicReference<MetricsSystem>(new MetricsSystemImpl());
  volatile boolean miniClusterMode = false;
  transient final UniqueNames mBeanNames = new UniqueNames();
  transient final UniqueNames sourceNames = new UniqueNames();
   * Convenience method to initialize the metrics system 
   * @param prefix  for the metrics system configuration 
   * @return the metrics system instance 
  public static MetricsSystem initialize(String prefix) {
    return INSTANCE.init(prefix);
Contextual code suggestions in your IDE  Get Codota for Java