Make Interval constructor lenient about the RunQueue it's passed. Caveat

operarius.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2128 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2007-07-10 22:12:12 +00:00
parent a8218d725a
commit 5783500a67
2 changed files with 4 additions and 8 deletions
@@ -111,7 +111,7 @@ public class UserManager
*
* @param pruneQueue an optional run queue on which to run our periodic session pruning task.
*/
public void init (Properties config, ConnectionProvider conprov, final RunQueue pruneQueue)
public void init (Properties config, ConnectionProvider conprov, RunQueue pruneQueue)
throws PersistenceException
{
// save this for later
@@ -139,8 +139,7 @@ public class UserManager
}
// register a cron job to prune the session table every hour
_pruner = new Interval() {
{ _runQueue = pruneQueue; } // blame Ray for being draconian in Interval's constructor
_pruner = new Interval(pruneQueue) {
public void expired () {
try {
_repository.pruneSessions();
+2 -5
View File
@@ -63,18 +63,15 @@ public abstract class Interval
*/
public Interval ()
{
this(null);
}
/**
* Create an Interval that uses the specified {@link RunQueue} to run the {@link #expired}
* method.
* method. If null is supplied the interval will be run directly on the timer thread.
*/
public Interval (RunQueue runQueue)
{
if (runQueue == null) {
throw new NullPointerException("RunQueue cannot be null, " +
"use other constructor if you want a simple Interval.");
}
_runQueue = runQueue;
}