package market.thread.tcpTempHum;

import market.tcp.service.TcpTempHumService;

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

class TempHumServletThread extends Thread implements Runnable {
	private static int runCopies = 0;
	WebApplicationContext _context;
	private TcpTempHumService _service1;	  
	
	TempHumServletThread() {
		if (++runCopies == 1)
		{
			_context = ContextLoader
					.getCurrentWebApplicationContext();
			_service1 = (TcpTempHumService) _context
					.getBean("TcpTempHumService"); 
		}
	}

	public void run() {
		while (!TempHumServletMgt.getShouldStop()) {
			try {
				String url = "http://6.6.6.6/das?table=RTD_LM_861";	//内网正式	
				//_service1.doInsertTempHum(url);			
			} catch (Exception e) {
				e.printStackTrace();
			} finally {
				try {
					Thread.sleep(5*60*1000);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		}
	}
}
