i have got server app written in java, and client app in groovy. My server up get request and do sth. I use Thrift with TNonBlockingServer.
public static void nonBlockingServer(HbaseLayerService.Processor processor) {
try {
final Integer serverPort = ConfigurationManager.instance().getServerPort();
TNonblockingServerTransport serverTransport = new TNonblockingServerSocket(serverPort);
TServer server = new TNonblockingServer(new TNonblockingServer.Args(serverTransport).processor(processor));
server.serve();
} catch (Exception e) {
Throwables.propagate(e);
}
}
My client send ~100Mb data
TTransport transport = new TFramedTransport(new TSocket('localhost', 12345, 100000))
transport.open()
TProtocol protocol = new TBinaryProtocol(transport);
HbaseLayerService.Client client = new HbaseLayerService.Client(protocol);
def putList = [] //~1500000 objects (string, string, string, int, byte[])
client.putEvent(new PutEventsOperation(putsToSend));
during this operation i have an error:
Exception in thread "main" org.apache.thrift.transport.TTransportException
at org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:132)
at org.apache.thrift.transport.TTransport.readAll(TTransport.java:86)
at org.apache.thrift.transport.TFramedTransport.readFrame(TFramedTransport.java:129)
at org.apache.thrift.transport.TFramedTransport.read(TFramedTransport.java:101)
at org.apache.thrift.transport.TTransport.readAll(TTransport.java:86)
at org.apache.thrift.protocol.TBinaryProtocol.readAll(TBinaryProtocol.java:429)
at org.apache.thrift.protocol.TBinaryProtocol.readI32(TBinaryProtocol.java:318)
at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:219)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:69)
at communication_struct.thrift.HbaseLayerService$Client.recv_putEvent(HbaseLayerService.java:96)
This exception has type 4: END_OF_FILE.
With TSimpleServer everything is ok, but I want to take a few connections and do operation in queue in one thread.
Finally I found the solution.
In this particular case you should add new size to TFramedTransport.Factory
as like below:
TServer server = new TNonblockingServer(new TNonblockingServer.Args(serverTransport)
.processor(processor)
.transportFactory(new TFramedTransport.Factory(MAX_FRAMED_TRANSPORT_SIZE))
.protocolFactory(new TBinaryProtocol.Factory())
);
The same operation should be done in client side:
TTransport transport = new TFramedTransport(new TSocket('localhost', 12345), MAX_FRAMED_TRANSPORT_SIZE)
In my case MAX_FRAMED_TRANSPORT_SIZE = 256 * 1024 * 1024
.