roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r470615 - /incubator/roller/trunk/src/org/apache/roller/business/pings/PingQueueProcessor.java
Date Fri, 03 Nov 2006 00:25:01 GMT
Author: agilliland
Date: Thu Nov  2 16:25:00 2006
New Revision: 470615

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


Modified:
    incubator/roller/trunk/src/org/apache/roller/business/pings/PingQueueProcessor.java

Modified: incubator/roller/trunk/src/org/apache/roller/business/pings/PingQueueProcessor.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/pings/PingQueueProcessor.java?view=diff&rev=470615&r1=470614&r2=470615
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/pings/PingQueueProcessor.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/business/pings/PingQueueProcessor.java Thu
Nov  2 16:25:00 2006
@@ -16,22 +16,20 @@
  * directory of this distribution.
  */
 
-
 package org.apache.roller.business.pings;
 
+import java.util.Iterator;
+import java.util.List;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.RollerException;
+import org.apache.roller.business.RollerFactory;
 import org.apache.roller.config.PingConfig;
 import org.apache.roller.config.RollerRuntimeConfig;
-import org.apache.roller.business.pings.PingQueueManager;
-import org.apache.roller.business.RollerFactory;
 import org.apache.roller.pojos.PingQueueEntryData;
 import org.apache.roller.pojos.PingTargetData;
 import org.apache.roller.pojos.WebsiteData;
 
-import java.util.Iterator;
-import java.util.List;
 
 /**
  * Ping Queue Processor.  Singleton encapsulating logic for processing the weblog update
ping queue.
@@ -39,21 +37,24 @@
  * @author <a href="mailto:anil@busybuddha.org">Anil Gangolli</a>
  */
 public class PingQueueProcessor {
+    
     private static final Log logger = LogFactory.getLog(PingQueueProcessor.class);
-
+    
     private static PingQueueProcessor theInstance;
-
-
+    
     private PingQueueManager pingQueueMgr;
-
+    
+    
     public static PingQueueProcessor getInstance() {
         return theInstance;
     }
-
+    
+    
     private PingQueueProcessor() throws RollerException {
         pingQueueMgr = RollerFactory.getRoller().getPingQueueManager();
     }
-
+    
+    
     /**
      * Initialize the singleton.  This is called during <code>RollerContext</code>
initialization.
      *
@@ -67,7 +68,8 @@
         theInstance = new PingQueueProcessor();
         if (logger.isDebugEnabled()) logger.debug("Ping queue processor initialized.");
     }
-
+    
+    
     /**
      * Process the ping queue.  Performs one pass through the ping queue, processing every
entry once.  On ping failure
      * an entry is requeued for processing on subsequent passes until the configured maximum
number of attempts is
@@ -78,23 +80,23 @@
             logger.info("Ping processing has been suspended.  Skipping current round of ping
queue processing.");
             return;
         }
-
+        
         String absoluteContextUrl = RollerRuntimeConfig.getAbsoluteContextURL();
         if (absoluteContextUrl == null) {
             logger.warn("WARNING: Skipping current ping queue processing round because we
cannot yet determine the site's absolute context url.");
             return;
         }
-
+        
         // TODO: Group by ping target and ping all sites for that target?
         // We're currently not taking advantage of grouping by ping target site and then
sending
         // all of the pings for that target at once.  If it becomes an efficiency issue,
we should do
         // that.
-
+        
         try {
             if (logger.isDebugEnabled()) logger.debug("Started processing ping queue.");
             // Get all of the entries
             List entries = pingQueueMgr.getAllQueueEntries();
-
+            
             // Process each entry
             for (Iterator i = entries.iterator(); i.hasNext();) {
                 PingQueueEntryData pingQueueEntry = (PingQueueEntryData) i.next();
@@ -105,7 +107,8 @@
             logger.error("Unexpected exception processing ping queue!  Aborting this pass
of ping queue processing.", ex);
         }
     }
-
+    
+    
     /**
      * Process an individual ping queue entry.
      *
@@ -115,7 +118,7 @@
      */
     private void processQueueEntry(PingQueueEntryData pingQueueEntry) throws RollerException
{
         if (logger.isDebugEnabled()) logger.debug("Processing ping queue entry: " + pingQueueEntry);
-
+        
         PingTargetData pingTarget = pingQueueEntry.getPingTarget();
         WebsiteData website = pingQueueEntry.getWebsite();
         boolean pingSucceeded = false;
@@ -142,7 +145,8 @@
             pingQueueMgr.removeQueueEntry(pingQueueEntry);
         }
     }
-
+    
+    
     /**
      * Handle any ping error.
      *
@@ -150,9 +154,11 @@
      * @param ex             the exception that occurred on the ping attempt
      * @throws RollerException
      */
-    private void handlePingError(PingQueueEntryData pingQueueEntry, Exception ex) throws
RollerException {
-        if ((pingQueueEntry.incrementAttempts() < PingConfig.getMaxPingAttempts()) &&
WeblogUpdatePinger.shouldRetry(ex))
-        {
+    private void handlePingError(PingQueueEntryData pingQueueEntry,
+            Exception ex)
+            throws RollerException {
+        
+        if ((pingQueueEntry.incrementAttempts() < PingConfig.getMaxPingAttempts()) &&
WeblogUpdatePinger.shouldRetry(ex)) {
             // We have attempts remaining, and it looks like we should retry,
             // so requeue the entry for processing on subsequent rounds
             logger.warn("Error on ping attempt (" + pingQueueEntry.getAttempts() + ") for
" + pingQueueEntry + ": [" + ex.getMessage() + "]. Will re-queue for later attempts.");
@@ -166,6 +172,5 @@
             // TODO: mark ping target invalid?
         }
     }
-
-
+    
 }



Mime
View raw message