Tabnine Logo
ClientBootstrap.setOption
Code IndexAdd Tabnine to your IDE (free)

How to use
setOption
method
in
org.jboss.netty.bootstrap.ClientBootstrap

Best Java code snippets using org.jboss.netty.bootstrap.ClientBootstrap.setOption (Showing top 20 results out of 666)

origin: alibaba/jstorm

public void start() {
  bootstrap = new ClientBootstrap(clientChannelFactory);
  bootstrap.setOption("tcpNoDelay", true);
  bootstrap.setOption("reuseAddress", true);
  bootstrap.setOption("sendBufferSize", bufferSize);
  bootstrap.setOption("keepAlive", true);
  // Set up the pipeline factory.
  bootstrap.setPipelineFactory(new StormClientPipelineFactory(this, stormConf));
  reconnect();
}
origin: apache/incubator-dubbo

@Override
protected void doOpen() throws Throwable {
  NettyHelper.setNettyLoggerFactory();
  bootstrap = new ClientBootstrap(channelFactory);
  // config
  // @see org.jboss.netty.channel.socket.SocketChannelConfig
  bootstrap.setOption("keepAlive", true);
  bootstrap.setOption("tcpNoDelay", true);
  bootstrap.setOption("connectTimeoutMillis", getConnectTimeout());
  final NettyHandler nettyHandler = new NettyHandler(getUrl(), this);
  bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
    @Override
    public ChannelPipeline getPipeline() {
      NettyCodecAdapter adapter = new NettyCodecAdapter(getCodec(), getUrl(), NettyClient.this);
      ChannelPipeline pipeline = Channels.pipeline();
      pipeline.addLast("decoder", adapter.getDecoder());
      pipeline.addLast("encoder", adapter.getEncoder());
      pipeline.addLast("handler", nettyHandler);
      return pipeline;
    }
  });
}
origin: apache/incubator-dubbo

@Override
protected void doOpen() throws Throwable {
  NettyHelper.setNettyLoggerFactory();
  bootstrap = new ClientBootstrap(channelFactory);
  // config
  // @see org.jboss.netty.channel.socket.SocketChannelConfig
  bootstrap.setOption("keepAlive", true);
  bootstrap.setOption("tcpNoDelay", true);
  bootstrap.setOption("connectTimeoutMillis", getConnectTimeout());
  final NettyHandler nettyHandler = new NettyHandler(getUrl(), this);
  bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
    @Override
    public ChannelPipeline getPipeline() {
      NettyCodecAdapter adapter = new NettyCodecAdapter(getCodec(), getUrl(), NettyClient.this);
      ChannelPipeline pipeline = Channels.pipeline();
      pipeline.addLast("decoder", adapter.getDecoder());
      pipeline.addLast("encoder", adapter.getEncoder());
      pipeline.addLast("handler", nettyHandler);
      return pipeline;
    }
  });
}
origin: MovingBlocks/Terasology

public ServerInfoService() {
  pool = Executors.newCachedThreadPool();
  factory = new NioClientSocketChannelFactory(pool, pool, 1, 1);
  bootstrap = new ClientBootstrap(factory);
  bootstrap.setPipelineFactory(new InfoRequestPipelineFactory());
  bootstrap.setOption("tcpNoDelay", true);
  bootstrap.setOption("keepAlive", true);
}
origin: menacher/java-game-server

this.bootstrap.setOption("tcpNoDelay", true);
this.bootstrap.setOption("keepAlive", true);
this.maxShutdownWaitTime = maxShutdownWaitTime;
Runtime.getRuntime().addShutdownHook(new Thread()
origin: apache/incubator-druid

bootstrap.setOption("keepAlive", true);
bootstrap.setPipelineFactory(new HttpClientPipelineFactory());
origin: weibocom/motan

bootstrap = new ClientBootstrap(channelFactory);
bootstrap.setOption("keepAlive", true);
bootstrap.setOption("tcpNoDelay", true);
      MotanErrorMsgConstant.FRAMEWORK_INIT_ERROR);
