Skip to content

ChannelOutboundInvoker should support method-chaining #820

Closed

Description

@normanmaurer

In ChannelOutboundInvoker we have for each operations two versions. One which just return a new ChannelFuture and the other which takes a ChannelFuture and returns one.

I think we can improve this out of two reasons:

  1. Return a ChannelFuture when you actual pass in a ChannelFuture which should be notified once the operation is complete is kind of confusing and also redundant. I see no real benefit of doing so, at worst it confuse the user.
  2. If we would just return the ChannelOutboundInvoker by itself we could support method-chaing to make it more user friendly.

So I propose to change the signature for all methods like mention above.

Example:

public interface ChannelOutboundInvoker {
    ChannelFuture bind(SocketAddress localAddress);
   ....

    ChannelOutboundInvoker bind(SocketAddress localAddress, ChannelFuture future);

I think this also make the contract more explicit.

@trustin WDYT ?

Activity

  1. trustin commented on Dec 15, 2012

    @trustin
    Member

    Does it really worth? I haven't seen a case where a user would do method
    chaining such as doing I/O consecutively. Rather I find returning a
    ChannelFuture more useful because I might want to add listeners after
    invoking outbound operation.
    On Dec 15, 2012 12:57 AM, "Norman Maurer" [email protected] wrote:

    In ChannelOutboundInvoker we have for each operations two versions. One
    which just return a new ChannelFuture and the other which takes a
    ChannelFuture and returns one.

    I think we can improve this out of two reasons:

    1. Return a ChannelFuture when you actual pass in a ChannelFuture which
      should be notified once the operation is complete is kind of confusing and
      also redundant. I see no real benefit of doing so, at worst it confuse the
      user.
    2. If we would just return the ChannelOutboundInvoker by itself we could
      support method-chaing to make it more user friendly.

    So I propose to change the signature for all methods like mention above.

    Example:

    public interface ChannelOutboundInvoker {
    ChannelFuture bind(SocketAddress localAddress);
    ....

    ChannelOutboundInvoker bind(SocketAddress localAddress, ChannelFuture future);
    

    I think this also make the contract more explicit.

    @trustin https://github.com/trustin WDYT ?

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/820.

  2. normanmaurer commented on Dec 15, 2012

    @normanmaurer
    MemberAuthor

    Hm... You may be right. I think we should make it clear that the same ChannelFuture will be returned as passed in.

    Sent from my iPhone. Excuse any typos....

    Am 15.12.2012 um 03:10 schrieb Trustin Lee [email protected]:

    Does it really worth? I haven't seen a case where a user would do method
    chaining such as doing I/O consecutively. Rather I find returning a
    ChannelFuture more useful because I might want to add listeners after
    invoking outbound operation.
    On Dec 15, 2012 12:57 AM, "Norman Maurer" [email protected] wrote:

    In ChannelOutboundInvoker we have for each operations two versions. One
    which just return a new ChannelFuture and the other which takes a
    ChannelFuture and returns one.

    I think we can improve this out of two reasons:

    1. Return a ChannelFuture when you actual pass in a ChannelFuture which
      should be notified once the operation is complete is kind of confusing and
      also redundant. I see no real benefit of doing so, at worst it confuse the
      user.
    2. If we would just return the ChannelOutboundInvoker by itself we could
      support method-chaing to make it more user friendly.

    So I propose to change the signature for all methods like mention above.

    Example:

    public interface ChannelOutboundInvoker {
    ChannelFuture bind(SocketAddress localAddress);
    ....

    ChannelOutboundInvoker bind(SocketAddress localAddress, ChannelFuture future);

    I think this also make the contract more explicit.

    @trustin https://github.com/trustin WDYT ?

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/820.

    —
    Reply to this email directly or view it on GitHub.

  3. normanmaurer commented on Dec 17, 2012

    @normanmaurer
    MemberAuthor

    @trustin is right... let us close it as won't fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions