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
* the same entries with the returned pipeline for a new {@link Channel}.
*
* @return the default {@link ChannelPipeline}. {@code null} if
* {@link #setPipelineFactory(ChannelPipelineFactory)} was
* called last time.
* @return the default {@link ChannelPipeline}
*
* @throws IllegalStateException
* if {@link #setPipelineFactory(ChannelPipelineFactory)} was
* called by a user last time.
*/
public ChannelPipeline getPipeline() {
ChannelPipeline pipeline = this.pipeline;
if (pipeline == null) {
throw new IllegalStateException("pipelineFactory in use");
}
return pipeline;
}
@ -143,7 +149,7 @@ public class Bootstrap {
if (pipeline == null) {
throw new NullPointerException("pipeline");
}
pipeline = this.pipeline;
this.pipeline = pipeline;
pipelineFactory = pipelineFactory(pipeline);
}