P
Philipp
Hello
I just wanted to know if it is acceptable (from a threading and
synchronization perspective) to schedule a task within a Timer's
constructor. Example:
public final class SaveTimer extends Timer {
private static final long period = 60000L;
public SaveTimer() {
scheduleAtFixedRate(new SaverTimerTask(), period, period); // OK?
}
private static class SaverTimerTask extends TimerTask {
public void run() {
// do the save here
}
}
}
Thanks Phil
PS: I'm using JVM 1.3, so the old memory model
I just wanted to know if it is acceptable (from a threading and
synchronization perspective) to schedule a task within a Timer's
constructor. Example:
public final class SaveTimer extends Timer {
private static final long period = 60000L;
public SaveTimer() {
scheduleAtFixedRate(new SaverTimerTask(), period, period); // OK?
}
private static class SaverTimerTask extends TimerTask {
public void run() {
// do the save here
}
}
}
Thanks Phil
PS: I'm using JVM 1.3, so the old memory model