Exemplo n.º 1
0
  public InVMConnector(
      final Map<String, Object> configuration,
      final BufferHandler handler,
      final ConnectionLifeCycleListener listener,
      final Executor closeExecutor,
      final Executor threadPool,
      ClientProtocolManager protocolManager) {
    super(configuration);
    this.listener = listener;

    id =
        ConfigurationHelper.getIntProperty(
            TransportConstants.SERVER_ID_PROP_NAME, 0, configuration);

    this.handler = handler;

    this.closeExecutor = closeExecutor;

    executorFactory = new OrderedExecutorFactory(threadPool);

    InVMRegistry registry = InVMRegistry.instance;

    acceptor = registry.getAcceptor(id);

    this.protocolManager = protocolManager;
  }
Exemplo n.º 2
0
 @Override
 public boolean isEquivalent(Map<String, Object> configuration) {
   int serverId =
       ConfigurationHelper.getIntProperty(
           TransportConstants.SERVER_ID_PROP_NAME, 0, configuration);
   return id == serverId;
 }
  public IncomingVertxEventHandler(
      String connectorName,
      Map<String, Object> configuration,
      StorageManager storageManager,
      PostOffice postOffice,
      ScheduledExecutorService scheduledThreadPool) {
    this.connectorName = connectorName;
    this.queueName =
        ConfigurationHelper.getStringProperty(VertxConstants.QUEUE_NAME, null, configuration);

    this.port = ConfigurationHelper.getIntProperty(VertxConstants.PORT, 0, configuration);
    this.host =
        ConfigurationHelper.getStringProperty(VertxConstants.HOST, "localhost", configuration);
    this.quorumSize =
        ConfigurationHelper.getIntProperty(VertxConstants.VERTX_QUORUM_SIZE, -1, configuration);
    this.haGroup =
        ConfigurationHelper.getStringProperty(
            VertxConstants.VERTX_HA_GROUP, "activemq", configuration);
    this.vertxAddress =
        ConfigurationHelper.getStringProperty(
            VertxConstants.VERTX_ADDRESS, "org.apache.activemq", configuration);

    this.storageManager = storageManager;
    this.postOffice = postOffice;
  }
  StompConnection(
      final Acceptor acceptorUsed,
      final Connection transportConnection,
      final StompProtocolManager manager) {
    this.transportConnection = transportConnection;

    this.manager = manager;

    this.frameHandler = new StompFrameHandlerV10(this);

    this.creationTime = System.currentTimeMillis();

    this.acceptorUsed = acceptorUsed;

    this.enableMessageID =
        ConfigurationHelper.getBooleanProperty(
            TransportConstants.STOMP_ENABLE_MESSAGE_ID, false, acceptorUsed.getConfiguration());
    this.minLargeMessageSize =
        ConfigurationHelper.getIntProperty(
            TransportConstants.STOMP_MIN_LARGE_MESSAGE_SIZE,
            ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
            acceptorUsed.getConfiguration());
  }
  public NettyAcceptor(
      final String name,
      final ClusterConnection clusterConnection,
      final Map<String, Object> configuration,
      final BufferHandler handler,
      final ConnectionLifeCycleListener listener,
      final ScheduledExecutorService scheduledThreadPool,
      final Map<String, ProtocolManager> protocolMap) {
    this.name = name;

    this.clusterConnection = clusterConnection;

    this.configuration = configuration;

    this.handler = handler;

    this.listener = listener;

    sslEnabled =
        ConfigurationHelper.getBooleanProperty(
            TransportConstants.SSL_ENABLED_PROP_NAME,
            TransportConstants.DEFAULT_SSL_ENABLED,
            configuration);

    nioRemotingThreads =
        ConfigurationHelper.getIntProperty(
            TransportConstants.NIO_REMOTING_THREADS_PROPNAME, -1, configuration);
    backlog =
        ConfigurationHelper.getIntProperty(TransportConstants.BACKLOG_PROP_NAME, -1, configuration);
    useInvm =
        ConfigurationHelper.getBooleanProperty(
            TransportConstants.USE_INVM_PROP_NAME,
            TransportConstants.DEFAULT_USE_INVM,
            configuration);

    this.protocolHandler =
        new ProtocolHandler(protocolMap, this, configuration, scheduledThreadPool);

    this.protocolsString = getProtocols(protocolMap);

    host =
        ConfigurationHelper.getStringProperty(
            TransportConstants.HOST_PROP_NAME, TransportConstants.DEFAULT_HOST, configuration);
    port =
        ConfigurationHelper.getIntProperty(
            TransportConstants.PORT_PROP_NAME, TransportConstants.DEFAULT_PORT, configuration);
    if (sslEnabled) {
      keyStoreProvider =
          ConfigurationHelper.getStringProperty(
              TransportConstants.KEYSTORE_PROVIDER_PROP_NAME,
              TransportConstants.DEFAULT_KEYSTORE_PROVIDER,
              configuration);

      keyStorePath =
          ConfigurationHelper.getStringProperty(
              TransportConstants.KEYSTORE_PATH_PROP_NAME,
              TransportConstants.DEFAULT_KEYSTORE_PATH,
              configuration);

      keyStorePassword =
          ConfigurationHelper.getPasswordProperty(
              TransportConstants.KEYSTORE_PASSWORD_PROP_NAME,
              TransportConstants.DEFAULT_KEYSTORE_PASSWORD,
              configuration,
              ActiveMQDefaultConfiguration.getPropMaskPassword(),
              ActiveMQDefaultConfiguration.getPropMaskPassword());

      trustStoreProvider =
          ConfigurationHelper.getStringProperty(
              TransportConstants.TRUSTSTORE_PROVIDER_PROP_NAME,
              TransportConstants.DEFAULT_TRUSTSTORE_PROVIDER,
              configuration);

      trustStorePath =
          ConfigurationHelper.getStringProperty(
              TransportConstants.TRUSTSTORE_PATH_PROP_NAME,
              TransportConstants.DEFAULT_TRUSTSTORE_PATH,
              configuration);

      trustStorePassword =
          ConfigurationHelper.getPasswordProperty(
              TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME,
              TransportConstants.DEFAULT_TRUSTSTORE_PASSWORD,
              configuration,
              ActiveMQDefaultConfiguration.getPropMaskPassword(),
              ActiveMQDefaultConfiguration.getPropMaskPassword());

      enabledCipherSuites =
          ConfigurationHelper.getStringProperty(
              TransportConstants.ENABLED_CIPHER_SUITES_PROP_NAME,
              TransportConstants.DEFAULT_ENABLED_CIPHER_SUITES,
              configuration);

      enabledProtocols =
          ConfigurationHelper.getStringProperty(
              TransportConstants.ENABLED_PROTOCOLS_PROP_NAME,
              TransportConstants.DEFAULT_ENABLED_PROTOCOLS,
              configuration);

      needClientAuth =
          ConfigurationHelper.getBooleanProperty(
              TransportConstants.NEED_CLIENT_AUTH_PROP_NAME,
              TransportConstants.DEFAULT_NEED_CLIENT_AUTH,
              configuration);
    } else {
      keyStoreProvider = TransportConstants.DEFAULT_KEYSTORE_PROVIDER;
      keyStorePath = TransportConstants.DEFAULT_KEYSTORE_PATH;
      keyStorePassword = TransportConstants.DEFAULT_KEYSTORE_PASSWORD;
      trustStoreProvider = TransportConstants.DEFAULT_TRUSTSTORE_PROVIDER;
      trustStorePath = TransportConstants.DEFAULT_TRUSTSTORE_PATH;
      trustStorePassword = TransportConstants.DEFAULT_TRUSTSTORE_PASSWORD;
      enabledCipherSuites = TransportConstants.DEFAULT_ENABLED_CIPHER_SUITES;
      enabledProtocols = TransportConstants.DEFAULT_ENABLED_PROTOCOLS;
      needClientAuth = TransportConstants.DEFAULT_NEED_CLIENT_AUTH;
    }

    tcpNoDelay =
        ConfigurationHelper.getBooleanProperty(
            TransportConstants.TCP_NODELAY_PROPNAME,
            TransportConstants.DEFAULT_TCP_NODELAY,
            configuration);
    tcpSendBufferSize =
        ConfigurationHelper.getIntProperty(
            TransportConstants.TCP_SENDBUFFER_SIZE_PROPNAME,
            TransportConstants.DEFAULT_TCP_SENDBUFFER_SIZE,
            configuration);
    tcpReceiveBufferSize =
        ConfigurationHelper.getIntProperty(
            TransportConstants.TCP_RECEIVEBUFFER_SIZE_PROPNAME,
            TransportConstants.DEFAULT_TCP_RECEIVEBUFFER_SIZE,
            configuration);

    this.scheduledThreadPool = scheduledThreadPool;

    batchDelay =
        ConfigurationHelper.getLongProperty(
            TransportConstants.BATCH_DELAY, TransportConstants.DEFAULT_BATCH_DELAY, configuration);

    directDeliver =
        ConfigurationHelper.getBooleanProperty(
            TransportConstants.DIRECT_DELIVER,
            TransportConstants.DEFAULT_DIRECT_DELIVER,
            configuration);

    httpUpgradeEnabled =
        ConfigurationHelper.getBooleanProperty(
            TransportConstants.HTTP_UPGRADE_ENABLED_PROP_NAME,
            TransportConstants.DEFAULT_HTTP_UPGRADE_ENABLED,
            configuration);

    connectionsAllowed =
        ConfigurationHelper.getLongProperty(
            TransportConstants.CONNECTIONS_ALLOWED,
            TransportConstants.DEFAULT_CONNECTIONS_ALLOWED,
            configuration);
  }