Search in sources :

Example 1 with AcceptorFactory

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;
}
Also used : Acceptor(org.apache.activemq.artemis.spi.core.remoting.Acceptor) ProtocolManagerFactory(org.apache.activemq.artemis.spi.core.protocol.ProtocolManagerFactory) CoreProtocolManagerFactory(org.apache.activemq.artemis.core.protocol.core.impl.CoreProtocolManagerFactory) ActiveMQException(org.apache.activemq.artemis.api.core.ActiveMQException) ActiveMQRemoteDisconnectException(org.apache.activemq.artemis.api.core.ActiveMQRemoteDisconnectException) ActiveMQInterruptedException(org.apache.activemq.artemis.api.core.ActiveMQInterruptedException) ClusterConnection(org.apache.activemq.artemis.core.server.cluster.ClusterConnection) ProtocolManager(org.apache.activemq.artemis.spi.core.protocol.ProtocolManager) AcceptorFactory(org.apache.activemq.artemis.spi.core.remoting.AcceptorFactory) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Example 2 with AcceptorFactory

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;
}
Also used : AcceptorFactory(org.apache.activemq.artemis.spi.core.remoting.AcceptorFactory)

Aggregations

AcceptorFactory (org.apache.activemq.artemis.spi.core.remoting.AcceptorFactory)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ActiveMQException (org.apache.activemq.artemis.api.core.ActiveMQException)1 ActiveMQInterruptedException (org.apache.activemq.artemis.api.core.ActiveMQInterruptedException)1 ActiveMQRemoteDisconnectException (org.apache.activemq.artemis.api.core.ActiveMQRemoteDisconnectException)1 CoreProtocolManagerFactory (org.apache.activemq.artemis.core.protocol.core.impl.CoreProtocolManagerFactory)1 ClusterConnection (org.apache.activemq.artemis.core.server.cluster.ClusterConnection)1 ProtocolManager (org.apache.activemq.artemis.spi.core.protocol.ProtocolManager)1 ProtocolManagerFactory (org.apache.activemq.artemis.spi.core.protocol.ProtocolManagerFactory)1 Acceptor (org.apache.activemq.artemis.spi.core.remoting.Acceptor)1