You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by ag...@apache.org on 2006/10/12 21:46:39 UTC

svn commit: r463394 - in /incubator/roller/trunk/src/org/apache/roller: business/ThreadManagerImpl.java model/ThreadManager.java

Author: agilliland
Date: Thu Oct 12 12:46:39 2006
New Revision: 463394

URL: http://svn.apache.org/viewvc?view=rev&rev=463394
Log:
code reformatting.


Modified:
    incubator/roller/trunk/src/org/apache/roller/business/ThreadManagerImpl.java
    incubator/roller/trunk/src/org/apache/roller/model/ThreadManager.java

Modified: incubator/roller/trunk/src/org/apache/roller/business/ThreadManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/ThreadManagerImpl.java?view=diff&rev=463394&r1=463393&r2=463394
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/ThreadManagerImpl.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/business/ThreadManagerImpl.java Thu Oct 12 12:46:39 2006
@@ -1,109 +1,108 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-*  contributor license agreements.  The ASF licenses this file to You
-* under the Apache License, Version 2.0 (the "License"); you may not
-* use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.  For additional information regarding
-* copyright in this work, please see the NOTICE file in the top level
-* directory of this distribution.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
 package org.apache.roller.business;
 
 import EDU.oswego.cs.dl.util.concurrent.BoundedBuffer;
 import EDU.oswego.cs.dl.util.concurrent.DirectExecutor;
 import EDU.oswego.cs.dl.util.concurrent.PooledExecutor;
 import EDU.oswego.cs.dl.util.concurrent.ThreadFactory;
-
 import java.util.Date;
 import java.util.Timer;
 import java.util.TimerTask;
-
 import org.apache.roller.model.ThreadManager;
 import org.apache.roller.util.DateUtil;
 
+
 /**
  * Manage Roller's background thread use. Currently, Roller starts background
  * threads for two purposes: 1) the nightly purge of referer counts and 2)
  * following linkbacks (only occurs if linkbacks are enabled).
- *
- * @author aim4min
  */
-public class ThreadManagerImpl implements ThreadManager
-{
+public class ThreadManagerImpl implements ThreadManager {
+    
     private PooledExecutor backgroundExecutor;
     private DirectExecutor nodelayExecutor;
     private Timer scheduler;
-
-    public ThreadManagerImpl()
-    {
+    
+    
+    public ThreadManagerImpl() {
         backgroundExecutor = new PooledExecutor(new BoundedBuffer(10), 25);
         backgroundExecutor.setMinimumPoolSize(4);
         backgroundExecutor.setKeepAliveTime(1000 * 60 * 5);
         backgroundExecutor.waitWhenBlocked();
         backgroundExecutor.createThreads(9);
-
+        
         backgroundExecutor.setThreadFactory(new ThreadFactory() {
-            public Thread newThread(Runnable command)
-            {
+            public Thread newThread(Runnable command) {
                 Thread t = new Thread(command);
                 t.setDaemon(false);
                 t.setName("Background Execution Threads");
                 t.setPriority(Thread.NORM_PRIORITY);
-
+                
                 return t;
             }
         });
-
+        
         nodelayExecutor = new DirectExecutor();
         scheduler = new Timer(true);
     }
-
+    
+    
     public void executeInBackground(Runnable runnable)
-            throws InterruptedException
-    {
+            throws InterruptedException {
         backgroundExecutor.execute(runnable);
     }
-
+    
+    
     public void executeInForeground(Runnable runnable)
-            throws InterruptedException
-    {
+            throws InterruptedException {
         nodelayExecutor.execute(runnable);
     }
-
-    public void scheduleDailyTimerTask(TimerTask task)
-    {
+    
+    
+    public void scheduleDailyTimerTask(TimerTask task) {
         scheduler.scheduleAtFixedRate(task,
                 DateUtil.getEndOfDay(new Date()), DateUtil.millisInDay);
     }
-
-    public void scheduleHourlyTimerTask(TimerTask task)
-    {
+    
+    
+    public void scheduleHourlyTimerTask(TimerTask task) {
         scheduler.scheduleAtFixedRate(task, new Date(), 60*60*1000);
     }
-
+    
+    
     public void scheduleFixedRateTimerTask(TimerTask task, long delayMins, long periodMins) {
         if (periodMins < MIN_RATE_INTERVAL_MINS) {
             throw new IllegalArgumentException("Period (" + periodMins +
-                ") shorter than minimum allowed (" + MIN_RATE_INTERVAL_MINS + ")");
+                    ") shorter than minimum allowed (" + MIN_RATE_INTERVAL_MINS + ")");
         }
         scheduler.scheduleAtFixedRate(task, delayMins * 60 * 1000, periodMins * 60 * 1000);
     }
-
-    public void shutdown()
-    {
+    
+    
+    public void shutdown() {
         backgroundExecutor.shutdownAfterProcessingCurrentlyQueuedTasks();
         scheduler.cancel();
     }
-
-    public void release()
-    {
+    
+    
+    public void release() {
     }
-}
\ No newline at end of file
+    
+}

Modified: incubator/roller/trunk/src/org/apache/roller/model/ThreadManager.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/model/ThreadManager.java?view=diff&rev=463394&r1=463393&r2=463394
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/model/ThreadManager.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/model/ThreadManager.java Thu Oct 12 12:46:39 2006
@@ -1,68 +1,78 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-*  contributor license agreements.  The ASF licenses this file to You
-* under the Apache License, Version 2.0 (the "License"); you may not
-* use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.  For additional information regarding
-* copyright in this work, please see the NOTICE file in the top level
-* directory of this distribution.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+
 package org.apache.roller.model;
 
 import java.util.TimerTask;
 import java.sql.Date;
 
+
 /**
  * Thread management for executing scheduled and asynchronous tasks.
  */
-public interface ThreadManager
-{
+public interface ThreadManager {
+    
     public static final long MIN_RATE_INTERVAL_MINS = 1;
-
+    
+    
     /**
      * Execute runnable in background (asynchronously).
-     * @param runnable 
-     * @throws java.lang.InterruptedException 
+     * @param runnable
+     * @throws java.lang.InterruptedException
      */
     public void executeInBackground(Runnable runnable)
-            throws InterruptedException;
-
+        throws InterruptedException;
+    
+    
     /**
      * Execute runnable in foreground (synchronously).
      */
     public void executeInForeground(Runnable runnable)
-            throws InterruptedException;
-
+        throws InterruptedException;
+    
+    
     /**
      * Schedule task to run once a day.
      */
     public void scheduleDailyTimerTask(TimerTask task);
-
+    
+    
     /**
      * Schedule task to run once per hour.
      */
     public void scheduleHourlyTimerTask(TimerTask task);
-
+    
+    
     /**
      * Schedule task to run at fixed rate.
      */
     public void scheduleFixedRateTimerTask(TimerTask task, long delayMins, long periodMins);
-
+    
+    
     /**
-     * Shutdown
+     * Shutdown.
      */
     public void shutdown();
-
+    
+    
     /**
      * Release all resources associated with Roller session.
      */
     public void release();
+    
 }