Parameter synapseCtxParam = new Parameter(SynapseConstants.SYNAPSE_CONFIG, null);
synapseCtxParam.setValue(newConfig);
MessageContextCreatorForAxis2.setSynConfig(newConfig);
//set up synapse env
Axis2SynapseEnvironment synEnv = new Axis2SynapseEnvironment(
configurationContext, newConfig, serverContextInformation);
Parameter synapseEnvParam = new Parameter(SynapseConstants.SYNAPSE_ENV, null);
synapseEnvParam.setValue(synEnv);
MessageContextCreatorForAxis2.setSynEnv(synEnv);
try {
axisCfg.addParameter(synapseCtxParam);
axisCfg.addParameter(synapseEnvParam);
} catch (AxisFault axisFault) {
// This condition should not occur unless there is a programming error
handleException("Error while adding SynapseConfiguration and/or SynapseEnvironment " +
"to the AxisConfiguration", axisFault);
}
synEnv.getTaskManager().init(taskRepository, taskScheduler);
Parameter suspendPersistence = new Parameter(ServiceBusConstants.SUSPEND_PERSISTENCE, "true");
try {
axisCfg.addParameter(suspendPersistence);
deployServices(newConfig);
} finally {
serverContextInformation.setSynapseConfiguration(newConfig);
serverContextInformation.setSynapseEnvironment(synEnv);
newConfig.init(synEnv);
synEnv.setInitialized(true);
axisCfg.removeParameter(suspendPersistence);
initPersistence(newConfig);
publishConfiguration(newConfig, synEnv);
}