@@ -45,7 +45,7 @@ class AuthManager {
4545 private var analyticsProvider: RestAnalyticsProvider ? = null
4646
4747 private val loginOrRefreshLock = ReentrantLock ()
48- private val isProxyPaused : AtomicBoolean = AtomicBoolean (true )
48+ private val isPaused : AtomicBoolean = AtomicBoolean (true )
4949
5050 companion object {
5151 @JvmStatic
@@ -96,7 +96,7 @@ class AuthManager {
9696 )
9797
9898 Log .log(logger::info, " resuming current proxy, analytics url {}" , analyticsProvider?.apiUrl)
99- isProxyPaused .set(false )
99+ isPaused .set(false )
100100 return proxy
101101 }
102102
@@ -281,6 +281,10 @@ class AuthManager {
281281
282282 private fun fireChange () {
283283
284+ if (isPaused.get()) {
285+ return
286+ }
287+
284288 Log .log(
285289 logger::trace, " firing authInfoChanged, default account {}, analytics url {}" ,
286290 DigmaDefaultAccountHolder .getInstance().account,
@@ -298,10 +302,12 @@ class AuthManager {
298302 }
299303
300304
301- fun pauseCurrentProxy () {
305+ // pause the AuthManager before replacing the analytics provider.
306+ // can be resumed only from this class after a new client is set
307+ fun pauseBeforeClientChange () {
302308 Log .log(logger::info, " pausing current proxy, analytics url {}" , analyticsProvider?.apiUrl)
303309 analyticsProvider = null
304- isProxyPaused .set(true )
310+ isPaused .set(true )
305311 }
306312
307313
@@ -467,7 +473,7 @@ class AuthManager {
467473 } catch (e: InvocationTargetException ) {
468474
469475 Log .debugWithException(logger, e, " Exception in proxy {}" , ExceptionUtils .getNonEmptyMessage(e))
470- if (isProxyPaused .get()) {
476+ if (isPaused .get()) {
471477 Log .log(logger::trace, " got Exception in proxy but proxy is paused, rethrowing" )
472478 throw e
473479 }
0 commit comments