INTSAMPLES-39 Synchronize Context Creation

Creating an application context for a new customer needs
to be synchronized.
This commit is contained in:
Gary Russell
2011-12-16 04:16:13 -05:00
parent 4e95a0fe0d
commit 13d31c25cd

View File

@@ -46,6 +46,14 @@ public class DynamicFtpChannelResolver {
* @return a channel
*/
public MessageChannel resolve(String customer) {
MessageChannel channel = this.channels.get(customer);
if (channel == null) {
channel = createNewCustomerChannel(customer);
}
return channel;
}
private synchronized MessageChannel createNewCustomerChannel(String customer) {
MessageChannel channel = this.channels.get(customer);
if (channel == null) {
ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext(