void updateInstance ( T instance ) { T oldInstance = this . instance . getAndSet ( Preconditions . checkNotNull ( instance , "instance" ) ) ; if ( oldInstance != null && oldInstance != instance ) { oldInstance . close ( ) ; } }
Updates the underlying Metric instance with the given one and closes out the previous one .