Purge TimerTasks in the ping timeout task. Fixes #70.

This commit is contained in:
Andy Janata 2013-12-21 20:42:47 -08:00
parent 0701e80a52
commit 645e307acc
1 changed files with 6 additions and 1 deletions

View File

@ -23,6 +23,8 @@
package net.socialgamer.cah;
import java.util.Timer;
import net.socialgamer.cah.data.ConnectedUsers;
import com.google.inject.Inject;
@ -36,14 +38,17 @@ import com.google.inject.Inject;
public class UserPing extends SafeTimerTask {
private final ConnectedUsers users;
private final Timer globalTimer;
@Inject
public UserPing(final ConnectedUsers users) {
public UserPing(final ConnectedUsers users, final Timer globalTimer) {
this.users = users;
this.globalTimer = globalTimer;
}
@Override
public void process() {
users.checkForPingAndIdleTimeouts();
globalTimer.purge();
}
}