congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ClientBootstrap.getOption
Code IndexAdd Tabnine 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)

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

  • Running tasks concurrently on multiple threads
  • getContentResolver (Context)
  • addToBackStack (FragmentTransaction)
  • getSharedPreferences (Context)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • Path (java.nio.file)
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top plugins for WebStorm
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