try
{
if(!_exchange.addBinding(bindingKey, amqQueue, bindingArguments))
{
Binding oldBinding = _exchange.getBinding(bindingKey, amqQueue, bindingArguments);
Map<String, Object> oldArgs = oldBinding.getArguments();
if((oldArgs == null && !bindingArguments.isEmpty()) || (oldArgs != null && !oldArgs.equals(bindingArguments)))
{
_exchange.replaceBinding(oldBinding.getId(), bindingKey, amqQueue, bindingArguments);
}
}
Binding binding = _exchange.getBinding(bindingKey, amqQueue, bindingArguments);
synchronized (_bindingAdapters)
{
return binding == null ? null : _bindingAdapters.get(binding);
}