| Line 1... |
Line 1... |
| 1 |
package in.shop2020.payment.service;
|
1 |
package in.shop2020.payment.service;
|
| 2 |
|
2 |
|
| 3 |
import org.apache.thrift.protocol.TBinaryProtocol;
|
3 |
import org.apache.thrift.protocol.TBinaryProtocol;
|
| 4 |
import org.apache.thrift.protocol.TProtocol;
|
- |
|
| 5 |
import org.apache.thrift.protocol.TProtocolFactory;
|
4 |
import org.apache.thrift.protocol.TProtocolFactory;
|
| 6 |
import org.apache.thrift.server.TServer;
|
5 |
import org.apache.thrift.server.TServer;
|
| 7 |
import org.apache.thrift.server.TThreadPoolServer;
|
6 |
import org.apache.thrift.server.TThreadPoolServer;
|
| 8 |
import org.apache.thrift.transport.TFramedTransport;
|
7 |
import org.apache.thrift.transport.TFramedTransport;
|
| 9 |
import org.apache.thrift.transport.TServerSocket;
|
8 |
import org.apache.thrift.transport.TServerSocket;
|
| 10 |
import org.apache.thrift.transport.TServerTransport;
|
9 |
import org.apache.thrift.transport.TServerTransport;
|
| 11 |
import org.apache.thrift.transport.TTransport;
|
- |
|
| 12 |
import org.apache.thrift.transport.TTransportFactory;
|
10 |
import org.apache.thrift.transport.TTransportFactory;
|
| - |
|
11 |
import org.slf4j.Logger;
|
| - |
|
12 |
import org.slf4j.LoggerFactory;
|
| 13 |
|
13 |
|
| 14 |
import in.shop2020.payment.service.handler.PaymentServiceHandler;
|
14 |
import in.shop2020.payment.service.handler.PaymentServiceHandler;
|
| 15 |
import in.shop2020.payments.PaymentService.Processor;
|
15 |
import in.shop2020.payments.PaymentService.Processor;
|
| 16 |
|
16 |
|
| 17 |
public class PaymentServer {
|
17 |
public class PaymentServer {
|
| - |
|
18 |
private static Logger logger = LoggerFactory.getLogger(PaymentServer.class);
|
| - |
|
19 |
|
| 18 |
private static PaymentServiceHandler handler;
|
20 |
private static PaymentServiceHandler handler;
|
| 19 |
|
21 |
|
| 20 |
private static Processor processor;
|
22 |
private static Processor processor;
|
| 21 |
|
23 |
|
| 22 |
public static void main(String[] args){
|
24 |
public static void main(String[] args){
|
| Line 27... |
Line 29... |
| 27 |
TServerTransport serverTransport = new TServerSocket(9012);
|
29 |
TServerTransport serverTransport = new TServerSocket(9012);
|
| 28 |
TTransportFactory tFactory = new TFramedTransport.Factory();
|
30 |
TTransportFactory tFactory = new TFramedTransport.Factory();
|
| 29 |
TProtocolFactory pFactory = new TBinaryProtocol.Factory();
|
31 |
TProtocolFactory pFactory = new TBinaryProtocol.Factory();
|
| 30 |
TServer server = new TThreadPoolServer(processor, serverTransport, tFactory, pFactory);
|
32 |
TServer server = new TThreadPoolServer(processor, serverTransport, tFactory, pFactory);
|
| 31 |
|
33 |
|
| 32 |
System.out.println("Payment service started on port 9012");
|
34 |
logger.info("Payment service started on port 9012");
|
| 33 |
server.serve();
|
35 |
server.serve();
|
| 34 |
}catch(Exception ex){
|
36 |
}catch(Exception ex){
|
| 35 |
ex.printStackTrace();
|
37 |
ex.printStackTrace();
|
| 36 |
}
|
38 |
}
|
| 37 |
}
|
39 |
}
|