manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1433904 - in /manifoldcf/trunk: CHANGES.txt connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/HttpPoster.java connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/SolrConnector.java
Date Wed, 16 Jan 2013 11:32:43 GMT
Author: kwright
Date: Wed Jan 16 11:32:42 2013
New Revision: 1433904

URL: http://svn.apache.org/viewvc?rev=1433904&view=rev
Log:
Fix for CONNECTORS-614.

Modified:
    manifoldcf/trunk/CHANGES.txt
    manifoldcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/HttpPoster.java
    manifoldcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/SolrConnector.java

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1433904&r1=1433903&r2=1433904&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Wed Jan 16 11:32:42 2013
@@ -5,6 +5,9 @@ $Id$
 
 ======================= Release 1.1 =====================
 
+CONNECTORS-614: Solr connection release not working right.
+(Karl Wright)
+
 CONNECTORS-582: Upgrade to official httpcomponents 4.2.3
 release.
 (Karl Wright)

Modified: manifoldcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/HttpPoster.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/HttpPoster.java?rev=1433904&r1=1433903&r2=1433904&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/HttpPoster.java
(original)
+++ manifoldcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/HttpPoster.java
Wed Jan 16 11:32:42 2013
@@ -250,14 +250,6 @@ public class HttpPoster
     solrServer = httpSolrServer;
   }
 
-  /** Poll the poster.
-  */
-  public void poll()
-  {
-    if (connectionManager != null)
-      connectionManager.closeIdleConnections(60000L,TimeUnit.MILLISECONDS);
-  }
-  
   /** Shut down the poster.
   */
   public void shutdown()

Modified: manifoldcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/SolrConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/SolrConnector.java?rev=1433904&r1=1433903&r2=1433904&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/SolrConnector.java
(original)
+++ manifoldcf/trunk/connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/SolrConnector.java
Wed Jan 16 11:32:42 2013
@@ -41,6 +41,9 @@ public class SolrConnector extends org.a
   /** Local connection */
   protected HttpPoster poster = null;
   
+  /** Expiration */
+  protected long expirationTime = -1L;
+  
   /** The allow attribute name */
   protected String allowAttributeName = "allow_token_";
   /** The deny attribute name */
@@ -59,6 +62,9 @@ public class SolrConnector extends org.a
   /** Whether or not to commit */
   protected boolean doCommits = false;
   
+  /** Idle connection expiration interval */
+  protected final static long EXPIRATION_INTERVAL = 300000L;
+  
   /** Constructor.
   */
   public SolrConnector()
@@ -93,7 +99,15 @@ public class SolrConnector extends org.a
     throws ManifoldCFException
   {
     if (poster != null)
-      poster.poll();
+    {
+      if (expirationTime <= System.currentTimeMillis())
+      {
+        // Expire connection
+        poster.shutdown();
+        poster = null;
+        expirationTime = -1L;
+      }
+    }
   }
 
   /** Close the connection.  Call this before discarding the connection.
@@ -103,8 +117,11 @@ public class SolrConnector extends org.a
     throws ManifoldCFException
   {
     if (poster != null)
+    {
       poster.shutdown();
-    poster = null;
+      poster = null;
+      expirationTime = -1L;
+    }
     maxDocumentLength = null;
     includedMimeTypesString = null;
     includedMimeTypes = null;
@@ -301,6 +318,7 @@ public class SolrConnector extends org.a
         throw new ManifoldCFException("Illegal value for parameter '"+SolrConfig.PARAM_SOLR_TYPE+"':
'"+solrType+"'");
       
     }
+    expirationTime = System.currentTimeMillis() + EXPIRATION_INTERVAL;
   }
 
   /** Parse a mime type field into individual mime types in a hash */



Mime
View raw message