What Thrift Oneway that?

 

 

Many online article, there are a variety involving the use of oneway basic example is a front THRIFT IDL interfaces plus oneway. After reading it on

oneway understanding is still very vague, then I looked under Thrift code, and finally they get to know oneway.

 

Code Location: org.apache.thrift.ProcessFunction # isOneway

 

 1 try {
 2             result = this.getResult(iface, args);
 3         } catch (TException var9) {
 4             LOGGER.error("Internal error processing " + this.getMethodName(), var9);
 5             TApplicationException x = new TApplicationException(6, "Internal error processing " + this.getMethodName());
 6             oprot.writeMessageBegin(new TMessage(this.getMethodName(), (byte)3, seqid));
 7             x.write(oprot);
 8             oprot.writeMessageEnd();
 9             oprot.getTransport().flush();
10             return;
11         }
12 
13         if (!this.isOneway()) {
14             oprot.writeMessageBegin(new TMessage(this.getMethodName(), (byte)2, seqid));
15             result.write(oprot);
16             oprot.writeMessageEnd();
17             oprot.getTransport().flush();
18         }

 

Originally opened oneway, a server-side RPC call does not return the response to the client, the client is also equivalent to ignore the results of the first call.

Oneway default this is false, that is, the default will return results, do not care about the result of calling interface can be set to oneway, may slightly improve the interface performance on business.

Guess you like

Origin www.cnblogs.com/Joynic/p/10985729.html