Codota Logo
ClientBootstrap.getPipeline
Code IndexAdd Codota to your IDE (free)

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

Best Java code snippets using org.jboss.netty.bootstrap.ClientBootstrap.getPipeline (Showing top 12 results out of 315)

  • Common ways to obtain ClientBootstrap
private void myMethod () {
ClientBootstrap c =
  • Codota IconChannelFactory channelFactory;new ClientBootstrap(channelFactory)
  • Codota Iconnew ClientBootstrap(new NioClientSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool()))
  • Codota Iconnew ClientBootstrap(new NioClientSocketChannelFactory(Executors.newSingleThreadExecutor(), Executors.newSingleThreadExecutor()))
  • Smart code suggestions by Codota
}
origin: org.codehaus.gpars/gpars

@SuppressWarnings({"UnnecessaryBoxing"})
public Client(final NettyTransportProvider provider, final SocketAddress address, final UUID id) {
  this.provider = provider;
  factory = new NioClientSocketChannelFactory(
      Executors.newCachedThreadPool(MyThreadFactory.instance),
      Executors.newCachedThreadPool(MyThreadFactory.instance));
  final ClientBootstrap bootstrap = new ClientBootstrap(factory);
  final NettyHandler handler = new ClientHandler(this.provider, id);
  bootstrap.getPipeline().addLast("handler", handler);
  bootstrap.setOption("tcpNoDelay", Boolean.valueOf(true));
  bootstrap.setOption("keepAlive", Boolean.valueOf(true));
  channelFuture = bootstrap.connect(address);
}
origin: stackoverflow.com

 @Override
public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)
    throws Exception {
  // Suspend incoming traffic until connected to the remote host.
  final Channel inboundChannel = e.getChannel();
  inboundChannel.setReadable(false);

  // Start the connection attempt.
  ClientBootstrap cb = new ClientBootstrap(cf);
  cb.getPipeline().addLast("handler", new OutboundHandler(e.getChannel()));
  ChannelFuture f = cb.connect(new InetSocketAddress(remoteHost, remotePort));

  outboundChannel = f.getChannel();
  f.addListener(new ChannelFutureListener() {
    public void operationComplete(ChannelFuture future) throws Exception {
      if (future.isSuccess()) {
        // Connection attempt succeeded:
        // Begin to accept incoming traffic.
        inboundChannel.setReadable(true);
      } else {
        // Close the connection if the connection attempt has failed.
        inboundChannel.close();
      }
    }
  });
}
origin: com.yahoo.omid/transaction-client

fsm.setInitState(new DisconnectedState(fsm));
ChannelPipeline pipeline = bootstrap.getPipeline();
pipeline.addLast("lengthbaseddecoder",
    new LengthFieldBasedFrameDecoder(8 * 1024, 0, 4, 0, 4));
origin: mconf/flazr

@Override
public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) {        
  final Channel inboundChannel = e.getChannel();
  RtmpProxy.ALL_CHANNELS.add(inboundChannel);
  inboundChannel.setReadable(false);        
  ClientBootstrap cb = new ClientBootstrap(cf);
  cb.getPipeline().addLast("handshaker", new ProxyHandshakeHandler());
  cb.getPipeline().addLast("handler", new OutboundHandler(e.getChannel()));
  ChannelFuture f = cb.connect(new InetSocketAddress(remoteHost, remotePort));
  outboundChannel = f.getChannel();
  f.addListener(new ChannelFutureListener() {
    @Override public void operationComplete(ChannelFuture future) throws Exception {
      if (future.isSuccess()) {
        logger.info("connected to remote host: {}, port: {}", remoteHost, remotePort);
        inboundChannel.setReadable(true);
      } else {                    
        inboundChannel.close();
      }
    }
  });
}
origin: net.sourceforge.openutils/flazr

@Override
public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) {        
  final Channel inboundChannel = e.getChannel();
  RtmpProxy.ALL_CHANNELS.add(inboundChannel);
  inboundChannel.setReadable(false);        
  ClientBootstrap cb = new ClientBootstrap(cf);
  cb.getPipeline().addLast("handshaker", new ProxyHandshakeHandler());
  cb.getPipeline().addLast("handler", new OutboundHandler(e.getChannel()));
  ChannelFuture f = cb.connect(new InetSocketAddress(remoteHost, remotePort));
  outboundChannel = f.getChannel();
  f.addListener(new ChannelFutureListener() {
    @Override public void operationComplete(ChannelFuture future) throws Exception {
      if (future.isSuccess()) {
        logger.info("connected to remote host: {}, port: {}", remoteHost, remotePort);
        inboundChannel.setReadable(true);
      } else {                    
        inboundChannel.close();
      }
    }
  });
}
origin: com.bbossgroups.rpc/bboss-rpc

  cb.getPipeline().addFirst("ssl", new SslHandler(eg));
