if (binding == null)
{
throw new IllegalArgumentException("Binding is null");
}
Condition condition = binding.condition;
Queue queue = binding.queue;
if (queue == null)
{
throw new IllegalArgumentException("Queue is null");
}
if (queue.getNodeID() != thisNodeID)
{
throw new IllegalArgumentException("Cannot bind a queue from another node");
}
if (condition == null)
{
throw new IllegalArgumentException("Condition is null");
}
//The binding might already exist - this could happen if the queue is bind all simultaneously from more than one node of the cluster
boolean added = addBindingInMemory(binding);
if (added)
{
if (queue.isRecoverable())
{
// Need to write the mapping to the database
insertBindingInStorage(condition, queue, binding.allNodes);
}
if (clustered && queue.isClustered())
{
String filterString = queue.getFilter() == null ? null : queue.getFilter().getFilterString();
MappingInfo info = new MappingInfo(thisNodeID, queue.getName(), condition.toText(), filterString, queue.getChannelID(),
queue.isRecoverable(), true,
binding.allNodes,
queue.getFullSize(), queue.getPageSize(), queue.getDownCacheSize(),
queue.getMaxSize(),
queue.getRecoverDeliveriesTimeout());