/** * Add a new namespace binding for this deployment. This will return a boolean that can be used to determine if this * is the authoritative binding (the first), and should actually be performed. * * @param name The JNDI name of the binding * @param value The value of the binding * @return true if this is the authoritative binding * @throws DuplicateBindingException If this binding already exists and is not compatible with the existing binding. */ public boolean addBinding(final JndiName name, final Object value) throws DuplicateBindingException { final Object existing = bindings.putIfAbsent(name, value); if (existing != null && !existing.equals(value)) { throw new DuplicateBindingException(MESSAGES.duplicateBinding(name, existing, value)); } return existing == null; } }