Java 类com.rabbitmq.client.impl.nio.NioParams 实例源码

项目:illuminati    文件:RabbitmqInfraTemplateImpl.java   
private void setBasicProperties () {
    final NioParams nioParams = new NioParams()
            .setNbIoThreads(1)
            .setWriteEnqueuingTimeoutInMs(0)
            .setWriteByteBufferSize(VALUE_SET_WRITE_BUFFER_SIZE);

    RABBITMQ_CONNECTION_FACTORY.useNio();
    RABBITMQ_CONNECTION_FACTORY.setNioParams(nioParams);
    RABBITMQ_CONNECTION_FACTORY.setConnectionTimeout(VALUE_CONNECTION_TIMEOUT_MS);
    RABBITMQ_CONNECTION_FACTORY.setChannelRpcTimeout(VALUE_RPC_CALL_TIMEOUT_MS);
    RABBITMQ_CONNECTION_FACTORY.setHandshakeTimeout(VALUE_HANDSHAKE_CONNECTION_TIMEOUT_MS);

    ExecutorService shutdownExecutor = Executors.newSingleThreadExecutor();
    RABBITMQ_CONNECTION_FACTORY.setShutdownExecutor(shutdownExecutor);

    RABBITMQ_CONNECTION_FACTORY.setShutdownTimeout(VALUE_SHUTDOWN_TIMEOUT_MS);
    RABBITMQ_CONNECTION_FACTORY.setRequestedHeartbeat(VALUE_REQUESTED_HEART_BEAT);
    RABBITMQ_CONNECTION_FACTORY.setAutomaticRecoveryEnabled(VALUE_AUTOMATIC_RECOVERY);
    RABBITMQ_CONNECTION_FACTORY.setTopologyRecoveryEnabled(VALUE_AUTOMATIC_EXCHANGE_RECOVERY);
    RABBITMQ_CONNECTION_FACTORY.setNetworkRecoveryInterval(VALUE_AUTOMATIC_RECOVERY_NETWORK_DELAY_MS);
    RABBITMQ_CONNECTION_FACTORY.setVirtualHost(this.virtualHost);
    RABBITMQ_CONNECTION_FACTORY.setSocketConfigurator(new DefaultSocketConfigurator() {
        @Override
        public void configure(Socket socket) throws IOException {
            socket.setTcpNoDelay(VALUE_DONT_USE_NAGLE);
            socket.setReceiveBufferSize(VALUE_SET_WRITE_BUFFER_SIZE);
            socket.setSendBufferSize(VALUE_SET_SEND_BUFFER_SIZE);
            socket.setPerformancePreferences(0, 2, 1);
            socket.setReuseAddress(true);
            socket.setKeepAlive(VALUE_TCP_KEELALIVE);
            socket.setSoLinger(true, 1000);
        }
    });
}
项目:lyra    文件:ConnectionOptions.java   
/**
 * Support for Java non-blocking IO
 *
 * @param nioParams The NIO mode can be configured through the NioParams class
 */
public ConnectionOptions withNioParams(NioParams nioParams) {
  this.nioParams = nioParams;
  factory.setNioParams(Assert.notNull(nioParams, "nioParams"));
  factory.useNio();
  return this;
}
项目:hammock    文件:RabbitMQConfiguration.java   
public NioParams getNioParams() {
    return nioParams;
}
项目:lyra    文件:ConnectionOptions.java   
/**
 * Return NioParams object.
 * @see #withNioParams(NioParams)
 * @see #withNio()
 */
public NioParams getNioParams() {
  return nioParams;
}