Fix OOM issue due to multiple SynapseConfiguration instances created for a single tenant
Ports
package org.wso2.micro.integrator.initializer.utils;
+import org.apache.synapse.config.SynapseConfiguration;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.cm.ConfigurationAdmin;
@@ -47,6 +48,8 @@ public class ConfigurationHolder {
private Map<Integer, ServiceRegistration> synapseRegistrations =
new HashMap<Integer, ServiceRegistration>();
+ private Map<Integer, SynapseConfiguration> synapseConfigurationHashMap = new HashMap<>();
+
public static ConfigurationHolder getInstance() {
return ourInstance;
}
@@ -110,6 +113,14 @@ public class ConfigurationHolder {
this.synapseRegistrationsService = synapseRegistrationsService;
}
+ public SynapseConfiguration getSynapseConfiguration(int tenantId) {
+ return synapseConfigurationHashMap.get(tenantId);
+ }
+
+ public void addSynapseConfiguration(int tenanId, SynapseConfiguration synapseConfiguration) {
+ synapseConfigurationHashMap.put(tenanId, synapseConfiguration);
+ }
+
public void setConfigAdminService(ConfigurationAdmin configAdminService) {
this.configAdminService = configAdminService;
}
