Author: jacopoc
Date: Tue Aug 26 11:02:05 2014
New Revision: 1620567
URL:
http://svn.apache.org/r1620567Log:
Small optimization: instead of calling the InetAddress.getLocalHost() method every time a ServerHit is created, use the address provided by VisitHandler.
Modified:
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java
Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java?rev=1620567&r1=1620566&r2=1620567&view=diff==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java Tue Aug 26 11:02:05 2014
@@ -679,17 +679,9 @@ public class ServerHitBin {
serverHit.set("referrerUrl", referrerUrl.length() > 250 ? referrerUrl.substring(0, 250) : referrerUrl);
// get localhost ip address and hostname to store
- try {
- InetAddress address = InetAddress.getLocalHost();
-
- if (address != null) {
- serverHit.set("serverIpAddress", address.getHostAddress());
- serverHit.set("serverHostName", address.getHostName());
- } else {
- Debug.logError("Unable to get localhost internet address, was null", module);
- }
- } catch (java.net.UnknownHostException e) {
- Debug.logError("Unable to get localhost internet address: " + e.toString(), module);
+ if (VisitHandler.address != null) {
+ serverHit.set("serverIpAddress", VisitHandler.address.getHostAddress());
+ serverHit.set("serverHostName", VisitHandler.address.getHostName());
}
// The problem with
Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java?rev=1620567&r1=1620566&r2=1620567&view=diff==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java Tue Aug 26 11:02:05 2014
@@ -45,7 +45,7 @@ public class VisitHandler {
public static final String visitorCookieName = "OFBiz.Visitor";
- private static final InetAddress address;
+ protected static final InetAddress address;
static {
InetAddress tmpAddress = null;
try {