}
TBinaryProtocol binaryProtocol =
- new TBinaryProtocol(transport);
+ new TBinaryProtocol(transport, false, false);
ThriftTest.Client testClient =
new ThriftTest.Client(binaryProtocol);
System.out.print(k2 + " => {");
AbstractMap<Integer, Long> userMap = v2.userMap;
System.out.print("{");
- for (int k3 : userMap.keySet()) {
- System.out.print(k3 + " => " + userMap.get(k3) + ", ");
+ if (userMap != null) {
+ for (int k3 : userMap.keySet()) {
+ System.out.print(k3 + " => " + userMap.get(k3) + ", ");
+ }
}
System.out.print("}, ");
ArrayList<Xtruct> xtructs = v2.xtructs;
System.out.print("{");
- for (Xtruct x : xtructs) {
- System.out.print("{" + "\"" + x.string_thing + "\", " + x.byte_thing + ", " + x.i32_thing + ", "+ x.i64_thing + "}, ");
+ if (xtructs != null) {
+ for (Xtruct x : xtructs) {
+ System.out.print("{" + "\"" + x.string_thing + "\", " + x.byte_thing + ", " + x.i32_thing + ", "+ x.i64_thing + "}, ");
+ }
}
System.out.print("}");
import com.facebook.thrift.TException;
import com.facebook.thrift.protocol.TBinaryProtocol;
import com.facebook.thrift.protocol.TProtocol;
+import com.facebook.thrift.protocol.TProtocolFactory;
import com.facebook.thrift.server.TServer;
import com.facebook.thrift.server.TSimpleServer;
import com.facebook.thrift.server.TThreadPoolServer;
TServerSocket tServerSocket =
new TServerSocket(port);
+ // Protocol factory
+ TProtocolFactory tProtocolFactory =
+ new TBinaryProtocol.Factory(true, true);
+
TServer serverEngine;
// Simple Server
// serverEngine = new TSimpleServer(testProcessor, tServerSocket);
// ThreadPool Server
- serverEngine = new TThreadPoolServer(testProcessor, tServerSocket);
+ serverEngine = new TThreadPoolServer(testProcessor, tServerSocket, tProtocolFactory);
// Run it
System.out.println("Starting the server on port " + port + "...");