netty/netty — pull request #873 by normanmaurer (2012-12-30 18:34:27+00:00)
Title: Split ChannelFuture into ChannelFuture and ChannelPromise

Here are the changes that I proposed in #868.

ChannelFuture is now "readonly", and a new interface is introduced called ChannelPromise which extends ChannelFuture. This interface has all the set/try methods to complete the ChannelFuture.

Beside splitting two things were changed:
* Added for every set method a try method, and change the behavior of the set method
```java
/**
* Special {@link ChannelFuture} which is writable.
*/
public interface ChannelPromise extends ChannelFuture {

/**
* Marks this future as a success and notifies all
* listeners.
*
* If it is success or failed already it will throw an {@link IllegalStateException}.
*/
void setSuccess();

/**
* Marks this future as a success and notifies all
* listeners.
*
* @return {@code true} if and only if successfully marked this future as
* a success. Otherwise {@code false} because this future is
* already marked as either a success or a failure.
*/
boolean trySuccess();
....
....
```

* ChannelFuture/ChannelPromise no longer extends Future as I wanted to get rid of the cancel and isCanceled() method. This is mainly because cancel a ChannelFuture/ChannelPromise is hard and most of the times even not possible. So I think it just makes no sense. If someone wants to use Future, it is easy to write an wrapper. An other way would be to make ChannelFuture an abstract base class and override cancel(..) and isCanceled() methods to always just return false. But I think there is not gain.