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

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

Best Java code snippets using org.jboss.netty.bootstrap.ClientBootstrap.getOption (Showing top 13 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: io.netty/netty

/**
 * Attempts a new connection with the current {@code "remoteAddress"} and
 * {@code "localAddress"} option.  If the {@code "localAddress"} option is
 * not set, the local address of a new channel is determined automatically.
 * This method is similar to the following code:
 *
 * <pre>
 * {@link ClientBootstrap} b = ...;
 * b.connect(b.getOption("remoteAddress"), b.getOption("localAddress"));
 * </pre>
 *
 * @return a future object which notifies when this connection attempt
 *         succeeds or fails
 *
 * @throws IllegalStateException
 *         if {@code "remoteAddress"} option was not set
 * @throws ClassCastException
 *         if {@code "remoteAddress"} or {@code "localAddress"} option's
 *            value is neither a {@link SocketAddress} nor {@code null}
 * @throws ChannelPipelineException
 *         if this bootstrap's {@link #setPipelineFactory(ChannelPipelineFactory) pipelineFactory}
 *            failed to create a new {@link ChannelPipeline}
 */
public ChannelFuture connect() {
  SocketAddress remoteAddress = (SocketAddress) getOption("remoteAddress");
  if (remoteAddress == null) {
    throw new IllegalStateException("remoteAddress option is not set.");
  }
  return connect(remoteAddress);
}
origin: wg/lettuce

  /**
   * Reconnect to the remote address that the closed channel was connected to.
   * This creates a new {@link ChannelPipeline} with the same handler instances
   * contained in the old channel's pipeline.
   *
   * @param timeout Timer task handle.
   *
   * @throws Exception when reconnection fails.
   */
  @Override
  public void run(Timeout timeout) throws Exception {
    ChannelPipeline old = channel.getPipeline();
    CommandHandler<?, ?> handler = old.get(CommandHandler.class);
    RedisAsyncConnection<?, ?> connection = old.get(RedisAsyncConnection.class);
    ChannelPipeline pipeline = Channels.pipeline(this, handler, connection);

    Channel c = bootstrap.getFactory().newChannel(pipeline);
    c.getConfig().setOptions(bootstrap.getOptions());
    c.connect((SocketAddress) bootstrap.getOption("remoteAddress"));
  }
}
origin: io.netty/netty

/**
 * Attempts a new connection with the specified {@code remoteAddress} and
 * the current {@code "localAddress"} option. If the {@code "localAddress"}
 * option is not set, the local address of a new channel is determined
 * automatically.  This method is identical with the following code:
 *
 * <pre>
 * {@link ClientBootstrap} b = ...;
 * b.connect(remoteAddress, b.getOption("localAddress"));
 * </pre>
 *
 * @return a future object which notifies when this connection attempt
 *         succeeds or fails
 *
 * @throws ClassCastException
 *         if {@code "localAddress"} option's value is
 *            neither a {@link SocketAddress} nor {@code null}
 * @throws ChannelPipelineException
 *         if this bootstrap's {@link #setPipelineFactory(ChannelPipelineFactory) pipelineFactory}
 *            failed to create a new {@link ChannelPipeline}
 */
public ChannelFuture connect(SocketAddress remoteAddress) {
  if (remoteAddress == null) {
    throw new NullPointerException("remoteAddress");
  }
  SocketAddress localAddress = (SocketAddress) getOption("localAddress");
  return connect(remoteAddress, localAddress);
}
origin: com.lambdaworks/lettuce

  /**
   * Reconnect to the remote address that the closed channel was connected to.
   * This creates a new {@link ChannelPipeline} with the same handler instances
   * contained in the old channel's pipeline.
   *
   * @param timeout Timer task handle.
   *
   * @throws Exception when reconnection fails.
   */
  @Override
  public void run(Timeout timeout) throws Exception {
    ChannelPipeline old = channel.getPipeline();
    CommandHandler<?, ?> handler = old.get(CommandHandler.class);
    RedisAsyncConnection<?, ?> connection = old.get(RedisAsyncConnection.class);
    ChannelPipeline pipeline = Channels.pipeline(this, handler, connection);

    Channel c = bootstrap.getFactory().newChannel(pipeline);
    c.getConfig().setOptions(bootstrap.getOptions());
    c.connect((SocketAddress) bootstrap.getOption("remoteAddress"));
  }
}
origin: kakaochatfriend/KakaoChatFriendAPI

private InetSocketAddress getRemoteAddress() {
 return (InetSocketAddress) bootstrap.getOption("remoteAddress");
}
origin: kakaochatfriend/KakaoChatFriendAPI

private InetSocketAddress getRemoteAddress() {
 return (InetSocketAddress) bootstrap.getOption("remoteAddress");
}
origin: kakaochatfriend/KakaoChatFriendAPI

InetSocketAddress getRemoteAddress() {
 return (InetSocketAddress) bootstrap.getOption("remoteAddress");
}
origin: nyankosama/simple-netty-source

