use of org.apache.activemq.artemis.spi.core.remoting.AcceptorFactory in project activemq-artemis by apache.
the class RemotingServiceImpl method createAcceptor.
@Override
public Acceptor createAcceptor(TransportConfiguration info) {
Acceptor acceptor = null;
try {
AcceptorFactory factory = server.getServiceRegistry().getAcceptorFactory(info.getName(), info.getFactoryClassName());
Map<String, ProtocolManagerFactory> selectedProtocolFactories = new ConcurrentHashMap<>();
@SuppressWarnings("deprecation") String protocol = ConfigurationHelper.getStringProperty(TransportConstants.PROTOCOL_PROP_NAME, null, info.getParams());
if (protocol != null) {
ActiveMQServerLogger.LOGGER.warnDeprecatedProtocol();
locateProtocols(protocol, info, selectedProtocolFactories);
}
String protocols = ConfigurationHelper.getStringProperty(TransportConstants.PROTOCOLS_PROP_NAME, null, info.getParams());
if (protocols != null) {
locateProtocols(protocols, info, selectedProtocolFactories);
}
ClusterConnection clusterConnection = lookupClusterConnection(info);
// If empty: we get the default list
if (selectedProtocolFactories.isEmpty()) {
selectedProtocolFactories = protocolMap;
}
Map<String, ProtocolManager> selectedProtocols = new ConcurrentHashMap<>();
for (Entry<String, ProtocolManagerFactory> entry : selectedProtocolFactories.entrySet()) {
selectedProtocols.put(entry.getKey(), entry.getValue().createProtocolManager(server, info.getExtraParams(), incomingInterceptors, outgoingInterceptors));
}
acceptor = factory.createAcceptor(info.getName(), clusterConnection, info.getParams(), new DelegatingBufferHandler(), this, threadPool, scheduledThreadPool, selectedProtocols);
if (defaultInvmSecurityPrincipal != null && acceptor.isUnsecurable()) {
acceptor.setDefaultActiveMQPrincipal(defaultInvmSecurityPrincipal);
}
acceptors.put(info.getName(), acceptor);
if (managementService != null) {
acceptor.setNotificationService(managementService);
managementService.registerAcceptor(acceptor, info);
}
} catch (Exception e) {
ActiveMQServerLogger.LOGGER.errorCreatingAcceptor(e, info.getFactoryClassName());
}
return acceptor;
}
use of org.apache.activemq.artemis.spi.core.remoting.AcceptorFactory in project activemq-artemis by apache.
the class ServiceRegistryImpl method getAcceptorFactory.
@Override
public AcceptorFactory getAcceptorFactory(String name, final String className) {
AcceptorFactory factory = acceptorFactories.get(name);
if (factory == null && className != null) {
factory = loadClass(className);
addAcceptorFactory(name, factory);
}
return factory;
}
Aggregations