{
if (protocols.size() > 1)
{
throw new IllegalConfigurationException("Only one protocol can be used on non AMQP port");
}
Protocol protocol = protocols.iterator().next();
if(!broker.isManagementMode() && protocol.getProtocolType() != ProtocolType.HTTP)
{
//ManagementMode needs this relaxed to allow its overriding management ports to be inserted.
//Enforce only a single port of each management protocol, as the plugins will only use one.
Collection<Port> existingPorts = broker.getPorts();
for (Port existingPort : existingPorts)
{
Collection<Protocol> portProtocols = existingPort.getProtocols();
if (portProtocols != null && portProtocols.contains(protocol))
{
throw new IllegalConfigurationException("Port for protocol " + protocol + " already exists. Only one management port per protocol can be created.");
}
}
}
defaults.put(Port.NAME, portValue + "-" + protocol.name());
port = new NonAmqpPortAdapter(id, broker, attributes, defaults, broker.getTaskExecutor());
boolean rmiPort = port.getProtocols().contains(Protocol.RMI);
if (rmiPort && port.getTransports().contains(Transport.SSL))
{