use of org.apache.qpid.server.transport.TransportProvider in project qpid-broker-j by apache.
the class AmqpPortImpl method onActivate.
@Override
protected State onActivate() {
if (getAncestor(SystemConfig.class).isManagementMode()) {
return State.QUIESCED;
} else {
Collection<Transport> transports = getTransports();
TransportProvider transportProvider = null;
final HashSet<Transport> transportSet = new HashSet<>(transports);
for (TransportProviderFactory tpf : (new QpidServiceLoader()).instancesOf(TransportProviderFactory.class)) {
if (tpf.getSupportedTransports().contains(transports)) {
transportProvider = tpf.getTransportProvider(transportSet);
}
}
if (transportProvider == null) {
throw new IllegalConfigurationException("No transport providers found which can satisfy the requirement to support the transports: " + transports);
}
if (transports.contains(Transport.SSL) || transports.contains(Transport.WSS)) {
_sslContext = createSslContext();
}
Protocol defaultSupportedProtocolReply = getDefaultAmqpSupportedReply();
try {
_transport = transportProvider.createTransport(transportSet, _sslContext, this, getProtocols(), defaultSupportedProtocolReply);
_transport.start();
_boundPort = _transport.getAcceptingPort();
for (Transport transport : getTransports()) {
_container.getEventLogger().message(BrokerMessages.LISTENING(String.valueOf(transport), _transport.getAcceptingPort()));
}
return State.ACTIVE;
} catch (PortBindFailureException e) {
_container.getEventLogger().message(PortMessages.BIND_FAILED(getType().toUpperCase(), getPort()));
throw e;
}
}
}
Aggregations