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);
}
Aggregations