Timer event in a PUI program.
Posted: Thu Jun 16, 2011 11:54 am
I would like to return to my rpgle pgm every xx minutes to see if a control record has been changed and if so, reload a subfile based on the changed record.
I am not a java programmer, but after searching the web I found the following code but can't figure out if / how to make it work in the onLoad event.
If anyone is doing this --- I would appreciate your help.
----------------------------------------------------------------
import java.util.Timer;
import java.util.TimerTask;
public class Main {
public static void main(String[] argv) throws Exception {
int delay = 5000; // delay for 5 sec.
int period = 1000; // repeat every sec.
Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
public void run() {
System.out.println("doing");
}
}, delay, period);
}
}
----------------------------------------------------------------
I am not a java programmer, but after searching the web I found the following code but can't figure out if / how to make it work in the onLoad event.
If anyone is doing this --- I would appreciate your help.
----------------------------------------------------------------
import java.util.Timer;
import java.util.TimerTask;
public class Main {
public static void main(String[] argv) throws Exception {
int delay = 5000; // delay for 5 sec.
int period = 1000; // repeat every sec.
Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
public void run() {
System.out.println("doing");
}
}, delay, period);
}
}
----------------------------------------------------------------