From: Andrii Grynenko Date: Fri, 6 May 2016 17:26:04 +0000 (-0700) Subject: Don't throw on late singleton registration X-Git-Tag: 2016.07.26~268 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8d90d07e9476f829f0fc7af7bf7efe6ad60e195a;p=folly.git Don't throw on late singleton registration Summary: Having singleton registered after registrationComplete() is called is not a hard failure. Replacing exception with ERROR, since we probably still want to avoid such situation. Reviewed By: yfeldblum Differential Revision: D3266376 fb-gh-sync-id: 8130d279775348c835265987c95189bd3d8106f9 fbshipit-source-id: 8130d279775348c835265987c95189bd3d8106f9 --- diff --git a/folly/Singleton.cpp b/folly/Singleton.cpp index ae60d4c9..df3cbcb0 100644 --- a/folly/Singleton.cpp +++ b/folly/Singleton.cpp @@ -78,8 +78,7 @@ void SingletonVault::registerSingleton(detail::SingletonHolderBase* entry) { stateCheck(SingletonVaultState::Running); if (UNLIKELY(registrationComplete_)) { - throw std::logic_error( - "Registering singleton after registrationComplete()."); + LOG(ERROR) << "Registering singleton after registrationComplete()."; } RWSpinLock::ReadHolder rhMutex(&mutex_); @@ -96,8 +95,7 @@ void SingletonVault::addEagerInitSingleton(detail::SingletonHolderBase* entry) { stateCheck(SingletonVaultState::Running); if (UNLIKELY(registrationComplete_)) { - throw std::logic_error( - "Registering for eager-load after registrationComplete()."); + LOG(ERROR) << "Registering for eager-load after registrationComplete()."; } RWSpinLock::ReadHolder rhMutex(&mutex_);