Synchronize plugin register

revert-70aa11f8
manoj 10 years ago
parent aa8de8cb23
commit 0e18ebcf4e

@ -61,6 +61,8 @@ import org.wso2.carbon.user.core.service.RealmService;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/** /**
* @scr.component name="org.wso2.carbon.device.manager" immediate="true" * @scr.component name="org.wso2.carbon.device.manager" immediate="true"
@ -153,11 +155,13 @@ public class DeviceManagementServiceComponent {
} }
public static void registerPluginInitializationListener(PluginInitializationListener listener) { public static void registerPluginInitializationListener(PluginInitializationListener listener) {
synchronized (LOCK) {
listeners.add(listener); listeners.add(listener);
for (DeviceManagementService deviceManagementService : deviceManagers) { for (DeviceManagementService deviceManagementService : deviceManagers) {
listener.registerDeviceManagementService(deviceManagementService); listener.registerDeviceManagementService(deviceManagementService);
} }
} }
}
private void initLicenseManager() throws LicenseManagementException { private void initLicenseManager() throws LicenseManagementException {
LicenseConfigurationManager.getInstance().initConfig(); LicenseConfigurationManager.getInstance().initConfig();
@ -238,11 +242,13 @@ public class DeviceManagementServiceComponent {
log.debug("Setting Device Management Service Provider: '" + log.debug("Setting Device Management Service Provider: '" +
deviceManagementService.getProviderType() + "'"); deviceManagementService.getProviderType() + "'");
} }
synchronized (LOCK) {
deviceManagers.add(deviceManagementService); deviceManagers.add(deviceManagementService);
for (PluginInitializationListener listener : listeners) { for (PluginInitializationListener listener : listeners) {
listener.registerDeviceManagementService(deviceManagementService); listener.registerDeviceManagementService(deviceManagementService);
} }
} }
}
/** /**
* Unsets Device Management service. * Unsets Device Management service.

Loading…
Cancel
Save