source: ntrip/trunk/GnssCenter/thrift/bidi_java/client/MessageReceiver.java@ 10590

Last change on this file since 10590 was 4940, checked in by mervart, 12 years ago
File size: 1002 bytes
Line 
1package com.joelpm.bidiMessages.client;
2
3import org.apache.thrift.TException;
4import org.apache.thrift.protocol.TProtocol;
5import com.joelpm.bidiMessages.generated.MessageService;
6
7/**
8* The class responsible for reading and deserializing incoming messages.
9* Should be run in its own thread.
10*
11* @author Joel Meyer
12*/
13public class MessageReceiver extends ConnectionRequiredRunnable {
14 private final MessageService.Processor processor;
15 private final TProtocol protocol;
16
17 public MessageReceiver(
18 TProtocol protocol,
19 MessageService.Iface messageService,
20 ConnectionStatusMonitor connectionMonitor) {
21 super(connectionMonitor, "Message Receiver");
22 this.protocol = protocol;
23 this.processor = new MessageService.Processor(messageService);
24 }
25
26 @Override
27 public void run() {
28 connectWait();
29 while (true) {
30 try {
31 while (processor.process(protocol, protocol) == true) { }
32 } catch (TException e) {
33 disconnected();
34 }
35 }
36 }
37}
38
Note: See TracBrowser for help on using the repository browser.