Search in sources :

Example 1 with ChannelPipelineException

use of org.jboss.netty.channel.ChannelPipelineException in project pinpoint by naver.

the class DefaultPinpointClientFactory method reconnect.

public ChannelFuture reconnect(final SocketAddress remoteAddress) {
    if (remoteAddress == null) {
        throw new NullPointerException("remoteAddress");
    }
    ChannelPipeline pipeline;
    final ClientBootstrap bootstrap = this.bootstrap;
    try {
        pipeline = bootstrap.getPipelineFactory().getPipeline();
    } catch (Exception e) {
        throw new ChannelPipelineException("Failed to initialize a pipeline.", e);
    }
    PinpointClientHandler pinpointClientHandler = (DefaultPinpointClientHandler) pipeline.getLast();
    pinpointClientHandler.initReconnect();
    // Set the options.
    Channel ch = bootstrap.getFactory().newChannel(pipeline);
    boolean success = false;
    try {
        ch.getConfig().setOptions(bootstrap.getOptions());
        success = true;
    } finally {
        if (!success) {
            ch.close();
        }
    }
    // Connect.
    return ch.connect(remoteAddress);
}
Also used : ChannelPipelineException(org.jboss.netty.channel.ChannelPipelineException) ClientBootstrap(org.jboss.netty.bootstrap.ClientBootstrap) Channel(org.jboss.netty.channel.Channel) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline) PinpointSocketException(com.navercorp.pinpoint.rpc.PinpointSocketException) ChannelPipelineException(org.jboss.netty.channel.ChannelPipelineException)

Aggregations

PinpointSocketException (com.navercorp.pinpoint.rpc.PinpointSocketException)1 ClientBootstrap (org.jboss.netty.bootstrap.ClientBootstrap)1 Channel (org.jboss.netty.channel.Channel)1 ChannelPipeline (org.jboss.netty.channel.ChannelPipeline)1 ChannelPipelineException (org.jboss.netty.channel.ChannelPipelineException)1