You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Dmitry Demeshchuk (JIRA)" <ji...@apache.org> on 2010/07/22 10:16:50 UTC

[jira] Created: (THRIFT-825) Erlang API improvement: allow to use atoms and tuples to point at the thrift client

Erlang API improvement: allow to use atoms and tuples to point at the thrift client
-----------------------------------------------------------------------------------

                 Key: THRIFT-825
                 URL: https://issues.apache.org/jira/browse/THRIFT-825
             Project: Thrift
          Issue Type: Improvement
          Components: Compiler (Erlang)
         Environment: Any environment
            Reporter: Dmitry Demeshchuk
         Attachments: thrift_client.erl.diff

Here's the code from thrift_client.erl:

call(Client, Function, Args)
 when is_pid(Client), is_atom(Function), is_list(Args) ->
   case gen_server:call(Client, {call, Function, Args}) of
       R = {ok, _} -> R;
       R = {error, _} -> R;
       {exception, Exception} -> throw(Exception)
   end.

But one may want to use the Client variable as an atom (using erlang:register()) or as a tuple {Node, Pid}.

So, it's better to remove the is_pid() check. If the Client variable is invalid - OTP will just raise the "noproc" exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Commented: (THRIFT-825) Erlang API improvement: allow to use atoms and tuples to point at the thrift client

Posted by Anthony Molinaro <an...@alumni.caltech.edu>.
Okay, will do, just wasn't sure if there were permissions needed to
resolve/close issues.

-Anthony