cb.getPipeline().addLast("decoder", new ObjectDecoder(commons.getInt("maxFramgeLength_",NettyChannelPipelineFactory.maxFramgeLength_)));
cb.getPipeline().addLast("encoder", new ObjectEncoder(commons.getInt("estimatedLength_",NettyChannelPipelineFactory.estimatedLength_)));
cb.getPipeline().addLast("handler", corr);
origin: org.restcomm.smpp/ch-smpp

/**
 * Creates a new default SmppClient.
 * @param executor The executor that IO workers will be executed with. An
 *      Executors.newCachedDaemonThreadPool() is recommended. The max threads
 *      will never grow more than expectedSessions if NIO sockets are used.
 * @param expectedSessions The max number of concurrent sessions expected
 *      to be active at any time.  This number controls the max number of worker
 *      threads that the underlying Netty library will use.  If processing
 *      occurs in a sessionHandler (a blocking op), be <b>VERY</b> careful
 *      setting this to the correct number of concurrent sessions you expect.
 * @param monitorExecutor The scheduled executor that all sessions will share
 *      to monitor themselves and expire requests.  If null monitoring will
 *      be disabled.
 */
public DefaultSmppClient(ExecutorService executors, int expectedSessions, ScheduledExecutorService monitorExecutor) {
  this.channels = new DefaultChannelGroup();
  this.executors = executors;
  this.channelFactory = new NioClientSocketChannelFactory(this.executors, this.executors, expectedSessions);
  this.clientBootstrap = new ClientBootstrap(channelFactory);
  // we use the same default pipeline for all new channels - no need for a factory
  this.clientConnector = new SmppClientConnector(this.channels);
  this.clientBootstrap.getPipeline().addLast(SmppChannelConstants.PIPELINE_CLIENT_CONNECTOR_NAME, this.clientConnector);
  this.monitorExecutor = monitorExecutor;
// a shared instance of a timer for session writeTimeout timing
this.writeTimeoutTimer = new org.jboss.netty.util.HashedWheelTimer();
}

origin: twitter-archive/cloudhopper-smpp

/**
 * Creates a new default SmppClient.
 * @param executor The executor that IO workers will be executed with. An
 *      Executors.newCachedDaemonThreadPool() is recommended. The max threads
 *      will never grow more than expectedSessions if NIO sockets are used.
 * @param expectedSessions The max number of concurrent sessions expected
 *      to be active at any time.  This number controls the max number of worker
 *      threads that the underlying Netty library will use.  If processing
 *      occurs in a sessionHandler (a blocking op), be <b>VERY</b> careful
 *      setting this to the correct number of concurrent sessions you expect.
 * @param monitorExecutor The scheduled executor that all sessions will share
 *      to monitor themselves and expire requests.  If null monitoring will
 *      be disabled.
 */
public DefaultSmppClient(ExecutorService executors, int expectedSessions, ScheduledExecutorService monitorExecutor) {
  this.channels = new DefaultChannelGroup();
  this.executors = executors;
  this.channelFactory = new NioClientSocketChannelFactory(this.executors, this.executors, expectedSessions);
  this.clientBootstrap = new ClientBootstrap(channelFactory);
  // we use the same default pipeline for all new channels - no need for a factory
  this.clientConnector = new SmppClientConnector(this.channels);
  this.clientBootstrap.getPipeline().addLast(SmppChannelConstants.PIPELINE_CLIENT_CONNECTOR_NAME, this.clientConnector);
  this.monitorExecutor = monitorExecutor;
// a shared instance of a timer for session writeTimeout timing
this.writeTimeoutTimer = new org.jboss.netty.util.HashedWheelTimer();
}

origin: com.fizzed/ch-smpp

