[cvs] expresso commit by rimovm: Modified Caches to carry the RequestRegistry

JCorporate Ltd jcorp at jcorp2.servlets.net
Mon Nov 8 16:56:40 PST 2004


Log Message:
-----------
Modified Caches to carry the RequestRegistry in each Thread.

Modified Files:
--------------
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/cache:
        CacheCleaner.java
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/job:
        Job.java
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/misc:
        EventHandler.java
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/utility:
        JobHandler.java
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/services/asyncprocess:
        AsyncProcessor.java
        DefaultAsyncProcessor.java
        ProcessThread.java
    expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/services/crontab:
        CronDaemon.java

Revision Data
-------------
Index: CacheCleaner.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/cache/CacheCleaner.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/cache/CacheCleaner.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/cache/CacheCleaner.java -u -r1.9 -r1.10
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/cache/CacheCleaner.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/cache/CacheCleaner.java
@@ -67,6 +67,8 @@
 import org.apache.log4j.Logger;
 
 import java.util.Iterator;
+import com.jcorporate.expresso.core.security.SuperUser;
+import com.jcorporate.expresso.core.registry.MutableRequestRegistry;
 
 /**
  * This thread is initialized by CacheManager and slowly iterates through the
@@ -126,6 +128,12 @@
         if (log.isDebugEnabled()) {
             log.debug("Starting Cache Cleaning");
         }
+
+        //Since we're in a new thread, we have to give it context, even
+        //if it is inside superuser.
+        new MutableRequestRegistry("default"
+            ,SuperUser.SUPER_USER);
+
 
         while (!this.isInterrupted() && !done) {
             for (Iterator i = cacheSystems.iterator(); i.hasNext();) {
Index: Job.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/job/Job.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/job/Job.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/job/Job.java -u -r1.27 -r1.28
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/job/Job.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/job/Job.java
@@ -91,7 +91,8 @@
 import com.jcorporate.expresso.services.dbobj.JobQueue;
 import com.jcorporate.expresso.services.dbobj.JobQueueParam;
 import com.jcorporate.expresso.services.dbobj.Setup;
-
+import com.jcorporate.expresso.core.registry.*;
+import com.jcorporate.expresso.core.security.SuperUser;
 
 /**
  * A Job is an asynchronous task who's results will generally be emailed to
@@ -134,7 +135,9 @@
      */
     private Hashtable myParamValidValues = new Hashtable();
 
-    // number of parameters received with this job
+    /**
+     *     number of parameters received with this job
+     */
     private int m_jobParamsNum = -1;
 
     /**
@@ -169,9 +172,19 @@
      * The cron alarm entry (usually Crontab entry)
      */
     private CrontabEntry m_cronAlarmEntry = null;
