I'm new to java and have written a small, but quite important, thrift service in java.
I've noticed that occasionally it'll stop serving without any error messages; it seems that the java process just dies, randomly, without a stack-trace or exception.
What would be the best way to ensure this process stays alive even after an error? Here's the main function, if it will help:
public static void main(String [] args) {
try {
MyAppServiceHandler handler = new MyAppServiceHandler();
MyApp.Processor processor = new MyApp.Processor(handler);
TServerTransport serverTransport = new TServerSocket(8080);
TServer server = null;
server = new TSimpleServer(processor, serverTransport);
System.out.println("Starting thrift server...");
server.serve();
}
catch (TTransportException e) {
e.printStackTrace();
}
catch (Exception e) {
e.printStackTrace();
}
}