Hi Joakim,
Thanks for the feedback. Yes its true that there is overlap, in
particular both Future.get() and the SendResult theoretically have a way
to deliver an error that occurs on send. We certainly need to be clear
where the error is delivered.
We certainly would like SendHandler to be implementable as a lambda, and
I believe the history is that we thought that SendResult might end up
having richer semantics (either in this version, or some future version)
than just whether the message was sent or there was an error.
- Danny
On 12/14/12 8:59 AM, Joakim Erdfelt wrote:
> (Note: I suspect there's a reason for this, as I see statements around
> making decisions for future proofing and new Java 8 semantics)
>
> The SendResult object seems to overlap with the role of Future itself.
>
> If I do ...
>
> Future<SendResult> fut = session.getRemote().sendBytesByFuture(buf);
> SendResult res = fut.get();
>
> I would expect the future to return on success, and throw an exception
> on failure.
> Why would I want to query the SendResult.isOK() ever?
>
> Barring any sort of identification being returned, the method
> signature could be ...
>
> Future<Void> RemoteEndpoint.sendBytesByFuture(buf);
>
> ... is just as valid.
>
> Also, why is SendHandler the way it is?
> I would expect it to be something like this ...
>
> public interface SendHandler {
> void onResultSuccess();
> void onResultFailure(Throwable t);
> }
>
> Is the one method approach found in the 008 spec document something to
> do with the Java 8 lambda friendly decision making?
>
> --
> Joakim Erdfelt <joakim_at_intalio.com <mailto:joakim_at_intalio.com>>
> webtide.com <http://www.webtide.com/>
> Developer advice, services and support
> from the Jetty & CometD experts
> eclipse.org/jetty <http://eclipse.org/jetty/> - cometd.org
> <http://cometd.org/>
>
--
<http://www.oracle.com> *Danny Coward *
Java EE
Oracle Corporation