+
+
+    /**
+     * Key for if we should notify the user on a successful job.
+     */
     public static final String IS_NOTIFY_ON_JOB_SUCCESS = "isNotifyOnJobSuccess";
 
     /**
+     * The request registry for this thread.
+     */
+    private RequestRegistry requestRegistry;
+
+    /**
      * Default Constructor
      */
     public Job() {
@@ -437,10 +450,13 @@
     public void run() {
 
         try {
+            new MutableRequestRegistry(this.getDataContext()
+                ,SuperUser.SUPER_USER);
             User u = new User();
             u.setDataContext(this.getDataContext());
             u.setLoginName(this.getUser());
             u.retrieve();
+
             //Set the permission of the request context.
             new MutableRequestRegistry(
                 this.getDataContext(), u);
Index: EventHandler.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/misc/EventHandler.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/misc/EventHandler.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/misc/EventHandler.java -u -r1.15 -r1.16
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/misc/EventHandler.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/misc/EventHandler.java
@@ -73,8 +73,9 @@
 import com.jcorporate.expresso.core.security.User;
 import com.jcorporate.expresso.services.dbobj.Event;
 import org.apache.log4j.Logger;
-
+import com.jcorporate.expresso.core.security.SuperUser;
 import java.util.Vector;
+import com.jcorporate.expresso.core.registry.MutableRequestRegistry;
 
 
 /**
@@ -83,7 +84,7 @@
  *
  * @author        Michael Nash
  */
-public class EventHandler extends Thread 
+public class EventHandler extends Thread
 {
     private static Vector queue = new Vector(3);
     private static EventHandler myInstance = null;
@@ -119,6 +120,7 @@
      * Actually check the event queue and trigger the events or send
      * notices (electronic mail pertaining to registering Expresso
      * Framework users)
+     * @throws DBException upon error.
      */
     private synchronized void checkQueue()
 	throws DBException {
@@ -156,8 +158,8 @@
                     myUser.setUid( oneEventQueueEntry.getUid() );
 
                     if (myUser.find()) {
-                        myUser.notify( oneEventQueueEntry.getSubject(), 
-				       oneEventQueueEntry.getTheMessage(), 
+                        myUser.notify( oneEventQueueEntry.getSubject(),
+				       oneEventQueueEntry.getTheMessage(),
 				       false /*htmlMail*/,
 				       oneEventQueueEntry.getAttachments() );
                     } else {
@@ -241,14 +243,14 @@
      * @param message Message to send in body of e-mail
      * @param attachments the array list of virtual byte array data sources
      */
-    public static void notify( String dbName, int uid, String subject, String message, 
-			       ByteArrayDataSource attachments[] ) 
+    public static void notify( String dbName, int uid, String subject, String message,
+			       ByteArrayDataSource attachments[] )
     {
         if (log.isDebugEnabled()) {
 	    String msg="";
-	    if ( attachments != null ) 
+	    if ( attachments != null )
 		msg = " with "+attachments.length+" virtual data source attachments.";
-	    
+
 	    log.debug("Queueing notice to user " + uid + " of '" + subject + "'"+ msg );
         }
 
@@ -267,7 +269,8 @@
      */
     public void run() {
         log.info("Event Handler starts");
-
+        //Set registry context.
+        new MutableRequestRegistry("default",SuperUser.SUPER_USER);
         try {
             while (true) {
                 if (idleTimes >= maxIdleTimes) {
Index: JobHandler.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/utility/JobHandler.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/utility/JobHandler.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/core/utility/JobHandler.java -u -r1.32 -r1.33
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/core/utility/JobHandler.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/core/utility/JobHandler.java
@@ -94,6 +94,8 @@
 import java.util.Iterator;
 import java.util.StringTokenizer;
 import java.util.Vector;
+import com.jcorporate.expresso.core.security.SuperUser;
+import com.jcorporate.expresso.core.registry.MutableRequestRegistry;
 
 
 /**
@@ -233,9 +235,9 @@
     } /* setDBName(String) */
 
     /**
-     * 
+     *  Sets the Job Handler Id
      *
-     * @param num
+     * @param num long integer.
      */
     public void setID(long num) {
         m_serverID = num;
@@ -256,7 +258,7 @@
      * may not be threadsafe. Use only for necessary management of the cron
      * handler and sychronize all modification acccess against the instance.
      *
-     * @return
+     * @return Crontab instance.
      */
     public Crontab getCronManager() {
         return this.m_cronMgr;
@@ -465,6 +467,10 @@
 
         this.running = true;
 
+        //Set the default statuses for this thread to superuser
+        //and the context specified.
+        new MutableRequestRegistry(dbName,SuperUser.SUPER_USER);
+
         try {
             resetCurrentJobs();
 
@@ -759,6 +765,7 @@
 
     /**
      * Actually check the job queue and invoke the appropriate server module
+     * @throws ServerException
      */
     private synchronized void checkQueue() throws ServerException {
         if (log.isDebugEnabled()) {
@@ -1004,6 +1011,7 @@
     /**
      * Iterate through all crontab entries, checking to make sure they exist in the JobQueue. If it doesn't
      * (probably because the JobQueue entry has been deleted), remove the crontab entry
+     * @throws DBException upon database access error.
      */
     private void removeCronJobForRemovedQueueEntry() throws DBException {
         JobQueue jobQueue = new JobQueue();
@@ -1201,6 +1209,8 @@
 
     /**
      * Wait for all current jobs to complete before returning.
+     * @throws InterruptedException if Thread.interrupt() is called while
+     * waiting.
      */
     private void waitForAllJobs() throws InterruptedException {
         while (true) {
Index: ProcessThread.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/services/asyncprocess/ProcessThread.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/services/asyncprocess/ProcessThread.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/services/asyncprocess/ProcessThread.java -u -r1.3 -r1.4
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/services/asyncprocess/ProcessThread.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/services/asyncprocess/ProcessThread.java
@@ -70,6 +70,8 @@
  * @version $Revision$ on  $Date$
  */
 import java.util.LinkedList;
+import com.jcorporate.expresso.core.security.SuperUser;
+import com.jcorporate.expresso.core.registry.MutableRequestRegistry;
 
 public class ProcessThread extends Thread {
     private boolean done = false;
@@ -120,6 +122,15 @@
      * we exit.
      */
     public void run() {
+
+        /**
+         * @todo This might eventually become a security issue to
+         * malevolent coding practices.  We need to be able to set
+         * the request for the process.
+         */
+        new MutableRequestRegistry("default"
+            ,SuperUser.SUPER_USER);
+
         LinkedList queue = parent.getQueue();
         while (!done) {
             synchronized(queue) {
@@ -147,4 +158,4 @@
             }
         }
     }
-}
\ No newline at end of file
+}
Index: DefaultAsyncProcessor.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/services/asyncprocess/DefaultAsyncProcessor.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/services/asyncprocess/DefaultAsyncProcessor.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/services/asyncprocess/DefaultAsyncProcessor.java -u -r1.10 -r1.11
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/services/asyncprocess/DefaultAsyncProcessor.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/services/asyncprocess/DefaultAsyncProcessor.java
@@ -68,10 +68,12 @@
 import com.jcorporate.expresso.core.misc.StringUtil;
 import com.jcorporate.expresso.services.dbobj.Setup;
 import org.apache.log4j.Logger;
-
+import com.jcorporate.expresso.core.security.User;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.Map;
+import com.jcorporate.expresso.core.registry.RequestRegistry;
+import com.jcorporate.expresso.core.registry.MutableRequestRegistry;
 
 /**
  * This is a default implementation of the AsyncProcessor.  It has specific
@@ -101,9 +103,12 @@
  * @author Michael Rimov
  * @version $Revision$ on  $Date$
  */
-public class DefaultAsyncProcessor implements AsyncProcessor {
+public class DefaultAsyncProcessor
+    implements AsyncProcessor
+{
 
-    public static final String DEFAULT_PROCESSSOR_PROPERTIES_FILE = "DefaultProcessor.properties";
+    public static final String DEFAULT_PROCESSSOR_PROPERTIES_FILE =
+        "DefaultProcessor.properties";
     private int nextIssuedTicket = 0;
 
     private LinkedList waitQueue = new LinkedList();
@@ -112,7 +117,8 @@
 
     private ProcessThread processThreads[];
 
-    private ThreadGroup processThreadGroup = new ThreadGroup("AsyncProcess Threads");
+    private ThreadGroup processThreadGroup = new ThreadGroup(
+        "AsyncProcess Threads");
 
     long claimTimeout = 30000;
 
@@ -122,31 +128,45 @@
 
     private static final Logger log = Logger.getLogger(DefaultAsyncProcessor.class);
 
-    public DefaultAsyncProcessor() {
+    public DefaultAsyncProcessor()
+    {
         try {
-//            props.load(this.getClass().getResourceAsStream("DefaultProcessor.properties"))
-            claimTimeout = Long.parseLong((StringUtil.notNull(Setup.getValue("default", "AsyncClaimTimeout")).length() != 0)
-                    ? Setup.getValue("default", "AsyncClaimTimeout") : "30000");
+//            props.load(this.getClass()
+//            .getResourceAsStream("DefaultProcessor.properties"))
+            claimTimeout = Long.parseLong((StringUtil.notNull(Setup.getValue(
+                "default", "AsyncClaimTimeout")).length() != 0)
+                ?
+                Setup.getValue("default", "AsyncClaimTimeout") :
+                "30000");
 //            claimTimeout = Long.parseLong(
 //                props.getProperty("claimTimeout","30000").trim());
 
-            numThreads = Integer.parseInt((StringUtil.notNull(Setup.getValue("default", "AsyncNumThreads")).length() != 0)
-                    ? Setup.getValue("default", "AsyncNumThreads") : "10");
+            numThreads = Integer.parseInt((StringUtil.notNull(Setup.getValue(
+                "default", "AsyncNumThreads")).length() != 0)
+                ?
+                Setup.getValue("default", "AsyncNumThreads") :
+                "10");
 //            numThreads = Integer.parseInt(props.getProperty("numThreads","10").trim());
 
-            queueSize = Integer.parseInt((StringUtil.notNull(Setup.getValue("default", "AsyncQueueSize")).length() != 0)
-                    ? Setup.getValue("default", "AsyncQueueSize") : "20");
+            queueSize = Integer.parseInt((StringUtil.notNull(Setup.getValue(
+                "default", "AsyncQueueSize")).length() != 0)
+                ?
+                Setup.getValue("default", "AsyncQueueSize") :
+                "20");
 
 //            queueSize = Integer.parseInt(props.getProperty("queueSize","20").trim());
         } catch (DBException ex) {
             log.error("Error loading properties", ex);
         } catch (NumberFormatException ex) {
-            log.error("Error parsing setup values for Async processor. Has this DB gone through initial setup? Using default values instead.");
+            log.error("Error parsing setup values for Async processor. "
+                +"Has this DB gone through initial setup? Using default "
+                +"values instead.");
         }
 
         processThreads = new ProcessThread[numThreads];
         for (int i = 0; i < numThreads; i++) {
-            processThreads[i] = new ProcessThread(this, processThreadGroup, "Processor" + i);
+            processThreads[i] = new ProcessThread(this, processThreadGroup,
+                "Processor" + i);
         }
 
         if (log.isInfoEnabled()) {
@@ -161,30 +181,38 @@
     /**
      * Destroys all threads;
      */
-    public synchronized void destroy() {
+    public synchronized void destroy()
+    {
         for (int i = 0; i < numThreads; i++) {
             Thread aThread = processThreads[i];
-            if (aThread != null) aThread.interrupt();
+            if (aThread != null) {
+                aThread.interrupt();
+            }
         }
 
         for (int i = 0; i < numThreads; i++) {
             Thread aThread = processThreads[i];
             if (aThread != null) {
                 try {
-                    if (aThread != null) aThread.join(1000);
+                    if (aThread != null) {
+                        aThread.join(1000);
+                    }
                 } catch (InterruptedException ex) {
                     log.info("Interrupted while waiting for process thread", ex);
                 }
 
                 if (aThread.isAlive()) {
-                    log.warn("After waiting a second, the process thread: " + aThread.getName()
-                            + " has still not exited");
+                    log.warn("After waiting a second, the process thread: " +
+                        aThread.getName()
+                        + " has still not exited");
                 }
             }
         }
 
         processThreads = null;
-        if ( processThreadGroup != null ) processThreadGroup.destroy();
+        if (processThreadGroup != null) {
+            processThreadGroup.destroy();
+        }
     }
 
     /**
@@ -195,9 +223,11 @@
      * @throws QueueFullException if there are too many jobs waiting.
      */
     public synchronized AsyncTicket addToQueue(AsyncProcess newProcess)
-            throws QueueFullException {
+        throws QueueFullException
+    {
         if (processThreads == null) {
-            throw new IllegalStateException("Async Processor has already shut down");
+            throw new IllegalStateException(
+                "Async Processor has already shut down");
         }
 
         nextIssuedTicket++;
@@ -212,8 +242,10 @@
 
         synchronized (waitQueue) {
             if (waitQueue.size() > queueSize) {
-                throw new QueueFullException("Queue already has " + waitQueue.size()
-                        + " processes waiting. Cannot continue");
+                throw new QueueFullException("Queue already has " +
+                    waitQueue.size()
+                    +
+                    " processes waiting. Cannot continue");
             }
 
             waitQueue.addLast(wrapper);
@@ -235,7 +267,8 @@
      */
 
     public AsyncTicket addToQueue(AsyncProcess newProcess, long waitTimeout)
-            throws QueueFullException {
+        throws QueueFullException
+    {
 
         AsyncTicket ticket = addToQueue(newProcess);
         synchronized (newProcess) {
@@ -253,9 +286,10 @@
                 return null;
             }
 
-            if (wrapper.getResult().getStatusCode() == AsyncProcessResult.STATUS_COMPLETE) {
+            if (wrapper.getResult().getStatusCode() ==
+                AsyncProcessResult.STATUS_COMPLETE) {
                 this.getProcessResult(ticket);
-                return new DefaultTicket(-1);
+                return new DefaultTicket( -1);
             }
         }
 
@@ -269,7 +303,8 @@
      * @param ticketId the Async ticket to redeem
      * @return ProcessWrapper or null if it doesn't exist.
      */
-    private ProcessWrapper getProcessWrapper(AsyncTicket ticketId) {
+    private ProcessWrapper getProcessWrapper(AsyncTicket ticketId)
+    {
         ProcessWrapper wrapper = (ProcessWrapper) allProcesses.get(ticketId);
         if (wrapper == null) {
             return null;
@@ -283,7 +318,8 @@
      *
      * @return java.util.LinkedList
      */
-    LinkedList getQueue() {
+    LinkedList getQueue()
+    {
         return waitQueue;
     }
 
@@ -310,7 +346,8 @@
      * @author Michael Rimov
      * @version $Revision$ on  $Date$
      */
-    class ProcessWrapper {
+    class ProcessWrapper
+    {
         private AsyncProcess wrappedObject;
 
         DefaultTicket objectId;
@@ -323,28 +360,47 @@
 
         long completedTime;
 
+        private String defaultDataContext;
+
+        private User defaultUser;
+
         public ProcessWrapper(AsyncProcess objectToWrap,
-                              DefaultTicket newObjectId) {
+            DefaultTicket newObjectId)
+        {
             queueTime = System.currentTimeMillis();
             wrappedObject = objectToWrap;
             objectId = newObjectId;
             result = new DefaultProcessResult();
             result.setOriginalProcess(objectToWrap);
+
+            //This object is created in one thread and run in another
+            //So we propagate the thread capabilities.
+            defaultDataContext = RequestRegistry.getDataContext();
+            defaultUser = RequestRegistry.getUser();
         }
 
-        public AsyncProcess getWrappedObject() {
+        public AsyncProcess getWrappedObject()
+        {
             return wrappedObject;
         }
 
-        public DefaultProcessResult getResult() {
+        public DefaultProcessResult getResult()
+        {
             return result;
         }
 
+
+
         /**
          * Do the actual processing.  Any exceptions are caught and saved
          * in the process object itself and status fault is set.
          */
-        public void process() {
+        public void process()
+        {
+            //Set the context for this thread to be that of the
+            //spawning thread.
+            new MutableRequestRegistry(defaultDataContext,defaultUser);
+
             startTime = System.currentTimeMillis();
             this.getResult().setStatusCode(AsyncProcessResult.STATUS_RUNNING);
             try {
@@ -372,36 +428,43 @@
             System.gc();
         }
 
-        public long getQueueTime() {
+        public long getQueueTime()
+        {
             return queueTime;
         }
 
-        public long getCompletedTime() {
+        public long getCompletedTime()
+        {
             return completedTime;
         }
 
-        public DefaultTicket getObjectId() {
+        public DefaultTicket getObjectId()
+        {
             return objectId;
         }
 
     }
 
+
     /**
      * Retrieve the result of the process
      *
      * @param ticketId the ticket id of the process
      * @return java.lang.Object
      */
-    public AsyncProcessResult getProcessResult(AsyncTicket ticketId) {
+    public AsyncProcessResult getProcessResult(AsyncTicket ticketId)
+    {
         synchronized (allProcesses) {
             ProcessWrapper wrapper = getProcessWrapper(ticketId);
 
             if (wrapper == null) {
-                log.warn("Error getting process wrapper for ticket: " + ticketId.toString());
+                log.warn("Error getting process wrapper for ticket: " +
+                    ticketId.toString());
                 return null;
             }
 
-            if (wrapper.getResult().getStatusCode() == AsyncProcessResult.STATUS_COMPLETE) {
+            if (wrapper.getResult().getStatusCode() ==
+                AsyncProcessResult.STATUS_COMPLETE) {
                 allProcesses.remove(ticketId);
             }
 
@@ -419,18 +482,22 @@
      *                    returning.
      * @return AsyncProcessResult
      */
-    public AsyncProcessResult getProcessResult(AsyncTicket ticketId, long waitTimeout) {
+    public AsyncProcessResult getProcessResult(AsyncTicket ticketId,
+        long waitTimeout)
+    {
         ProcessWrapper wrapper;
 
         synchronized (allProcesses) {
             wrapper = getProcessWrapper(ticketId);
 
             if (wrapper == null) {
-                log.warn("Didn't get a process warpper for ticket: " + ticketId.toString());
+                log.warn("Didn't get a process warpper for ticket: " +
+                    ticketId.toString());
                 return null;
             }
 
-            if (wrapper.getResult().getStatusCode() == AsyncProcessResult.STATUS_COMPLETE) {
+            if (wrapper.getResult().getStatusCode() ==
+                AsyncProcessResult.STATUS_COMPLETE) {
                 allProcesses.remove(ticketId);
                 return wrapper.getResult();
             }
@@ -446,11 +513,11 @@
         }
 
         if (wrapper.getResult().getStatusCode()
-                == AsyncProcessResult.STATUS_COMPLETE) {
+            == AsyncProcessResult.STATUS_COMPLETE) {
             allProcesses.remove(ticketId);
         }
 
         return wrapper.getResult();
     }
 
-}
\ No newline at end of file
+}
Index: AsyncProcessor.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/services/asyncprocess/AsyncProcessor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/services/asyncprocess/AsyncProcessor.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/services/asyncprocess/AsyncProcessor.java -u -r1.3 -r1.4
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/services/asyncprocess/AsyncProcessor.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/services/asyncprocess/AsyncProcessor.java
@@ -118,6 +118,9 @@
     /**
      * Add an asynchronous process ot the queue
      * @param newProcess the process to add to the queue
+     * @param waitTimeout the time in milliseconds to wait before
+     * returning.  Will return 'completeed' if that occurs before
+     * the timeout is reached.
      * @return AsyncTicket object for use in reeming the process' status.
      * @throws QueueFullException if there are too many jobs waiting.
      */
Index: CronDaemon.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/services/crontab/CronDaemon.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/services/crontab/CronDaemon.java -Lexpresso-web/WEB-INF/src/com/jcorporate/expresso/services/crontab/CronDaemon.java -u -r1.10 -r1.11
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/services/crontab/CronDaemon.java
+++ expresso-web/WEB-INF/src/com/jcorporate/expresso/services/crontab/CronDaemon.java
@@ -64,6 +64,9 @@
 
 package com.jcorporate.expresso.services.crontab;
 
+import com.jcorporate.expresso.core.security.SuperUser;
+import com.jcorporate.expresso.core.registry.MutableRequestRegistry;
+
 
 /**
  * This class provides the thread for listening on various crontabs.  It notifies
@@ -113,6 +116,9 @@
     }
 
     public synchronized void run() {
+        //Set registry context.
+        new MutableRequestRegistry("default",SuperUser.SUPER_USER);
+
         while (!shutdown) {
             try {
 


More information about the cvs mailing list