delegates.put(uniqueName, delegate);
// Now bind it in JNDI
rebindConnectionFactory(initialContext, jndiBindings, delegate);
ConnectionFactoryAdvised advised;
// Need to synchronized to prevent a deadlock
// See http://jira.jboss.com/jira/browse/JBMESSAGING-797
synchronized (AspectManager.instance())
{
advised = new ConnectionFactoryAdvised(endpoint);
}
// Registering with the dispatcher should always be the last thing otherwise a client could
// use a partially initialised object
Dispatcher.instance.registerTarget(id, advised);