KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ofbiz > webapp > stats > ServerHitBin


1 /*
2  * $Id: ServerHitBin.java 5462 2005-08-05 18:35:48Z jonesde $
3  *
4  * Copyright (c) 2001-2003 The Open For Business Project - www.ofbiz.org
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
21  * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
22  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */

24 package org.ofbiz.webapp.stats;
25
26 import java.net.InetAddress JavaDoc;
27 import java.util.Calendar JavaDoc;
28 import java.util.Date JavaDoc;
29 import java.util.HashMap JavaDoc;
30 import java.util.Iterator JavaDoc;
31 import java.util.LinkedList JavaDoc;
32 import java.util.Map JavaDoc;
33 import javax.servlet.http.HttpServletRequest JavaDoc;
34
35 import org.ofbiz.base.util.Debug;
36 import org.ofbiz.base.util.UtilHttp;
37 import org.ofbiz.base.util.UtilMisc;
38 import org.ofbiz.base.util.UtilProperties;
39 import org.ofbiz.entity.GenericDelegator;
40 import org.ofbiz.entity.GenericEntityException;
41 import org.ofbiz.entity.GenericValue;
42
43 /**
44  * <p>Counts server hits and tracks statistics for request, events and views
45  * <p>Handles total stats since the server started and binned
46  * stats according to settings in the serverstats.properties file.
47  *
48  * @author <a HREF="mailto:jonesde@ofbiz.org">David E. Jones</a>
49  * @version $Rev: 5462 $
50  * @since 2.0
51  */