/**
 * Attempts a new connection with the specified {@code remoteAddress} and
 * the current {@code "localAddress"} option. If the {@code "localAddress"}
 * option is not set, the local address of a new channel is determined
 * automatically.  This method is identical with the following code:
 *
 * <pre>
 * {@link ClientBootstrap} b = ...;
 * b.connect(remoteAddress, b.getOption("localAddress"));
 * </pre>
 *
 * @return a future object which notifies when this connection attempt
 *         succeeds or fails
 *
 * @throws ClassCastException
 *         if {@code "localAddress"} option's value is
 *            neither a {@link SocketAddress} nor {@code null}
 * @throws ChannelPipelineException
 *         if this bootstrap's {@link #setPipelineFactory(ChannelPipelineFactory) pipelineFactory}
 *            failed to create a new {@link ChannelPipeline}
 */
public ChannelFuture connect(SocketAddress remoteAddress) {
  if (remoteAddress == null) {
    throw new NullPointerException("remoteAddress");
  }
  SocketAddress localAddress = (SocketAddress) getOption("localAddress");
  return connect(remoteAddress, localAddress);
}
origin: nyankosama/simple-netty-source

/**
 * Attempts a new connection with the current {@code "remoteAddress"} and
 * {@code "localAddress"} option.  If the {@code "localAddress"} option is
 * not set, the local address of a new channel is determined automatically.
 * This method is similar to the following code:
 *
 * <pre>
 * {@link ClientBootstrap} b = ...;
 * b.connect(b.getOption("remoteAddress"), b.getOption("localAddress"));
 * </pre>
 *
 * @return a future object which notifies when this connection attempt
 *         succeeds or fails
 *
 * @throws IllegalStateException
 *         if {@code "remoteAddress"} option was not set
 * @throws ClassCastException
 *         if {@code "remoteAddress"} or {@code "localAddress"} option's
 *            value is neither a {@link SocketAddress} nor {@code null}
 * @throws ChannelPipelineException
 *         if this bootstrap's {@link #setPipelineFactory(ChannelPipelineFactory) pipelineFactory}
 *            failed to create a new {@link ChannelPipeline}
 */
public ChannelFuture connect() {
  SocketAddress remoteAddress = (SocketAddress) getOption("remoteAddress");
  if (remoteAddress == null) {
    throw new IllegalStateException("remoteAddress option is not set.");
  }
  return connect(remoteAddress);
}
origin: os-libera/OpenVirteX

  @Override
  public void run(final Timeout timeout) throws Exception {
    final InetSocketAddress remoteAddr = (InetSocketAddress) ReconnectHandler.this.bootstrap
        .getOption("remoteAddress");
    final ChannelFuture cf = ReconnectHandler.this.bootstrap.connect();
    cf.addListener(new ChannelFutureListener() {
      @Override
      public void operationComplete(final ChannelFuture e)
          throws Exception {
        if (e.isSuccess()) {
          ReconnectTimeoutTask.this.sw.setChannel(e.getChannel());
          ReconnectTimeoutTask.this.cg.add(e.getChannel());
        } else {
          ReconnectHandler.this.log
              .error("Failed to connect to controller {} for switch {}",
                  remoteAddr,
                  ReconnectTimeoutTask.this.sw
                      .getSwitchName());
        }
      }
    });
  }
}
origin: os-libera/OpenVirteX

@Override
public void channelClosed(final ChannelHandlerContext ctx,
    final ChannelStateEvent e) {
  if (!this.sw.isActive()) {
    return;
  }
  this.sw.removeChannel(e.getChannel());
  final int retry = this.sw.incrementBackOff();
  final Integer backOffTime = Math.min(1 << retry, this.maxBackOff);
  this.timeout = this.timer.newTimeout(new ReconnectTimeoutTask(this.sw,
      this.cg), backOffTime, TimeUnit.SECONDS);
  this.log.error("Backing off {} for controller {}", backOffTime,
      this.bootstrap.getOption("remoteAddress"));
  ctx.sendUpstream(e);
}
origin: wg/lettuce

private <K, V, T extends RedisAsyncConnection<K, V>> T connect(CommandHandler<K, V> handler, T connection) {
  try {
    ConnectionWatchdog watchdog = new ConnectionWatchdog(bootstrap, channels, timer);
    ChannelPipeline pipeline = Channels.pipeline(watchdog, handler, connection);
    Channel channel = bootstrap.getFactory().newChannel(pipeline);
    ChannelFuture future = channel.connect((SocketAddress) bootstrap.getOption("remoteAddress"));
    future.await();
    if (!future.isSuccess()) {
      throw future.getCause();
    }
    watchdog.setReconnect(true);
    return connection;
  } catch (Throwable e) {
    throw new RedisException("Unable to connect", e);
  }
}
origin: com.lambdaworks/lettuce

private <K, V, T extends RedisAsyncConnection<K, V>> T connect(CommandHandler<K, V> handler, T connection) {
  try {
    ConnectionWatchdog watchdog = new ConnectionWatchdog(bootstrap, channels, timer);
    ChannelPipeline pipeline = Channels.pipeline(watchdog, handler, connection);
    Channel channel = bootstrap.getFactory().newChannel(pipeline);
    ChannelFuture future = channel.connect((SocketAddress) bootstrap.getOption("remoteAddress"));
    future.await();
    if (!future.isSuccess()) {
      throw future.getCause();
    }
    watchdog.setReconnect(true);
    return connection;
  } catch (Throwable e) {
    throw new RedisException("Unable to connect", e);
  }
}
org.jboss.netty.bootstrapClientBootstrapgetOption

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

Popular in Java

  • Parsing JSON documents to java classes using gson
  • startActivity (Activity)
  • setScale (BigDecimal)
  • requestLocationUpdates (LocationManager)
  • 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