You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2014/08/26 13:14:15 UTC

svn commit: r1620571 - /ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java

Author: jacopoc
Date: Tue Aug 26 11:14:15 2014
New Revision: 1620571

URL: http://svn.apache.org/r1620571
Log:
Small optimization: instead of calling the InetAddress.getLocalHost() method every time a ServerHitBin record is created, use the address provided by VisitHandler.

Modified:
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.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=1620571&r1=1620570&r2=1620571&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:14:15 2014
@@ -577,17 +577,9 @@ public class ServerHitBin {
                     serverHitBin.set("minTimeMillis", Long.valueOf(this.minTime));
                     serverHitBin.set("maxTimeMillis", Long.valueOf(this.maxTime));
                     // get localhost ip address and hostname to store
-                    try {
-                        InetAddress address = InetAddress.getLocalHost();
-
-                        if (address != null) {
-                            serverHitBin.set("serverIpAddress", address.getHostAddress());
-                            serverHitBin.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) {
+                        serverHitBin.set("serverIpAddress", VisitHandler.address.getHostAddress());
+                        serverHitBin.set("serverHostName", VisitHandler.address.getHostName());
                     }
                     try {
                         delegator.createSetNextSeqId(serverHitBin);