bootstrap.setOption("connectTimeoutMillis", timeout);
origin: MovingBlocks/Terasology

ClientBootstrap bootstrap = new ClientBootstrap(factory);
bootstrap.setPipelineFactory(new TerasologyClientPipelineFactory(this));
bootstrap.setOption("tcpNoDelay", true);
bootstrap.setOption("keepAlive", true);
ChannelFuture connectCheck = bootstrap.connect(new InetSocketAddress(address, port));
try {
origin: eBay/parallec

/**
 * Creates the tcpClient with proper handler.
 *
 * @return the bound request builder
 * @throws HttpRequestCreateException
 *             the http request create exception
 */
public ClientBootstrap bootStrapTcpClient()
    throws HttpRequestCreateException {
  ClientBootstrap tcpClient = null;
  try {
    // Configure the client.
    tcpClient = new ClientBootstrap(tcpMeta.getChannelFactory());
    // Configure the pipeline factory.
    tcpClient.setPipelineFactory(new MyPipelineFactory(TcpUdpSshPingResourceStore.getInstance().getTimer(),
        this, tcpMeta.getTcpIdleTimeoutSec())
    );
    tcpClient.setOption("connectTimeoutMillis",
        tcpMeta.getTcpConnectTimeoutMillis());
    tcpClient.setOption("tcpNoDelay", true);
   // tcpClient.setOption("keepAlive", true);
  } catch (Exception t) {
    throw new TcpUdpRequestCreateException(
        "Error in creating request in Tcpworker. "
            + " If tcpClient is null. Then fail to create.", t);
  }
  return tcpClient;
}
origin: os-libera/OpenVirteX

private void setClientBootStrapParams(final ClientBootstrap bootstrap) {
  bootstrap.setOption("reuseAddr", true);
  bootstrap.setOption("child.keepAlive", true);
  bootstrap.setOption("child.tcpNoDelay", true);
  bootstrap.setOption("child.sendBufferSize",
      OpenVirteXController.SEND_BUFFER_SIZE);
}
origin: com.ning/async-http-client

String key = entry.getKey();
Object value = entry.getValue();
plainBootstrap.setOption(key, value);
webSocketBootstrap.setOption(key, value);
secureBootstrap.setOption(key, value);
secureWebSocketBootstrap.setOption(key, value);
origin: wg/lettuce

/**
 * Set the default timeout for {@link RedisConnection connections} created by
 * this client. The timeout applies to connection attempts and non-blocking
 * commands.
 *
 * @param timeout   Default connection timeout.
 * @param unit      Unit of time for the timeout.
 */
public void setDefaultTimeout(long timeout, TimeUnit unit) {
  this.timeout = timeout;
  this.unit    = unit;
  bootstrap.setOption("connectTimeoutMillis", unit.toMillis(timeout));
}
origin: com.alibaba.jstorm/jstorm-core

public void start() {
  bootstrap = new ClientBootstrap(clientChannelFactory);
  bootstrap.setOption("tcpNoDelay", true);
  bootstrap.setOption("reuseAddress", true);
  bootstrap.setOption("sendBufferSize", bufferSize);
  bootstrap.setOption("keepAlive", true);
  // Set up the pipeline factory.
  bootstrap.setPipelineFactory(new StormClientPipelineFactory(this, stormConf));
  reconnect();
}
origin: net.sourceforge.openutils/openutils-mgnlmedia

private static ClientBootstrap getBootstrap(final Executor executor, final ClientOptions options)
{
  final ChannelFactory factory = new NioClientSocketChannelFactory(executor, executor);
  final ClientBootstrap bootstrap = new ClientBootstrap(factory);
  bootstrap.setPipelineFactory(new ClientPipelineFactory(options));
  bootstrap.setOption("tcpNoDelay", true);
  bootstrap.setOption("keepAlive", true);
  return bootstrap;
}
origin: net.sourceforge.openutils/flazr

private static ClientBootstrap getBootstrap(final Executor executor, final ClientOptions options) {
  final ChannelFactory factory = new NioClientSocketChannelFactory(executor, executor);
  final ClientBootstrap bootstrap = new ClientBootstrap(factory);
  bootstrap.setPipelineFactory(new ClientPipelineFactory(options));
  bootstrap.setOption("tcpNoDelay" , true);
  bootstrap.setOption("keepAlive", true);
  return bootstrap;
}
origin: itisaid/Doris

public void init() {
  // initialize the connection factory, such as we need create connection pools here.
  // Configure the client.
  bootstrap = new ClientBootstrap(new NioClientSocketChannelFactory(Executors.newCachedThreadPool(),
                                   Executors.newCachedThreadPool()));
  // Set up the pipeline factory.
  bootstrap.setPipelineFactory(new DorisClentNettyPipelineFactory());
  bootstrap.setOption("connectTimeoutMillis", CONNECT_TIME_OUT_MILLIS);
  bootstrap.setOption("tcpNoDelay", true);
}
origin: net.anthavio/hatatitla

public NettyTransport(SenderConfigurer config, ExecutorService executor) {
  client = new ClientBootstrap(new NioClientSocketChannelFactory(Executors.newCachedThreadPool(),
      Executors.newCachedThreadPool()));
  client.setOption("connectTimeoutMillis", 10000);
  client.setOption("keepAlive", true);
  client.setPipelineFactory(new HttpClientPipelineFactory(true));
  channels = new DefaultChannelGroup();
}
origin: rosjava/rosjava_core

public TcpClient(final ChannelGroup channelGroup, final Executor executor) {
 this.channelGroup = channelGroup;
 channelFactory = new NioClientSocketChannelFactory(executor, executor);
 channelBufferFactory = new HeapChannelBufferFactory(ByteOrder.LITTLE_ENDIAN);
 bootstrap = new ClientBootstrap(channelFactory);
 bootstrap.setOption("bufferFactory", channelBufferFactory);
 setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT_DURATION, DEFAULT_CONNECTION_TIMEOUT_UNIT);
 setKeepAlive(DEFAULT_KEEP_ALIVE);
 namedChannelHandlers = Lists.newArrayList();
}
origin: com.aphyr/riemann-java-client

 public void run(Timeout timeout) throws Exception {
  if (bootstrap instanceof ClientBootstrap) {
   ClientBootstrap b = (ClientBootstrap) bootstrap;
   b.setOption("remoteAddress", getRemoteAddress());
   b.connect();
  } else if (bootstrap instanceof ConnectionlessBootstrap) {
   ConnectionlessBootstrap b = (ConnectionlessBootstrap) bootstrap;
   b.setOption("remoteAddress", getRemoteAddress());
   b.connect();
  }
 }
}, delay.get(), unit);
origin: org.jboss.ws.native/jbossws-native-core

private NettyTransportHandler(URL url, ChannelPipelineFactory pipelineFactory)
{
 this.url = url;
 ChannelFactory factory = factoryProvider.getClientSocketChannelFactoryInstance();
 ClientBootstrap bootstrap = new ClientBootstrap(factory);
 bootstrap.setPipelineFactory(pipelineFactory);
 
 //Start the connection attempt
 bootstrap.setOption("tcpNoDelay", true);
 connectFuture = bootstrap.connect(getSocketAddress(url));
}
org.jboss.netty.bootstrapClientBootstrapsetOption

Popular methods of ClientBootstrap

  • connect
    Attempts a new connection with the specified remoteAddress and the specified localAddress. If the sp
  • <init>
    Creates a new instance with the specified initial ChannelFactory.
  • setPipelineFactory
  • releaseExternalResources
  • getPipeline
  • getFactory
  • setOptions
  • getOption
  • getOptions
  • shutdown
  • getPipelineFactory
  • setPipeline
  • getPipelineFactory,
  • setPipeline,
  • setFactory

Popular in Java

  • Making http requests using okhttp
  • runOnUiThread (Activity)
  • setRequestProperty (URLConnection)
  • scheduleAtFixedRate (Timer)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now