The use of Java timer Timer

1. Creating a Timer object is to start a new thread, but this newly started thread is not a daemon thread, it runs in the background all the time. The newly started Timer thread can be set as a daemon thread by the following.


private static Timer timer=new Timer(true);


 2. Advance: When the planned time is earlier than the current time, the task will be run immediately.

 

http://www.cppentry.com/bencandy.php?fid=54&aid=166800

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326450540&siteId=291194637