| 
      
      
      From: <bi...@us...> - 2010-02-22 22:20:51
      
     | 
| Revision: 2964
          http://archive-access.svn.sourceforge.net/archive-access/?rev=2964&view=rev
Author:   binzino
Date:     2010-02-22 22:20:45 +0000 (Mon, 22 Feb 2010)
Log Message:
-----------
Added use of namespace when processing 'score' elements.  Fixed timeout handling to allow for unlimited timeout.
Modified Paths:
--------------
    trunk/archive-access/projects/nutchwax/archive/src/java/org/archive/nutchwax/OpenSearchMaster.java
Modified: trunk/archive-access/projects/nutchwax/archive/src/java/org/archive/nutchwax/OpenSearchMaster.java
===================================================================
--- trunk/archive-access/projects/nutchwax/archive/src/java/org/archive/nutchwax/OpenSearchMaster.java	2010-02-22 22:19:42 UTC (rev 2963)
+++ trunk/archive-access/projects/nutchwax/archive/src/java/org/archive/nutchwax/OpenSearchMaster.java	2010-02-22 22:20:45 UTC (rev 2964)
@@ -93,7 +93,7 @@
         slaveThreads.add( sqt );        
       }
 
-    waitForThreads( slaveThreads, this.timeout, startTime );
+    waitForThreads( slaveThreads, this.timeout );
 
     LinkedList<Element> items = new LinkedList<Element>( );
     long totalResults = 0;
@@ -192,22 +192,13 @@
    * Convenience method to wait for a collection of threads to complete,
    * or until a timeout after a startTime expires.
    */
-  private void waitForThreads( List<SlaveQueryThread> threads, long timeout, long startTime )
+  private void waitForThreads( List<SlaveQueryThread> threads, long timeout )
   {
     for ( Thread t : threads )
       {
-        long timeRemaining = timeout - (System.currentTimeMillis( ) - startTime);
-        
-        // If we are out of time, don't wait for any more threads.
-        if ( timeRemaining <= 0 )
-          {
-            break; 
-          }
-        
-        // Otherwise, wait for the next unfinished thread to finish.
         try
           {
-            t.join( timeRemaining );
+            t.join( timeout );
           }
         catch ( InterruptedException ie ) 
           {
@@ -320,8 +311,8 @@
     if ( e1 == null ) return 1;
     if ( e2 == null ) return -1;
 
-    Element score1 = e1.getChild( "score" );
-    Element score2 = e2.getChild( "score" );
+    Element score1 = e1.getChild( "score", Namespace.getNamespace( "http://www.nutch.org/opensearchrss/1.0/" )  );
+    Element score2 = e2.getChild( "score", Namespace.getNamespace( "http://www.nutch.org/opensearchrss/1.0/" )  );
 
     if ( score1 == score2 ) return 0;
     if ( score1 == null )   return 1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |