지금 처럼 했는데 run 익명 클레스 안에 new을 계속 해서 선언하는데 이런식으로하면 메모리에 부화 안오나요? period는 60000L으로 변경할 예정입니다.
TimerTask task = new TimerTask() { public void run() { Date date = new Date(); SimpleDateFormat simpl = new SimpleDateFormat("hh:mm"); String s = simpl.format(date); System.out.println(s); if(s.equals("00:00")) {
System.out.println("test");} } }; Timer timer = new Timer("Timer"); long delay = 1000L; long period = 1000L; System.out.println(LocalDateTime.now() + " : Scheduling...."); timer.scheduleAtFixedRate(task, delay, period);