Author: jacopoc
Date: Tue Aug 26 11:14:15 2014
New Revision: 1620571
URL:
http://svn.apache.org/r1620571Log:
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);