Author: hossman
Date: Tue Oct 20 05:57:14 2009
New Revision: 826965
URL: http://svn.apache.org/viewvc?rev=826965&view=rev
Log:
SOLR-1517: only do reverse DNS lookup of localhost once in a static block
Modified:
lucene/solr/trunk/CHANGES.txt
lucene/solr/trunk/src/webapp/web/admin/_info.jsp
Modified: lucene/solr/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/lucene/solr/trunk/CHANGES.txt?rev=826965&r1=826964&r2=826965&view=diff
==============================================================================
--- lucene/solr/trunk/CHANGES.txt (original)
+++ lucene/solr/trunk/CHANGES.txt Tue Oct 20 05:57:14 2009
@@ -632,6 +632,11 @@
often calculated offsets incorrectly for entities.
(Anders Melchiorsen via yonik)
+74. SOLR-1517: Admin pages could stall waiting for localhost name resolution
+ if reverse DNS wasn't configured; this was changed so the DNS resolution
+ is attempted only once the first time an admin page is loaded.
+ (hossman)
+
Other Changes
----------------------
1. Upgraded to Lucene 2.4.0 (yonik)
Modified: lucene/solr/trunk/src/webapp/web/admin/_info.jsp
URL:
http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/web/admin/_info.jsp?rev=826965&r1=826964&r2=826965&view=diff
==============================================================================
--- lucene/solr/trunk/src/webapp/web/admin/_info.jsp (original)
+++ lucene/solr/trunk/src/webapp/web/admin/_info.jsp Tue Oct 20 05:57:14 2009
@@ -25,6 +25,22 @@
<%@ page import="org.apache.solr.common.SolrException"%>
<%@ page import="org.apache.lucene.LucenePackage"%>
<%@ page import="java.net.UnknownHostException" %>
+
+<%!
+ // only try to figure out the hostname once in a static block so
+ // we don't have a potentially slow DNS lookup on every admin request
+ static InetAddress addr = null;
+ static String hostname = "unknown";
+ static {
+ try {
+ addr = InetAddress.getLocalHost();
+ hostname = addr.getCanonicalHostName();
+ } catch (UnknownHostException e) {
+ //default to unknown
+ }
+ }
+%>
+
<%
//
SolrCore core = (SolrCore) request.getAttribute("org.apache.solr.SolrCore");
@@ -48,14 +64,6 @@
}
String collectionName = schema!=null ? schema.getName():"unknown";
- InetAddress addr = null;
- String hostname = "unknown";
- try {
- addr = InetAddress.getLocalHost();
- hostname = addr.getCanonicalHostName();
- } catch (UnknownHostException e) {
- //default to unknown
- }
String defaultSearch = "";
{