Skip to content

Commit

Permalink
FM2-642: Saner loading of GP listener
Browse files Browse the repository at this point in the history
  • Loading branch information
ibacher committed Sep 10, 2024
1 parent ca8bf98 commit 704eae3
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions api/src/main/java/org/openmrs/module/fhir2/FhirActivator.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ public void started() {

@Override
public void willRefreshContext() {
if (globalPropertyHolder != null) {
Context.getAdministrationService().removeGlobalPropertyListener(globalPropertyHolder);
}

lifecycleListeners.forEach(ModuleLifecycleListener::willRefresh);
unloadModules();
}
Expand All @@ -92,12 +88,11 @@ public void willRefreshContext() {
public void contextRefreshed() {
if (globalPropertyHolder == null) {
globalPropertyHolder = new FhirGlobalPropertyHolder();
Context.getAdministrationService().addGlobalPropertyListener(globalPropertyHolder);
}

FhirGlobalPropertyHolder.reset();

Context.getAdministrationService().addGlobalPropertyListener(globalPropertyHolder);

if (!started) {
return;
}
Expand All @@ -111,7 +106,6 @@ public void contextRefreshed() {
@Override
public void willStop() {
lifecycleListeners.forEach(ModuleLifecycleListener::willStop);
unloadModules();

if (globalPropertyHolder != null) {
Context.getAdministrationService().removeGlobalPropertyListener(globalPropertyHolder);
Expand All @@ -121,6 +115,7 @@ public void willStop() {
@Override
public void stopped() {
lifecycleListeners.forEach(ModuleLifecycleListener::stopped);
unloadModules();

globalPropertyHolder = null;
started = false;
Expand Down

0 comments on commit 704eae3

Please sign in to comment.