MAIN



import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.nbtv.commons.context.AppContext;

public class Main_RptPayInstruction {
private static Log log = LogFactory.getLog(Main_RptPayInstruction.class);

private static volatile boolean running = true;

public static void main(String[] args) {

Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
try {
AppContext.stop();

log.info(new SimpleDateFormat("[yyyy-MM-dd HH:mm:ss]").format(new Date()) + " Main server stopped!");
}catch (Throwable t) {
                    log.error("Main stop error:"+t);
                }

synchronized (Main_RptPayInstruction.class) {
                running = false;
                Main_RptPayInstruction.class.notify();
            }
}
});


AppContext.start();

log.info(new SimpleDateFormat("[yyyy-MM-dd HH:mm:ss]").format(new Date()) + " Main server started!");

synchronized (Main_RptPayInstruction.class) {
while (running) {
            try {
            Main_RptPayInstruction.class.wait();
            } catch (Throwable e) {
            }
        }
}

}

}

猜你喜欢

转载自tangkuo.iteye.com/blog/2303929