Fixed NETTY-10 (Bootstrap.getPipeline() shold throw an IllegalStateException if pipelineFactory property is in use.) and NETTY-12 (Bootstrap.setPipeline() doesn't update the pipeline property at all.)

This commit is contained in:
Trustin Lee 2008-08-18 03:07:05 +00:00
parent bd51f12fb7
commit a2eed846b4

View File

@ -123,11 +123,17 @@ public class Bootstrap {
* {@link Channel} is created. Bootstrap creates a new pipeline which has * {@link Channel} is created. Bootstrap creates a new pipeline which has
* the same entries with the returned pipeline for a new {@link Channel}. * the same entries with the returned pipeline for a new {@link Channel}.
* *
* @return the default {@link ChannelPipeline}. {@code null} if * @return the default {@link ChannelPipeline}
* {@link #setPipelineFactory(ChannelPipelineFactory)} was *
* called last time. * @throws IllegalStateException
* if {@link #setPipelineFactory(ChannelPipelineFactory)} was
* called by a user last time.
*/ */
public ChannelPipeline getPipeline() { public ChannelPipeline getPipeline() {
ChannelPipeline pipeline = this.pipeline;
if (pipeline == null) {
throw new IllegalStateException("pipelineFactory in use");
}
return pipeline; return pipeline;
} }
@ -143,7 +149,7 @@ public class Bootstrap {
if (pipeline == null) { if (pipeline == null) {
throw new NullPointerException("pipeline"); throw new NullPointerException("pipeline");
} }
pipeline = this.pipeline; this.pipeline = pipeline;
pipelineFactory = pipelineFactory(pipeline); pipelineFactory = pipelineFactory(pipeline);
} }