On Fri, Aug 20, 2010 at 11:09:34AM -0700, Bryan Duxbury wrote:
> If you think this is done, then just close the issue.
> 
> On Fri, Aug 20, 2010 at 10:16 AM, Anthony Molinaro (JIRA)
> <ji...@apache.org>wrote:
> 
> >
> >    [
> > https://issues.apache.org/jira/browse/THRIFT-825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12900778#action_12900778]
> >
> > Anthony Molinaro commented on THRIFT-825:
> > -----------------------------------------
> >
> > I'm pretty sure the refactoring
> > https://issues.apache.org/jira/browse/THRIFT-599 means this ticket can be
> > closed.   thrift_client is no longer a gen_server that is left up to the
> > application developer.  So there is no process to register and Client is now
> > a record.
> >
> > > Erlang API improvement: allow to use atoms and tuples to point at the
> > thrift client
> > >
> > -----------------------------------------------------------------------------------
> > >
> > >                 Key: THRIFT-825
> > >                 URL: https://issues.apache.org/jira/browse/THRIFT-825
> > >             Project: Thrift
> > >          Issue Type: Improvement
> > >          Components: Erlang - Compiler
> > >         Environment: Any environment
> > >            Reporter: Dmitry Demeshchuk
> > >         Attachments: thrift_client.erl.diff
> > >
> > >
> > > Here's the code from thrift_client.erl:
> > > call(Client, Function, Args)
> > >  when is_pid(Client), is_atom(Function), is_list(Args) ->
> > >    case gen_server:call(Client, {call, Function, Args}) of
> > >        R = {ok, _} -> R;
> > >        R = {error, _} -> R;
> > >        {exception, Exception} -> throw(Exception)
> > >    end.
> > > But one may want to use the Client variable as an atom (using
> > erlang:register()) or as a tuple {Node, Pid}.
> > > So, it's better to remove the is_pid() check. If the Client variable is
> > invalid - OTP will just raise the "noproc" exception.
> >
> > --
> > This message is automatically generated by JIRA.
> > -
> > You can reply to this email to add a comment to the issue online.
> >
> >

-- 
------------------------------------------------------------------------
Anthony Molinaro                           <an...@alumni.caltech.edu>

Re: [jira] Commented: (THRIFT-825) Erlang API improvement: allow to use atoms and tuples to point at the thrift client

Posted by Bryan Duxbury <br...@rapleaf.com>.
If you think this is done, then just close the issue.

On Fri, Aug 20, 2010 at 10:16 AM, Anthony Molinaro (JIRA)
<ji...@apache.org>wrote:

>
>    [
> https://issues.apache.org/jira/browse/THRIFT-825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12900778#action_12900778]
>
> Anthony Molinaro commented on THRIFT-825:
> -----------------------------------------
>
> I'm pretty sure the refactoring
> https://issues.apache.org/jira/browse/THRIFT-599 means this ticket can be
> closed.   thrift_client is no longer a gen_server that is left up to the
> application developer.  So there is no process to register and Client is now
> a record.
>
> > Erlang API improvement: allow to use atoms and tuples to point at the
> thrift client
> >
> -----------------------------------------------------------------------------------
> >
> >                 Key: THRIFT-825
> >                 URL: https://issues.apache.org/jira/browse/THRIFT-825
> >             Project: Thrift
> >          Issue Type: Improvement
> >          Components: Erlang - Compiler
> >         Environment: Any environment
> >            Reporter: Dmitry Demeshchuk
> >         Attachments: thrift_client.erl.diff
> >
> >
> > Here's the code from thrift_client.erl:
> > call(Client, Function, Args)
> >  when is_pid(Client), is_atom(Function), is_list(Args) ->
> >    case gen_server:call(Client, {call, Function, Args}) of
> >        R = {ok, _} -> R;
> >        R = {error, _} -> R;
> >        {exception, Exception} -> throw(Exception)
> >    end.
> > But one may want to use the Client variable as an atom (using
> erlang:register()) or as a tuple {Node, Pid}.
> > So, it's better to remove the is_pid() check. If the Client variable is
> invalid - OTP will just raise the "noproc" exception.
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>

[jira] Closed: (THRIFT-825) Erlang API improvement: allow to use atoms and tuples to point at the thrift client

Posted by "Anthony Molinaro (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-825?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anthony Molinaro closed THRIFT-825.
-----------------------------------


> Erlang API improvement: allow to use atoms and tuples to point at the thrift client
> -----------------------------------------------------------------------------------
>
>                 Key: THRIFT-825
>                 URL: https://issues.apache.org/jira/browse/THRIFT-825
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Erlang - Compiler
>         Environment: Any environment
>            Reporter: Dmitry Demeshchuk
>         Attachments: thrift_client.erl.diff
>
>
> Here's the code from thrift_client.erl:
> call(Client, Function, Args)
>  when is_pid(Client), is_atom(Function), is_list(Args) ->
>    case gen_server:call(Client, {call, Function, Args}) of
>        R = {ok, _} -> R;
>        R = {error, _} -> R;
>        {exception, Exception} -> throw(Exception)
>    end.
> But one may want to use the Client variable as an atom (using erlang:register()) or as a tuple {Node, Pid}.
> So, it's better to remove the is_pid() check. If the Client variable is invalid - OTP will just raise the "noproc" exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (THRIFT-825) Erlang API improvement: allow to use atoms and tuples to point at the thrift client

Posted by "Anthony Molinaro (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12900778#action_12900778 ] 

Anthony Molinaro commented on THRIFT-825:
-----------------------------------------

I'm pretty sure the refactoring https://issues.apache.org/jira/browse/THRIFT-599 means this ticket can be closed.   thrift_client is no longer a gen_server that is left up to the application developer.  So there is no process to register and Client is now a record.

> Erlang API improvement: allow to use atoms and tuples to point at the thrift client
> -----------------------------------------------------------------------------------
>
>                 Key: THRIFT-825
>                 URL: https://issues.apache.org/jira/browse/THRIFT-825
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Erlang - Compiler
>         Environment: Any environment
>            Reporter: Dmitry Demeshchuk
>         Attachments: thrift_client.erl.diff
>
>
> Here's the code from thrift_client.erl:
> call(Client, Function, Args)
>  when is_pid(Client), is_atom(Function), is_list(Args) ->
>    case gen_server:call(Client, {call, Function, Args}) of
>        R = {ok, _} -> R;
>        R = {error, _} -> R;
>        {exception, Exception} -> throw(Exception)
>    end.
> But one may want to use the Client variable as an atom (using erlang:register()) or as a tuple {Node, Pid}.
> So, it's better to remove the is_pid() check. If the Client variable is invalid - OTP will just raise the "noproc" exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (THRIFT-825) Erlang API improvement: allow to use atoms and tuples to point at the thrift client

Posted by "Anthony Molinaro (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-825?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anthony Molinaro resolved THRIFT-825.
-------------------------------------

    Resolution: Invalid

Refactoring makes this a non-issue.

> Erlang API improvement: allow to use atoms and tuples to point at the thrift client
> -----------------------------------------------------------------------------------
>
>                 Key: THRIFT-825
>                 URL: https://issues.apache.org/jira/browse/THRIFT-825
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Erlang - Compiler
>         Environment: Any environment
>            Reporter: Dmitry Demeshchuk
>         Attachments: thrift_client.erl.diff
>
>
> Here's the code from thrift_client.erl:
> call(Client, Function, Args)
>  when is_pid(Client), is_atom(Function), is_list(Args) ->
>    case gen_server:call(Client, {call, Function, Args}) of
>        R = {ok, _} -> R;
>        R = {error, _} -> R;
>        {exception, Exception} -> throw(Exception)
>    end.
> But one may want to use the Client variable as an atom (using erlang:register()) or as a tuple {Node, Pid}.
> So, it's better to remove the is_pid() check. If the Client variable is invalid - OTP will just raise the "noproc" exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (THRIFT-825) Erlang API improvement: allow to use atoms and tuples to point at the thrift client

Posted by "Dmitry Demeshchuk (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-825?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dmitry Demeshchuk updated THRIFT-825:
-------------------------------------

    Attachment: thrift_client.erl.diff

That's the fix I used for my needs.
I also added a possibility to register the started thrift client (the first 2 hunks).

> Erlang API improvement: allow to use atoms and tuples to point at the thrift client
> -----------------------------------------------------------------------------------
>
>                 Key: THRIFT-825
>                 URL: https://issues.apache.org/jira/browse/THRIFT-825
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Compiler (Erlang)
>         Environment: Any environment
>            Reporter: Dmitry Demeshchuk
>         Attachments: thrift_client.erl.diff
>
>
> Here's the code from thrift_client.erl:
> call(Client, Function, Args)
>  when is_pid(Client), is_atom(Function), is_list(Args) ->
>    case gen_server:call(Client, {call, Function, Args}) of
>        R = {ok, _} -> R;
>        R = {error, _} -> R;
>        {exception, Exception} -> throw(Exception)
>    end.
> But one may want to use the Client variable as an atom (using erlang:register()) or as a tuple {Node, Pid}.
> So, it's better to remove the is_pid() check. If the Client variable is invalid - OTP will just raise the "noproc" exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.