Skip to main content

[websocket-spec issues] [JIRA] Updated: (WEBSOCKET_SPEC-110) Rename SendHandler#setResult

  • From: "dannycoward (JIRA)" < >
  • To:
  • Subject: [websocket-spec issues] [JIRA] Updated: (WEBSOCKET_SPEC-110) Rename SendHandler#setResult
  • Date: Sat, 2 Feb 2013 03:08:53 +0000 (GMT+00:00)
  • Auto-submitted: auto-generated


     [ 
http://java.net/jira/browse/WEBSOCKET_SPEC-110?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

dannycoward updated WEBSOCKET_SPEC-110:
---------------------------------------

    Due Date: 08/Feb/13

This one's obliquely related to 
(http://java.net/jira/browse/WEBSOCKET_SPEC-110), but also this has come up 
elsewhere.

Currently we are using 3 classes for async sends:-

Future<SendResult>
    SendResult get()
    SendResult get(timeout, unit)
    cancel()
    isDone()
    isCancelled()

SendHander
    setResult(SendResult sr)

SendResult
    getException()
    isOK()

RemoteEndpoint
    Future<SendResult> sendXXXByFuture(message)
    void sendXXXByCompletion(message, SendHandler)

For the information transmitted during the async operation ("did it get sent 
or not ?"), this is perhaps a little heavyweight. It also creates an 
ambiguity when using the Future<SendHandler> if the operation fails: does the 
exception get wrapped as the cause of the ExecutionException thrown on 
Future.get(), or is it set on the SendResult ?

So here's a simpler alternative, which coveys the same information, but with 
less API and no ambiguity:-

Future
    void get()
    void get(timeout, unit)
    cancel()
    isDone()
    isCancelled()

SendHandler
    void handleSendError(Throwable t)
    void handleSendCompleted();

RemoteEndpoint
    Future sendXXXByFuture(message)
    void sendXXXByCompletion(message, SendHandler)

A send failure using the Future method results in the Throwable being wrapped 
as the cause of the ExecutionException thrown out of the Future.get() method, 
which is, after all, the proper use for that.

> Rename SendHandler#setResult
> ----------------------------
>
>                 Key: WEBSOCKET_SPEC-110
>                 URL: http://java.net/jira/browse/WEBSOCKET_SPEC-110
>             Project: websocket-spec
>          Issue Type: Improvement
>            Reporter: jitu
>            Priority: Minor
>
> rename setResult() to handleSendResult(). handleXXX() would be more 
> appropriate as SendHandler is callback handler.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://java.net/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


[websocket-spec issues] [JIRA] Updated: (WEBSOCKET_SPEC-110) Rename SendHandler#setResult

dannycoward (JIRA) 02/02/2013

<Possible follow-up(s)>

[websocket-spec issues] [JIRA] Updated: (WEBSOCKET_SPEC-110) Rename SendHandler#setResult

dannycoward (JIRA) 02/02/2013
 
 
Close
loading
Please Confirm
Close