[ https://issues.apache.org/jira/browse/THRIFT-2773?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Konrad Grochowski resolved THRIFT-2773. --------------------------------------- Resolution: Fixed Fix Version/s: 0.9.3 > Generated Java code for 'oneway' methods is incorrect. > ------------------------------------------------------ > > Key: THRIFT-2773 > URL: https://issues.apache.org/jira/browse/THRIFT-2773 > Project: Thrift > Issue Type: Bug > Components: Java - Compiler, Java - Library > Affects Versions: 1.0 > Environment: Mac OS X > Reporter: Adam Zegelin > Assignee: Konrad Grochowski > Fix For: 0.9.3 > > > While the ticket THRIFT-2704 (and associated pull request > https://github.com/apache/thrift/pull/216) adds support to Java for 'oneway' > service calls, the changes only apply to the generated AsyncClient. > The synchronous client code calls TServiceClient.sendBase() which always > generates a TMessage of type T_CALL. > {code:title=oneway-test.thrift} > service TestService { > oneway void testFunction(); > } > {code} > {code:title=TestService.java} > public class TestService { > ⋮ > public static class Client extends org.apache.thrift.TServiceClient > implements Iface { > ⋮ > public void send_testFunction() throws org.apache.thrift.TException > { > ⋮ > sendBase("testFunction", args); // note the lack of message type here > } > } > ⋮ > public static class AsyncClient extends > org.apache.thrift.async.TAsyncClient implements AsyncIface { > ⋮ > public static class testFunction_call extends > org.apache.thrift.async.TAsyncMethodCall { > ⋮ > public void write_args(org.apache.thrift.protocol.TProtocol prot) > throws org.apache.thrift.TException { > prot.writeMessageBegin(new > org.apache.thrift.protocol.TMessage("testFunction", > org.apache.thrift.protocol.TMessageType.ONEWAY, 0)); // ONEWAY is specified > correctly > testFunction_args args = new testFunction_args(); > args.write(prot); > prot.writeMessageEnd(); > } > ⋮ > } > } > ⋮ > } > {code} > {code:title=TServiceClient.java} > public abstract class TServiceClient { > ⋮ > protected void sendBase(String methodName, TBase args) throws TException { > oprot_.writeMessageBegin(new TMessage(methodName, TMessageType.CALL, > ++seqid_)); // note hardcoded CALL > ⋮ > } > ⋮ > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)