Let ChannelPipeline.set* methods return itself to be more consistent with the reset

This commit is contained in:
Norman Maurer 2013-02-08 07:24:55 +01:00
parent 32e0b59761
commit 539418ecac
6 changed files with 17 additions and 15 deletions

View File

@ -1,4 +1,4 @@
/*
io.netty.channel.DefaultChannelPromise.setFailure/*
* Copyright 2012 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
@ -1052,12 +1052,12 @@ public class SslHandler
}
@Override
public void setSuccess() {
public ChannelPromise setSuccess() {
throw new IllegalStateException();
}
@Override
public void setFailure(Throwable cause) {
public ChannelPromise setFailure(Throwable cause) {
throw new IllegalStateException();
}
}

View File

@ -1034,12 +1034,12 @@ public abstract class AbstractChannel extends DefaultAttributeMap implements Cha
}
@Override
public void setSuccess() {
public ChannelPromise setSuccess() {
throw new IllegalStateException();
}
@Override
public void setFailure(Throwable cause) {
public ChannelPromise setFailure(Throwable cause) {
throw new IllegalStateException();
}

View File

@ -26,7 +26,7 @@ public interface ChannelPromise extends ChannelFuture {
*
* If it is success or failed already it will throw an {@link IllegalStateException}.
*/
void setSuccess();
ChannelPromise setSuccess();
/**
* Marks this future as a success and notifies all
@ -44,7 +44,7 @@ public interface ChannelPromise extends ChannelFuture {
*
* If it is success or failed already it will throw an {@link IllegalStateException}.
*/
void setFailure(Throwable cause);
ChannelPromise setFailure(Throwable cause);
/**
* Marks this future as a failure and notifies all

View File

@ -23,7 +23,7 @@ abstract class CompleteChannelPromise extends CompleteChannelFuture implements C
}
@Override
public void setFailure(Throwable cause) {
public ChannelPromise setFailure(Throwable cause) {
throw new IllegalStateException();
}
@ -33,7 +33,7 @@ abstract class CompleteChannelPromise extends CompleteChannelFuture implements C
}
@Override
public void setSuccess() {
public ChannelPromise setSuccess() {
throw new IllegalStateException();
}

View File

@ -327,10 +327,10 @@ public class DefaultChannelPromise extends FlushCheckpoint implements ChannelPro
}
@Override
public void setSuccess() {
public ChannelPromise setSuccess() {
if (success0()) {
notifyListeners();
return;
return this;
}
throw new IllegalStateException();
}
@ -358,10 +358,10 @@ public class DefaultChannelPromise extends FlushCheckpoint implements ChannelPro
}
@Override
public void setFailure(Throwable cause) {
public ChannelPromise setFailure(Throwable cause) {
if (failure0(cause)) {
notifyListeners();
return;
return this;
}
throw new IllegalStateException();
}

View File

@ -127,11 +127,13 @@ final class VoidChannelPromise implements ChannelFuture.Unsafe, ChannelPromise {
return this;
}
@Override
public void setFailure(Throwable cause) {
public ChannelPromise setFailure(Throwable cause) {
return this;
}
@Override
public void setSuccess() {
public ChannelPromise setSuccess() {
return this;
}
@Override