how to create a timer in java code example
Example 1: java timer
timer.schedule(new TimerTask() {
@Override
public void run() {
// Your database code here
}
}, 2*60*1000);
// Since Java-8
timer.schedule(() -> /* your database code here */, 2*60*1000);
Example 2: java timer
import java.util.Timer;
Example 3: java timer
Timer timer = new Timer();