52 public class ServerHitBin {
53     // Debug module name
54
public static final String JavaDoc module = ServerHitBin.class.getName();
55
56     public static final int REQUEST = 1;
57     public static final int EVENT = 2;
58     public static final int VIEW = 3;
59     public static final int ENTITY = 4;
60     public static final int SERVICE = 5;
61     public static final String JavaDoc[] typeNames = {"", "Request", "Event", "View", "Entity", "Service"};
62     public static final String JavaDoc[] typeIds = {"", "REQUEST", "EVENT", "VIEW", "ENTITY", "SERVICE"};
63
64     public static void countRequest(String JavaDoc id, HttpServletRequest JavaDoc request, long startTime, long runningTime, GenericValue userLogin,
65         GenericDelegator delegator) {
66         countHit(id, REQUEST, request, startTime, runningTime, userLogin, delegator);
67     }
68
69     public static void countEvent(String JavaDoc id, HttpServletRequest JavaDoc request, long startTime, long runningTime, GenericValue userLogin,
70         GenericDelegator delegator) {
71         countHit(id, EVENT, request, startTime, runningTime, userLogin, delegator);
72     }
73
74     public static void countView(String JavaDoc id, HttpServletRequest JavaDoc request, long startTime, long runningTime, GenericValue userLogin,
75         GenericDelegator delegator) {
76         countHit(id, VIEW, request, startTime, runningTime, userLogin, delegator);
77     }
78
79     public static void countEntity(String JavaDoc id, HttpServletRequest JavaDoc request, long startTime, long runningTime, GenericValue userLogin,
80         GenericDelegator delegator) {
81         countHit(id, ENTITY, request, startTime, runningTime, userLogin, delegator);
82     }
83
84     public static void countService(String JavaDoc id, HttpServletRequest JavaDoc request, long startTime, long runningTime, GenericValue userLogin,
85         GenericDelegator delegator) {
86         countHit(id, SERVICE, request, startTime, runningTime, userLogin, delegator);
87     }
88
89     public static void countHit(String JavaDoc id, int type, HttpServletRequest JavaDoc request, long startTime, long runningTime, GenericValue userLogin,
90         GenericDelegator delegator) {
91         // only count hits if enabled, if not specified defaults to false
92
if (!"true".equals(UtilProperties.getPropertyValue("serverstats", "stats.enable." + typeIds[type]))) return;
93         countHit(id, type, request, startTime, runningTime, userLogin, delegator, true);
94     }
95
96     public static void advanceAllBins(long toTime) {
97         advanceAllBins(toTime, requestHistory);
98         advanceAllBins(toTime, eventHistory);
99         advanceAllBins(toTime, viewHistory);
100         advanceAllBins(toTime, entityHistory);
101         advanceAllBins(toTime, serviceHistory);
102     }
103
104     static void advanceAllBins(long toTime, Map JavaDoc binMap) {
105         Iterator JavaDoc entries = binMap.entrySet().iterator();
106
107         while (entries.hasNext()) {
108             Map.Entry JavaDoc entry = (Map.Entry JavaDoc) entries.next();
109
110             if (entry.getValue() != null) {
111                 ServerHitBin bin = (ServerHitBin) entry.getValue();
112
113                 bin.advanceBin(toTime);
114             }
115         }
116     }
117
118     protected static void countHit(String JavaDoc id, int type, HttpServletRequest JavaDoc request, long startTime, long runningTime, GenericValue userLogin,
119         GenericDelegator delegator, boolean isOriginal) {
120         if (delegator == null) {
121             throw new IllegalArgumentException JavaDoc("The delgator passed to countHit cannot be null");
122         }
123
124         ServerHitBin bin = null;
125         LinkedList JavaDoc binList = null;
126
127         switch (type) {
128         case REQUEST:
129             binList = (LinkedList JavaDoc) requestHistory.get(id);
130             break;
131
132         case EVENT:
133             binList = (LinkedList JavaDoc) eventHistory.get(id);
134             break;
135
136         case VIEW:
137             binList = (LinkedList JavaDoc) viewHistory.get(id);
138             break;
139
140         case ENTITY:
141             binList = (LinkedList JavaDoc) entityHistory.get(id);
142             break;
143
144         case SERVICE:
145             binList = (LinkedList JavaDoc) serviceHistory.get(id);
146             break;
147         }
148
149         if (binList == null) {
150             synchronized (ServerHitBin.class) {
151                 switch (type) {
152                 case REQUEST:
153                     binList = (LinkedList JavaDoc) requestHistory.get(id);
154                     break;
155
156                 case EVENT:
157                     binList = (LinkedList JavaDoc) eventHistory.get(id);
158                     break;
159
160                 case VIEW:
161                     binList = (LinkedList JavaDoc) viewHistory.get(id);
162                     break;
163
164                 case ENTITY:
165                     binList = (LinkedList JavaDoc) entityHistory.get(id);
166                     break;
167
168                 case SERVICE:
169                     binList = (LinkedList JavaDoc) serviceHistory.get(id);
170                     break;
171                 }
172                 if (binList == null) {
173                     binList = new LinkedList JavaDoc();
174                     switch (type) {
175                     case REQUEST:
176                         requestHistory.put(id, binList);
177                         break;
178
179                     case EVENT:
180                         eventHistory.put(id, binList);
181                         break;
182
183                     case VIEW:
184                         viewHistory.put(id, binList);
185                         break;
186
187                     case ENTITY:
188                         entityHistory.put(id, binList);
189                         break;
190
191                     case SERVICE:
192                         serviceHistory.put(id, binList);
193                         break;
194                     }
195                 }
196             }
197         }
198
199         if (binList.size() > 0) {
200             bin = (ServerHitBin) binList.getFirst();
201         }
202         if (bin == null) {
203             synchronized (ServerHitBin.class) {
204                 if (binList.size() > 0) {
205                     bin = (ServerHitBin) binList.getFirst();
206                 }
207                 if (bin == null) {
208                     bin = new ServerHitBin(id, type, true, delegator);
209                     binList.addFirst(bin);
210                 }
211             }
212         }
213
214         bin.addHit(startTime, runningTime);
215         if (isOriginal && !"GLOBAL".equals(id)) {
216             bin.saveHit(request, startTime, runningTime, userLogin);
217         }
218
219         // count since start global and per id hits
220
if (!"GLOBAL".equals(id))
221             countHitSinceStart(id, type, startTime, runningTime, isOriginal, delegator);
222
223         // also count hits up the hierarchy if the id contains a '.'
224
if (id.indexOf('.') > 0) {
225             countHit(id.substring(0, id.lastIndexOf('.')), type, request, startTime, runningTime, userLogin, delegator, false);
226         }
227
228         if (isOriginal && !"GLOBAL".equals(id))
229             countHit("GLOBAL", type, request, startTime, runningTime, userLogin, delegator, true);
230     }
231
232     static void countHitSinceStart(String JavaDoc id, int type, long startTime, long runningTime, boolean isOriginal,
233         GenericDelegator delegator) {
234         if (delegator == null) {
235             throw new IllegalArgumentException JavaDoc("The delgator passed to countHitSinceStart cannot be null");
236         }
237
238         ServerHitBin bin = null;
239
240         // save in global, and try to get bin by id
241
switch (type) {
242         case REQUEST:
243             bin = (ServerHitBin) requestSinceStarted.get(id);
244             break;
245
246         case EVENT:
247             bin = (ServerHitBin) eventSinceStarted.get(id);
248             break;
249
250         case VIEW:
251             bin = (ServerHitBin) viewSinceStarted.get(id);
252             break;
253
254         case ENTITY:
255             bin = (ServerHitBin) entitySinceStarted.get(id);
256             break;
257
258         case SERVICE:
259             bin = (ServerHitBin) serviceSinceStarted.get(id);
260             break;
261         }
262
263         if (bin == null) {
264             synchronized (ServerHitBin.class) {
265                 switch (type) {
266                 case REQUEST:
267                     bin = (ServerHitBin) requestSinceStarted.get(id);
268                     break;
269
270                 case EVENT:
271                     bin = (ServerHitBin) eventSinceStarted.get(id);
272                     break;
273
274                 case VIEW:
275                     bin = (ServerHitBin) viewSinceStarted.get(id);
276                     break;
277
278                 case ENTITY:
279                     bin = (ServerHitBin) entitySinceStarted.get(id);
280                     break;
281
282                 case SERVICE:
283                     bin = (ServerHitBin) serviceSinceStarted.get(id);
284                     break;
285                 }
286
287                 if (bin == null) {
288                     bin = new ServerHitBin(id, type, false, delegator);
289                     switch (type) {
290                     case REQUEST:
291                         requestSinceStarted.put(id, bin);
292                         break;
293
294                     case EVENT:
295                         eventSinceStarted.put(id, bin);
296                         break;
297
298                     case VIEW:
299                         viewSinceStarted.put(id, bin);
300                         break;
301
302                     case ENTITY:
303                         entitySinceStarted.put(id, bin);
304                         break;
305
306                     case SERVICE:
307                         serviceSinceStarted.put(id, bin);
308                         break;
309                     }
310                 }
311             }
312         }
313
314         bin.addHit(startTime, runningTime);
315
316         if (isOriginal)
317             countHitSinceStart("GLOBAL", type, startTime, runningTime, false, delegator);
318     }
319
320     // these Maps contain Lists of ServerHitBin objects by id, the most recent is first in the list
321
public static Map JavaDoc requestHistory = new HashMap JavaDoc();
322     public static Map JavaDoc eventHistory = new HashMap JavaDoc();
323     public static Map JavaDoc viewHistory = new HashMap JavaDoc();
324     public static Map JavaDoc entityHistory = new HashMap JavaDoc();
325     public static Map JavaDoc serviceHistory = new HashMap JavaDoc();
326
327     // these Maps contain ServerHitBin objects by id
328
public static Map JavaDoc requestSinceStarted = new HashMap JavaDoc();
329     public static Map JavaDoc eventSinceStarted = new HashMap JavaDoc();
330     public static Map JavaDoc viewSinceStarted = new HashMap JavaDoc();
331     public static Map JavaDoc entitySinceStarted = new HashMap JavaDoc();
332     public static Map JavaDoc serviceSinceStarted = new HashMap JavaDoc();
333
334     GenericDelegator delegator;
335     String JavaDoc delegatorName;
336     String JavaDoc id;
337     int type;
338     boolean limitLength;
339     long startTime;
340     long endTime;
341     long numberHits;
342     long totalRunningTime;
343     long minTime;
344     long maxTime;
345
346     public ServerHitBin(String JavaDoc id, int type, boolean limitLength, GenericDelegator delegator) {
347         super();
348         if (delegator == null) {
349             throw new IllegalArgumentException JavaDoc("The delgator passed to countHitSinceStart cannot be null");
350         }
351
352         this.id = id;
353         this.type = type;
354         this.limitLength = limitLength;
355         this.delegator = delegator;
356         this.delegatorName = delegator.getDelegatorName();
357         reset(getEvenStartingTime());
358     }
359
360     public GenericDelegator getDelegator() {
361         if (this.delegator == null) {
362             this.delegator = GenericDelegator.getGenericDelegator(this.delegatorName);
363         }
364         // if still null, then we have a problem
365
if (this.delegator == null) {
366             throw new IllegalArgumentException JavaDoc("Could not perform stats operation: could not find delegator with name: " + this.delegatorName);
367         }
368         return this.delegator;
369     }
370
371     long getEvenStartingTime() {
372         // binLengths should be a divisable evenly into 1 hour
373
long curTime = System.currentTimeMillis();
374         long binLength = getNewBinLength();
375
376         // find the first previous millis that are even on the hour
377
Calendar JavaDoc cal = Calendar.getInstance();
378
379         cal.setTime(new Date JavaDoc(curTime));
380         cal.set(Calendar.MINUTE, 0);
381         cal.set(Calendar.SECOND, 0);
382         cal.set(Calendar.MILLISECOND, 0);
383
384         while (cal.getTime().getTime() < (curTime - binLength)) {
385             cal.add(Calendar.MILLISECOND, (int) binLength);
386         }
387
388         return cal.getTime().getTime();
389     }
390
391     static long getNewBinLength() {
392         long binLength = (long) UtilProperties.getPropertyNumber("serverstats", "stats.bin.length.millis");
393
394         // if no or 0 binLength specified, set to 30 minutes
395
if (binLength <= 0) binLength = 1800000;
396         // if binLength is more than an hour, set it to one hour
397
if (binLength > 3600000) binLength = 3600000;
398         return binLength;
399     }
400
401     void reset(long startTime) {
402         this.startTime = startTime;
403         if (limitLength) {
404             long binLength = getNewBinLength();
405
406             // subtract 1 millisecond to keep bin starting times even
407
this.endTime = startTime + binLength - 1;
408         } else {
409             this.endTime = 0;
410         }
411         this.numberHits = 0;
412         this.totalRunningTime = 0;
413         this.minTime = Long.MAX_VALUE;
414         this.maxTime = 0;
415     }
416
417     ServerHitBin(ServerHitBin oldBin) {
418         super();
419
420         this.id = oldBin.id;
421         this.type = oldBin.type;
422         this.limitLength = oldBin.limitLength;
423         this.delegator = oldBin.delegator;
424         this.delegatorName = oldBin.delegatorName;
425         this.startTime = oldBin.startTime;
426         this.endTime = oldBin.endTime;
427         this.numberHits = oldBin.numberHits;
428         this.totalRunningTime = oldBin.totalRunningTime;
429         this.minTime = oldBin.minTime;
430         this.maxTime = oldBin.maxTime;
431     }
432
433     public String JavaDoc getId() {
434         return this.id;
435     }
436
437     public int getType() {
438         return this.type;
439     }
440
441     public String JavaDoc getTypeString() {
442         return typeNames[this.type];
443     }
444
445     /** returns the startTime of the bin */
446     public long getStartTime() {
447         return this.startTime;
448     }
449
450     /** Returns the end time if the length of the bin is limited, otherwise returns the current system time */
451     public long getEndTime() {
452         return limitLength ? this.endTime : System.currentTimeMillis();
453     }
454
455     /** returns the startTime of the bin */
456     public String JavaDoc getStartTimeString() {
457         // using Timestamp toString because I like the way it formats it
458
return new java.sql.Timestamp JavaDoc(this.getStartTime()).toString();
459     }
460
461     /** Returns the end time if the length of the bin is limited, otherwise returns the current system time */
462     public String JavaDoc getEndTimeString() {
463         return new java.sql.Timestamp JavaDoc(this.getEndTime()).toString();
464     }
465
466     /** returns endTime - startTime */
467     public long getBinLength() {
468         return this.getEndTime() - this.getStartTime();
469     }
470
471     /** returns (endTime - startTime)/60000 */
472     public double getBinLengthMinutes() {
473         return ((double) this.getBinLength()) / 60000.0;
474     }
475
476     public long getNumberHits() {
477         return this.numberHits;
478     }
479
480     public long getTotalRunningTime() {
481         return this.totalRunningTime;
482     }
483
484     public long getMinTime() {
485         return this.minTime;
486     }
487
488     public double getMinTimeSeconds() {
489         return ((double) this.minTime) / 1000.0;
490     }
491
492     public long getMaxTime() {
493         return this.maxTime;
494     }
495
496     public double getMaxTimeSeconds() {
497         return ((double) this.maxTime) / 1000.0;
498     }
499
500     public double getAvgTime() {
501         return ((double) this.totalRunningTime) / ((double) this.numberHits);
502     }
503
504     public double getAvgTimeSeconds() {
505         return this.getAvgTime() / 1000.0;
506     }
507
508     /** return the hits per minute using the entire length of the bin as returned by getBinLengthMinutes() */
509     public double getHitsPerMinute() {
510         return ((double) this.numberHits) / ((double) this.getBinLengthMinutes());
511     }
512
513     synchronized void addHit(long startTime, long runningTime) {
514         advanceBin(startTime + runningTime);
515
516         this.numberHits++;
517         this.totalRunningTime += runningTime;
518         if (runningTime < this.minTime)
519             this.minTime = runningTime;
520         if (runningTime > this.maxTime)
521             this.maxTime = runningTime;
522     }
523
524     synchronized void advanceBin(long toTime) {
525         // first check to see if this bin has expired, if so save and recycle it
526
while (limitLength && toTime > this.endTime) {
527             LinkedList JavaDoc binList = null;
528
529             switch (type) {
530             case REQUEST:
531                 binList = (LinkedList JavaDoc) requestHistory.get(id);
532                 break;
533
534             case EVENT:
535                 binList = (LinkedList JavaDoc) eventHistory.get(id);
536                 break;
537
538             case VIEW:
539                 binList = (LinkedList JavaDoc) viewHistory.get(id);
540                 break;
541
542             case ENTITY:
543                 binList = (LinkedList JavaDoc) entityHistory.get(id);
544                 break;
545
546             case SERVICE:
547                 binList = (LinkedList JavaDoc) serviceHistory.get(id);
548                 break;
549             }
550
551             // the first in the list will be this object, remove and copy it,
552
// put the copy at the first of the list, then put this object back on
553
binList.removeFirst();
554             if (this.numberHits > 0) {
555                 binList.addFirst(new ServerHitBin(this));
556
557                 // persist each bin when time ends if option turned on
558
if (UtilProperties.propertyValueEqualsIgnoreCase("serverstats", "stats.persist." + ServerHitBin.typeIds[type] + ".bin", "true")) {
559                     GenericValue serverHitBin = delegator.makeValue("ServerHitBin", null);
560                     serverHitBin.set("serverHitBinId", getDelegator().getNextSeqId("ServerHitBin"));
561                     serverHitBin.set("contentId", this.id);
562                     serverHitBin.set("hitTypeId", ServerHitBin.typeIds[this.type]);
563                     serverHitBin.set("binStartDateTime", new java.sql.Timestamp JavaDoc(this.startTime));
564                     serverHitBin.set("binEndDateTime", new java.sql.Timestamp JavaDoc(this.endTime));
565                     serverHitBin.set("numberHits", new Long JavaDoc(this.numberHits));
566                     serverHitBin.set("totalTimeMillis", new Long JavaDoc(this.totalRunningTime));
567                     serverHitBin.set("minTimeMillis", new Long JavaDoc(this.minTime));
568                     serverHitBin.set("maxTimeMillis", new Long JavaDoc(this.maxTime));
569                     // get localhost ip address and hostname to store
570
try {
571                         InetAddress JavaDoc address = InetAddress.getLocalHost();
572
573                         if (address != null) {
574                             serverHitBin.set("serverIpAddress", address.getHostAddress());
575                             serverHitBin.set("serverHostName", address.getHostName());
576                         } else {
577                             Debug.logError("Unable to get localhost internet address, was null", module);
578                         }
579                     } catch (java.net.UnknownHostException JavaDoc e) {
580                         Debug.logError("Unable to get localhost internet address: " + e.toString(), module);
581                     }
582                     try {
583                         serverHitBin.create();
584                     } catch (GenericEntityException e) {
585                         Debug.logError(e, "Could not save ServerHitBin:", module);
586                     }
587                 }
588             }
589             this.reset(this.endTime + 1);
590             binList.addFirst(this);
591         }
592     }
593
594     void saveHit(HttpServletRequest JavaDoc request, long startTime, long runningTime, GenericValue userLogin) {
595         // persist record of hit in ServerHit entity if option turned on
596
if (UtilProperties.propertyValueEqualsIgnoreCase("serverstats", "stats.persist." + ServerHitBin.typeIds[type] + ".hit", "true")) {
597             // if the hit type is ENTITY and the name contains "ServerHit" don't
598
// persist; avoids the infinite loop and a bunch of annoying data
599
if (this.type == ENTITY && this.id.indexOf("ServerHit") > 0) {
600                 return;
601             }
602
603             // check for type data before running.
604
GenericValue serverHitType = null;
605
606             try {
607                 serverHitType = delegator.findByPrimaryKeyCache("ServerHitType", UtilMisc.toMap("hitTypeId", ServerHitBin.typeIds[this.type]));
608             } catch (GenericEntityException e) {
609                 Debug.logError(e, module);
610             }
611             if (serverHitType == null) {
612                 // datamodel data not loaded; not storing hit.
613
Debug.logWarning("The datamodel data has not been loaded; cannot find hitTypeId '" + ServerHitBin.typeIds[this.type] + " not storing ServerHit.", module);
614                 return;
615             }
616
617             String JavaDoc visitId = VisitHandler.getVisitId(request.getSession());
618
619             if (visitId == null || visitId.length() == 0) {
620                 // no visit info stored, so don't store the ServerHit
621
Debug.logWarning("Could not find a visitId, so not storing ServerHit. This is probably a configuration error. If you turn of persistance of visits you should also turn off persistence of hits.", module);
622                 return;
623             }
624
625             GenericValue serverHit = delegator.makeValue("ServerHit", null);
626
627             serverHit.set("visitId", visitId);
628             serverHit.set("hitStartDateTime", new java.sql.Timestamp JavaDoc(startTime));
629             serverHit.set("hitTypeId", ServerHitBin.typeIds[this.type]);
630             if (userLogin != null) {
631                 serverHit.set("userLoginId", userLogin.get("userLoginId"));
632                 serverHit.set("partyId", userLogin.get("partyId"));
633             }
634             serverHit.set("contentId", this.id);
635             serverHit.set("runningTimeMillis", new Long JavaDoc(runningTime));
636
637             String JavaDoc fullRequestUrl = UtilHttp.getFullRequestUrl(request).toString();
638
639             serverHit.set("requestUrl", fullRequestUrl.length() > 250 ? fullRequestUrl.substring(0, 250) : fullRequestUrl);
640             String JavaDoc referrerUrl = request.getHeader("Referer") != null ? request.getHeader("Referer") : "";
641
642             serverHit.set("referrerUrl", referrerUrl.length() > 250 ? referrerUrl.substring(0, 250) : referrerUrl);
643
644             // get localhost ip address and hostname to store
645
try {
646                 InetAddress JavaDoc address = InetAddress.getLocalHost();
647
648                 if (address != null) {
649                     serverHit.set("serverIpAddress", address.getHostAddress());
650                     serverHit.set("serverHostName", address.getHostName());
651                 } else {
652                     Debug.logError("Unable to get localhost internet address, was null", module);
653                 }
654             } catch (java.net.UnknownHostException JavaDoc e) {
655                 Debug.logError("Unable to get localhost internet address: " + e.toString(), module);
656             }
657
658             try {
659                 serverHit.create();
660             } catch (GenericEntityException e) {
661                 Debug.logError(e, "Could not save ServerHit:", module);
662             }
663         }
664     }
665 }
666
Popular Tags