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:
@@ -111,7 +111,7 @@ public class UserManager
|
|||||||
*
|
*
|
||||||
* @param pruneQueue an optional run queue on which to run our periodic session pruning task.
|
* @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
|
throws PersistenceException
|
||||||
{
|
{
|
||||||
// save this for later
|
// save this for later
|
||||||
@@ -139,8 +139,7 @@ public class UserManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
// register a cron job to prune the session table every hour
|
// register a cron job to prune the session table every hour
|
||||||
_pruner = new Interval() {
|
_pruner = new Interval(pruneQueue) {
|
||||||
{ _runQueue = pruneQueue; } // blame Ray for being draconian in Interval's constructor
|
|
||||||
public void expired () {
|
public void expired () {
|
||||||
try {
|
try {
|
||||||
_repository.pruneSessions();
|
_repository.pruneSessions();
|
||||||
|
|||||||
@@ -63,18 +63,15 @@ public abstract class Interval
|
|||||||
*/
|
*/
|
||||||
public Interval ()
|
public Interval ()
|
||||||
{
|
{
|
||||||
|
this(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an Interval that uses the specified {@link RunQueue} to run the {@link #expired}
|
* 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)
|
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;
|
_runQueue = runQueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user