Hi Avinash,
When I implement my server in Java, do i need to update all the fields
while constructing response . Or just some field updates is enough.
You would have to set required fields, if there were any. Since your
Response struct only consists of optionals, it would be perfectly legal to
send a response structure back with no values at all.
Sometimes I get following kind of exception
From what I see in the code, the exception is
TTransportException.END_OF_FILE. Therefore I don't think that the problem
has anything to do with optionals being set or not set. But it could be
helpful to the Java guys if they had a little more information about your
setup, especially which transport and which protocol(s) you are using.
-----Ursprüngliche Nachricht-----
From: Avinash Dongre
Sent: Monday, May 13, 2013 1:49 PM
To: [email protected]
Subject: Optional Field in Thrift Structure
I have following structure
struct Response {
1: optional bool isFinished, // for BLOB and CLOB
2: optional ResponseSubset r1,
3: optional i32 Count,
4: optional list<alue> params,
6: optional ResponseSubset1 warnings,
}
and Have api like this
Response performanOperation(1. required i32 id)
When I implement my server in Java, do i need to update all the fields
while constructing response . Or just some field updates is enough.
Sometimes I get following kind of exception
org.apache.thrift.transport.TTransportException
at
org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:132)
at org.apache.thrift.transport.TTransport.readAll(TTransport.java:84)
at
org.apache.thrift.protocol.TBinaryProtocol.readAll(TBinaryProtocol.java:378)
at
org.apache.thrift.protocol.TBinaryProtocol.readI32(TBinaryProtocol.java:297)
at
org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:204)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:69)
Thanks
Avinash