/**
 * Creates a new default SmppClient.
 * @param executor The executor that IO workers will be executed with. An
 *      Executors.newCachedDaemonThreadPool() is recommended. The max threads
 *      will never grow more than expectedSessions if NIO sockets are used.
 * @param expectedSessions The max number of concurrent sessions expected
 *      to be active at any time.  This number controls the max number of worker
 *      threads that the underlying Netty library will use.  If processing
 *      occurs in a sessionHandler (a blocking op), be <b>VERY</b> careful
 *      setting this to the correct number of concurrent sessions you expect.
 * @param monitorExecutor The scheduled executor that all sessions will share
 *      to monitor themselves and expire requests.  If null monitoring will
 *      be disabled.
 */
public DefaultSmppClient(ExecutorService executors, int expectedSessions, ScheduledExecutorService monitorExecutor) {
  this.channels = new DefaultChannelGroup();
  this.executors = executors;
  this.channelFactory = new NioClientSocketChannelFactory(this.executors, this.executors, expectedSessions);
  this.clientBootstrap = new ClientBootstrap(channelFactory);
  // we use the same default pipeline for all new channels - no need for a factory
  this.clientConnector = new SmppClientConnector(this.channels);
  this.clientBootstrap.getPipeline().addLast(SmppChannelConstants.PIPELINE_CLIENT_CONNECTOR_NAME, this.clientConnector);
  this.monitorExecutor = monitorExecutor;
// a shared instance of a timer for session writeTimeout timing
this.writeTimeoutTimer = new org.jboss.netty.util.HashedWheelTimer();
}

origin: com.cloudhopper/ch-smpp

/**
 * Creates a new default SmppClient.
 * @param executor The executor that IO workers will be executed with. An
 *      Executors.newCachedDaemonThreadPool() is recommended. The max threads
 *      will never grow more than expectedSessions if NIO sockets are used.
 * @param expectedSessions The max number of concurrent sessions expected
 *      to be active at any time.  This number controls the max number of worker
 *      threads that the underlying Netty library will use.  If processing
 *      occurs in a sessionHandler (a blocking op), be <b>VERY</b> careful
 *      setting this to the correct number of concurrent sessions you expect.
 * @param monitorExecutor The scheduled executor that all sessions will share
 *      to monitor themselves and expire requests.  If null monitoring will
 *      be disabled.
 */
public DefaultSmppClient(ExecutorService executors, int expectedSessions, ScheduledExecutorService monitorExecutor) {
  this.channels = new DefaultChannelGroup();
  this.executors = executors;
  this.channelFactory = new NioClientSocketChannelFactory(this.executors, this.executors, expectedSessions);
  this.clientBootstrap = new ClientBootstrap(channelFactory);
  // we use the same default pipeline for all new channels - no need for a factory
  this.clientConnector = new SmppClientConnector(this.channels);
  this.clientBootstrap.getPipeline().addLast(SmppChannelConstants.PIPELINE_CLIENT_CONNECTOR_NAME, this.clientConnector);
  this.monitorExecutor = monitorExecutor;
// a shared instance of a timer for session writeTimeout timing
this.writeTimeoutTimer = new org.jboss.netty.util.HashedWheelTimer();
}

origin: org.apache.omid/omid-transaction-client

fsm.setInitState(new DisconnectedState(fsm));
ChannelPipeline pipeline = bootstrap.getPipeline();
pipeline.addLast("lengthbaseddecoder", new LengthFieldBasedFrameDecoder(8 * 1024, 0, 4, 0, 4));
pipeline.addLast("lengthprepender", new LengthFieldPrepender(4));
origin: org.apache.omid/transaction-client

fsm.setInitState(new DisconnectedState(fsm));
ChannelPipeline pipeline = bootstrap.getPipeline();
pipeline.addLast("lengthbaseddecoder", new LengthFieldBasedFrameDecoder(8 * 1024, 0, 4, 0, 4));
pipeline.addLast("lengthprepender", new LengthFieldPrepender(4));
org.jboss.netty.bootstrapClientBootstrapgetPipeline

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
  • setOption
  • releaseExternalResources
  • getFactory
  • setOptions
  • getOption
  • getOptions
  • shutdown
  • getPipelineFactory
  • setPipeline
  • getPipelineFactory,
  • setPipeline,
  • setFactory

Popular in Java

  • Start an intent from android
  • compareTo (BigDecimal)
  • setScale (BigDecimal)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate(i
  • KeyStore (java.security)
    This class represents an in-memory collection of keys and certificates. It manages two types of entr
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • HashSet (java.util)
    This class implements the Set interface, backed by a hash table (actually a HashMap instance). It m
  • ConcurrentHashMap (java.util.concurrent)
    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updat
  • JTable (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now