Fix realm service unbinding issues #167

Merged
tcdlpds merged 1 commits from rajitha/device-mgt-core:server-issues into master 1 year ago

@ -62,17 +62,18 @@ public class APIApplicationManagerExtensionDataHolder {
public void setRealmService(RealmService realmService) {
this.realmService = realmService;
this.setTenantManager(realmService);
setTenantManager(realmService != null ?
realmService.getTenantManager() : null);
}
private void setTenantManager(RealmService realmService) {
if (realmService == null) {
throw new IllegalStateException("Realm service is not initialized properly");
}
this.tenantManager = realmService.getTenantManager();
private void setTenantManager(TenantManager tenantManager) {
this.tenantManager = tenantManager;
}
public TenantManager getTenantManager() {
if (tenantManager == null) {
throw new IllegalStateException("Tenant manager is not initialized properly");
}
return tenantManager;
}

@ -75,17 +75,18 @@ public class APIPublisherDataHolder {
public void setRealmService(RealmService realmService) {
this.realmService = realmService;
this.setTenantManager(realmService);
setTenantManager(realmService != null ?
realmService.getTenantManager() : null);
}
private void setTenantManager(RealmService realmService) {
if (realmService == null) {
throw new IllegalStateException("Realm service is not initialized properly");
}
this.tenantManager = realmService.getTenantManager();
private void setTenantManager(TenantManager tenantManager) {
this.tenantManager = tenantManager;
}
public TenantManager getTenantManager() {
if (tenantManager == null) {
throw new IllegalStateException("Tenant manager is not initialized properly");
}
return tenantManager;
}

@ -74,17 +74,18 @@ public class JWTClientExtensionDataHolder {
public void setRealmService(RealmService realmService) {
this.realmService = realmService;
this.setTenantManager(realmService);
setTenantManager(realmService != null ?
realmService.getTenantManager() : null);
}
private void setTenantManager(RealmService realmService) {
if (realmService == null) {
throw new IllegalStateException("Realm service is not initialized properly");
}
this.tenantManager = realmService.getTenantManager();
private void setTenantManager(TenantManager tenantManager) {
this.tenantManager = tenantManager;
}
public TenantManager getTenantManager() {
if (tenantManager == null) {
throw new IllegalStateException("Tenant manager is not initialized properly");
}
return tenantManager;
}
}

Loading…
Cancel
Save