From 645e307accd9d30898d998cd47be8ad5a1d5018e Mon Sep 17 00:00:00 2001 From: Andy Janata Date: Sat, 21 Dec 2013 20:42:47 -0800 Subject: [PATCH] Purge TimerTasks in the ping timeout task. Fixes #70. --- src/net/socialgamer/cah/UserPing.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/net/socialgamer/cah/UserPing.java b/src/net/socialgamer/cah/UserPing.java index 0cbee89..b2ad8ae 100644 --- a/src/net/socialgamer/cah/UserPing.java +++ b/src/net/socialgamer/cah/UserPing.java @@ -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(); } }