package market.thread.rtd;



import market.tcp.service.RtdPingzhengService;

import org.springframework.web.context.ContextLoader;
import org.springframework.web.context.WebApplicationContext;

public class RtdServletThread extends Thread implements Runnable  {

	private static int runCopies = 0;
	WebApplicationContext _context;
	private RtdPingzhengService _service1;	  
	
	RtdServletThread() {
		if (++runCopies == 1)
		{
			_context = ContextLoader
					.getCurrentWebApplicationContext();
			_service1 = (RtdPingzhengService) _context
					.getBean("RtdPingzhengService"); 
		}
	}

	public void run() {
		while (!RtdServletMgt.getShouldStop()) {
			try {
				String url = "http://6.6.6.6/das?table=RTD_PINGZHENG";	//内网正式	
				String url2 = "http://6.6.6.6/das?table=RTD_TUIHUOLU";	//内网正式
				String url3 = "http://6.6.6.6/das?table=RTD_SUANXI";	//内网正式
				//_service1.doInsertRtd(url);	
				//_service1.doInsertRtdtuihuo(url2);
				//_service1.doInsertRtdSuanxi(url3);
			} catch (Exception e) {
				e.printStackTrace();
			} finally {
				try {
					Thread.sleep(1*60*1000);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		}
	}
}
