Internal: clean up named writeable registry handling in netty transport classes
There are some leftovers around usage of NamedWriteableRegistry in our branch compared to master, just because the registry was added first here, then backported to master, and something didn't go completely right during the final merge.
This commit is contained in:
parent
24e53b5f8f
commit
6307738406
|
@ -25,8 +25,6 @@ import org.elasticsearch.common.component.Lifecycle;
|
|||
import org.elasticsearch.common.compress.Compressor;
|
||||
import org.elasticsearch.common.compress.CompressorFactory;
|
||||
import org.elasticsearch.common.compress.NotCompressedException;
|
||||
import org.elasticsearch.common.io.stream.FilterStreamInput;
|
||||
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
|
||||
import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
|
@ -52,19 +50,13 @@ public class MessageChannelHandler extends SimpleChannelUpstreamHandler {
|
|||
protected final TransportServiceAdapter transportServiceAdapter;
|
||||
protected final NettyTransport transport;
|
||||
protected final String profileName;
|
||||
private final NamedWriteableRegistry namedWriteableRegistry;
|
||||
|
||||
public MessageChannelHandler(NettyTransport transport, ESLogger logger, String profileName) {
|
||||
this(transport, logger, profileName, new NamedWriteableRegistry());
|
||||
}
|
||||
|
||||
public MessageChannelHandler(NettyTransport transport, ESLogger logger, String profileName, NamedWriteableRegistry namedWriteableRegistry) {
|
||||
this.threadPool = transport.threadPool();
|
||||
this.transportServiceAdapter = transport.transportServiceAdapter();
|
||||
this.transport = transport;
|
||||
this.logger = logger;
|
||||
this.profileName = profileName;
|
||||
this.namedWriteableRegistry = namedWriteableRegistry;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1070,7 +1070,7 @@ public class NettyTransport extends AbstractLifecycleComponent<Transport> implem
|
|||
}
|
||||
|
||||
public ChannelPipelineFactory configureServerChannelPipelineFactory(String name, Settings settings) {
|
||||
return new ServerChannelPipelineFactory(this, name, settings, namedWriteableRegistry);
|
||||
return new ServerChannelPipelineFactory(this, name, settings);
|
||||
}
|
||||
|
||||
protected static class ServerChannelPipelineFactory implements ChannelPipelineFactory {
|
||||
|
@ -1078,13 +1078,11 @@ public class NettyTransport extends AbstractLifecycleComponent<Transport> implem
|
|||
protected final NettyTransport nettyTransport;
|
||||
protected final String name;
|
||||
protected final Settings settings;
|
||||
protected final NamedWriteableRegistry namedWriteableRegistry;
|
||||
|
||||
public ServerChannelPipelineFactory(NettyTransport nettyTransport, String name, Settings settings, NamedWriteableRegistry namedWriteableRegistry) {
|
||||
public ServerChannelPipelineFactory(NettyTransport nettyTransport, String name, Settings settings) {
|
||||
this.nettyTransport = nettyTransport;
|
||||
this.name = name;
|
||||
this.settings = settings;
|
||||
this.namedWriteableRegistry = namedWriteableRegistry;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1103,7 +1101,7 @@ public class NettyTransport extends AbstractLifecycleComponent<Transport> implem
|
|||
sizeHeader.setMaxCumulationBufferComponents(nettyTransport.maxCompositeBufferComponents);
|
||||
}
|
||||
channelPipeline.addLast("size", sizeHeader);
|
||||
channelPipeline.addLast("dispatcher", new MessageChannelHandler(nettyTransport, nettyTransport.logger, name, namedWriteableRegistry));
|
||||
channelPipeline.addLast("dispatcher", new MessageChannelHandler(nettyTransport, nettyTransport.logger, name));
|
||||
return channelPipeline;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,6 @@ public abstract class AbstractSimpleTransportTests extends ESTestCase {
|
|||
|
||||
protected ThreadPool threadPool;
|
||||
|
||||
protected static final NamedWriteableRegistry namedWriteableRegistry = new NamedWriteableRegistry();
|
||||
protected static final Version version0 = Version.fromId(/*0*/99);
|
||||
protected DiscoveryNode nodeA;
|
||||
protected MockTransportService serviceA;
|
||||
|
|
|
@ -112,15 +112,15 @@ public class NettyTransportIT extends ESIntegTestCase {
|
|||
|
||||
@Override
|
||||
public ChannelPipelineFactory configureServerChannelPipelineFactory(String name, Settings groupSettings) {
|
||||
return new ErrorPipelineFactory(this, name, groupSettings, namedWriteableRegistry);
|
||||
return new ErrorPipelineFactory(this, name, groupSettings);
|
||||
}
|
||||
|
||||
private static class ErrorPipelineFactory extends ServerChannelPipelineFactory {
|
||||
|
||||
private final ESLogger logger;
|
||||
|
||||
public ErrorPipelineFactory(ExceptionThrowingNettyTransport exceptionThrowingNettyTransport, String name, Settings groupSettings, NamedWriteableRegistry namedWriteableRegistry) {
|
||||
super(exceptionThrowingNettyTransport, name, groupSettings, namedWriteableRegistry);
|
||||
public ErrorPipelineFactory(ExceptionThrowingNettyTransport exceptionThrowingNettyTransport, String name, Settings groupSettings) {
|
||||
super(exceptionThrowingNettyTransport, name, groupSettings);
|
||||
this.logger = exceptionThrowingNettyTransport.logger;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue