I want to implement a function which will be refreshed in every 10 second in server side using java - netbeans
I have a counter in my function which should be refreshed depend on the time .
I want to implement a function which will be refreshed in every 10 second in server side using java - netbeans
I have a counter in my function which should be refreshed depend on the time .
Look into using the Java Timer class. This class can execute a TimerTask for a specified interval.
Documentation: http://docs.oracle.com/javase/7/docs/api/java/util/Timer.html
Example:
import java.util.Timer; //Be sure to import the correct Timer
...
Timer timer = new Timer();
timer.schedule(new CustomTimerTask(), seconds * 10000);
Your CustomTimerTask will be a class which extends TimerTask and implements a run method. The run method will be called every 10000
miliseconds as specified.
Complete Example: