Allow the prune interval to be run on a particular RunQueue (invoker in this
case as the Invoker is now a RunQueue) instead of on its own interval thread. git-svn-id: https://samskivert.googlecode.com/svn/trunk@2126 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -32,6 +32,7 @@ import com.samskivert.servlet.RedirectException;
|
|||||||
import com.samskivert.servlet.util.CookieUtil;
|
import com.samskivert.servlet.util.CookieUtil;
|
||||||
import com.samskivert.servlet.util.RequestUtils;
|
import com.samskivert.servlet.util.RequestUtils;
|
||||||
import com.samskivert.util.Interval;
|
import com.samskivert.util.Interval;
|
||||||
|
import com.samskivert.util.RunQueue;
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
import com.samskivert.util.Tuple;
|
import com.samskivert.util.Tuple;
|
||||||
|
|
||||||
@@ -79,7 +80,7 @@ public class UserManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepares this user manager it for operation. Presently the user manager requires the
|
* Prepares this user manager for operation. Presently the user manager requires the
|
||||||
* following configuration information:
|
* following configuration information:
|
||||||
*
|
*
|
||||||
* <ul>
|
* <ul>
|
||||||
@@ -101,6 +102,17 @@ public class UserManager
|
|||||||
*/
|
*/
|
||||||
public void init (Properties config, ConnectionProvider conprov)
|
public void init (Properties config, ConnectionProvider conprov)
|
||||||
throws PersistenceException
|
throws PersistenceException
|
||||||
|
{
|
||||||
|
init(config, conprov, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepares this user manager for operation. See {@link #init(Properties,ConnectionProvider)}.
|
||||||
|
*
|
||||||
|
* @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)
|
||||||
|
throws PersistenceException
|
||||||
{
|
{
|
||||||
// save this for later
|
// save this for later
|
||||||
_config = config;
|
_config = config;
|
||||||
@@ -128,8 +140,8 @@ 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() {
|
||||||
public void expired ()
|
{ _runQueue = pruneQueue; } // blame Ray for being draconian in Interval's constructor
|
||||||
{
|
public void expired () {
|
||||||
try {
|
try {
|
||||||
_repository.pruneSessions();
|
_repository.pruneSessions();
|
||||||
} catch (PersistenceException pe) {
|
} catch (PersistenceException pe) {
|
||||||
|
|||||||
Reference in New Issue
Block a user