Merge branch 'master'

revert
Thilina Sandaruwan 1 year ago
commit 907043fd91

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

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

@ -480,6 +480,7 @@ public class OperationManagerImpl implements OperationManager {
int failAttempts = 0; int failAttempts = 0;
while (true) { while (true) {
try { try {
OperationManagementDAOFactory.beginTransaction();
operationMappingDAO.updateOperationMapping(operation.getId(), device.getEnrolmentInfo().getId(), operationMappingDAO.updateOperationMapping(operation.getId(), device.getEnrolmentInfo().getId(),
io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.PushNotificationStatus.SCHEDULED); io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.PushNotificationStatus.SCHEDULED);
OperationManagementDAOFactory.commitTransaction(); OperationManagementDAOFactory.commitTransaction();
@ -502,6 +503,11 @@ public class OperationManagerImpl implements OperationManager {
} catch (InterruptedException ignore) { } catch (InterruptedException ignore) {
break; break;
} }
} catch (TransactionManagementException ex) {
log.error("Error occurred while initiating the transaction", ex);
break;
} finally {
OperationManagementDAOFactory.closeConnection();
} }
} }
} catch (Exception e) { } catch (Exception e) {

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

Loading…
Cancel
Save