예제 #1
0
    private void setSysTime(long ctrTime) throws IOException {
    	DateFormat dateTimeFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	String dt = dateTimeFmt.format(new Date(ctrTime))
    	String[] cmd = {"date", "-s", dt};
    	String osType = System.getProperty("os.name").toLowerCase();
    	if (osType.contains("linux")) {
    		LOGGER.debug("setting system time {} as {} on driver {}", ctrTime, dt, driver.getDriverInfo().getName());
    		Runtime.getRuntime().exec(cmd);
		} else {
			LOGGER.warn("os type on driver {} is {}!", 
					driver.getDriverInfo().getName(), osType);
		}
	}
예제 #2
0
 @Override
 protected Response process(HttpServletRequest req, HttpServletResponse res)
 		throws Exception {
 	Scanner scanner = new Scanner(req.getInputStream());
 	setSysTime(getControllerTime(scanner));
 	
 	PingResponse response = new PingResponse();
     DriverInfo info = driver.getDriverInfo();
     response.setName(info.getName());
     response.setAddress(info.getUrl());
     response.setTimeStamp(String.valueOf(System.currentTimeMillis()));
     return response;
 }