org.apache.activemq.ActiveMQConnectionFactory.createTransport()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中org.apache.activemq.ActiveMQConnectionFactory.createTransport()方法的一些代码示例,展示了ActiveMQConnectionFactory.createTransport()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ActiveMQConnectionFactory.createTransport()方法的具体详情如下:
包路径:org.apache.activemq.ActiveMQConnectionFactory
类名称:ActiveMQConnectionFactory
方法名:createTransport

ActiveMQConnectionFactory.createTransport介绍

[英]Creates a Transport based on this object's connection settings. Separated from createActiveMQConnection to allow for subclasses to override.
[中]基于此对象的连接设置创建传输。与createActiveMQConnection分离以允许子类重写。

代码示例

代码示例来源:origin: apache/activemq

/**
 * Overriding to make special considerations for SSL connections. If we are
 * not using SSL, the superclass's method is called. If we are using SSL, an
 * SslConnectionFactory is used and it is given the needed key and trust
 * managers.
 *
 * @author sepandm@gmail.com
 */
@Override
protected Transport createTransport() throws JMSException {
  SslContext existing = SslContext.getCurrentSslContext();
  try {
    if (keyStore != null || trustStore != null) {
      keyManager = createKeyManager();
      trustManager = createTrustManager();
    }
    if (keyManager != null || trustManager != null) {
      SslContext.setCurrentSslContext(new SslContext(keyManager, trustManager, secureRandom));
    }
    return super.createTransport();
  } catch (Exception e) {
    throw JMSExceptionSupport.create("Could not create Transport. Reason: " + e, e);
  } finally {
    SslContext.setCurrentSslContext(existing);
  }
}

代码示例来源:origin: apache/activemq

Transport transport = createTransport();
connection = createActiveMQConnection(transport, factoryStats);

代码示例来源:origin: pierre/meteo

/**
 * Overriding to make special considerations for SSL connections. If we are
 * not using SSL, the superclass's method is called. If we are using SSL, an
 * SslConnectionFactory is used and it is given the needed key and trust
 * managers.
 * 
 * @author sepandm@gmail.com
 */
protected Transport createTransport() throws JMSException {
  // If the given URI is non-ssl, let superclass handle it.
  if (!brokerURL.getScheme().equals("ssl")) {
    return super.createTransport();
  }
  try {
    if (keyManager == null || trustManager == null) {
      trustManager = createTrustManager();
      keyManager = createKeyManager();
      // secureRandom can be left as null
    }
    SslTransportFactory sslFactory = new SslTransportFactory();
    SslContext ctx = new SslContext(keyManager, trustManager, secureRandom);
    SslContext.setCurrentSslContext(ctx);
    return sslFactory.doConnect(brokerURL);
  } catch (Exception e) {
    throw JMSExceptionSupport.create("Could not create Transport. Reason: " + e, e);
  }
}

代码示例来源:origin: org.apache.activemq/activemq-client

/**
 * Overriding to make special considerations for SSL connections. If we are
 * not using SSL, the superclass's method is called. If we are using SSL, an
 * SslConnectionFactory is used and it is given the needed key and trust
 * managers.
 *
 * @author sepandm@gmail.com
 */
@Override
protected Transport createTransport() throws JMSException {
  SslContext existing = SslContext.getCurrentSslContext();
  try {
    if (keyStore != null || trustStore != null) {
      keyManager = createKeyManager();
      trustManager = createTrustManager();
    }
    if (keyManager != null || trustManager != null) {
      SslContext.setCurrentSslContext(new SslContext(keyManager, trustManager, secureRandom));
    }
    return super.createTransport();
  } catch (Exception e) {
    throw JMSExceptionSupport.create("Could not create Transport. Reason: " + e, e);
  } finally {
    SslContext.setCurrentSslContext(existing);
  }
}

代码示例来源:origin: org.apache.activemq/activemq-all

/**
 * Overriding to make special considerations for SSL connections. If we are
 * not using SSL, the superclass's method is called. If we are using SSL, an
 * SslConnectionFactory is used and it is given the needed key and trust
 * managers.
 *
 * @author sepandm@gmail.com
 */
@Override
protected Transport createTransport() throws JMSException {
  SslContext existing = SslContext.getCurrentSslContext();
  try {
    if (keyStore != null || trustStore != null) {
      keyManager = createKeyManager();
      trustManager = createTrustManager();
    }
    if (keyManager != null || trustManager != null) {
      SslContext.setCurrentSslContext(new SslContext(keyManager, trustManager, secureRandom));
    }
    return super.createTransport();
  } catch (Exception e) {
    throw JMSExceptionSupport.create("Could not create Transport. Reason: " + e, e);
  } finally {
    SslContext.setCurrentSslContext(existing);
  }
}

代码示例来源:origin: org.apache.activemq/activemq-osgi

/**
 * Overriding to make special considerations for SSL connections. If we are
 * not using SSL, the superclass's method is called. If we are using SSL, an
 * SslConnectionFactory is used and it is given the needed key and trust
 * managers.
 *
 * @author sepandm@gmail.com
 */
@Override
protected Transport createTransport() throws JMSException {
  SslContext existing = SslContext.getCurrentSslContext();
  try {
    if (keyStore != null || trustStore != null) {
      keyManager = createKeyManager();
      trustManager = createTrustManager();
    }
    if (keyManager != null || trustManager != null) {
      SslContext.setCurrentSslContext(new SslContext(keyManager, trustManager, secureRandom));
    }
    return super.createTransport();
  } catch (Exception e) {
    throw JMSExceptionSupport.create("Could not create Transport. Reason: " + e, e);
  } finally {
    SslContext.setCurrentSslContext(existing);
  }
}

代码示例来源:origin: org.apache.activemq/activemq-client

Transport transport = createTransport();
connection = createActiveMQConnection(transport, factoryStats);

代码示例来源:origin: org.apache.activemq/activemq-all

Transport transport = createTransport();
connection = createActiveMQConnection(transport, factoryStats);

代码示例来源:origin: org.apache.activemq/activemq-osgi

Transport transport = createTransport();
connection = createActiveMQConnection(transport, factoryStats);

代码示例来源:origin: pierre/meteo

Transport transport = createTransport();
connection = createActiveMQConnection(transport, factoryStats);

相关文章

微信公众号

最新文章

更多

ActiveMQConnectionFactory类方法