SOLR-1517: only do reverse DNS lookup of localhost once in a static block

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@826965 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2009-10-20 05:57:14 +00:00
parent b1e21e7041
commit 9b1b5e9206
2 changed files with 21 additions and 8 deletions

View File

@ -632,6 +632,11 @@ Bug Fixes
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)

View File

@ -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 = "";
{