Skip to Content.
Sympa Menu

perfsonar-dev - perfsonar: r3910 - trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/web

Subject: perfsonar development work

List archive

perfsonar: r3910 - trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/web


Chronological Thread 
  • From:
  • To:
  • Subject: perfsonar: r3910 - trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/web
  • Date: Thu, 29 May 2008 08:25:30 -0400

Author: mac
Date: 2008-05-29 08:25:30 -0400 (Thu, 29 May 2008)
New Revision: 3910

Modified:

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/web/RequestHandler.java
Log:
Log execution time. Format is:

Execution Time of message [message-1211289885] is [501] milliseconds


Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/web/RequestHandler.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/web/RequestHandler.java
2008-05-29 12:20:25 UTC (rev 3909)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/web/RequestHandler.java
2008-05-29 12:25:30 UTC (rev 3910)
@@ -44,6 +44,9 @@
private volatile boolean initialised = false;
private volatile Object initialisationMutex = new Object();

+ private String messageId = null;
+ private long t0 = 0;
+
/**
* Accepts web service based calls and gives back responses
*
@@ -55,12 +58,23 @@
* are being catched and converted to PerfSONAR result codes
*/
public Document acceptCall(Document request) {
+
+ setTimeStamp();
+
try {
+
if(!initialised) init();
checkAuxiliaryComponents();
- return handleCall(request);
- } catch (PerfSONARException pex) {
- return handleError(pex);
+ Document resp = handleCall(request);
+ logExecutionTime();
+ return resp;
+
+ } catch (PerfSONARException pex) {
+
+ Document err = handleError(pex);
+ logExecutionTime();
+ return err;
+
}
}
/**
@@ -123,7 +137,7 @@
"response message nor error code message!"
);
}
- logger.info("RequestHandler: Service sent a response with
error information");
+ logger.info("RequestHandler: Service sent a response with
error information");
return responseDocument;
}
/**
@@ -250,5 +264,25 @@
"specified service.sax_parser.config not found"
);
}
+

+ /**
+ * Print out time of execution (to log)
+ *
+ */
+ private void logExecutionTime() {
+
+ long t1 = System.currentTimeMillis();
+ logger.info("Execution Time of message ["
+ + ((messageId == null) ? "" : messageId) + "] is ["
+ + (t1 - t0) + "] milliseconds");
+ }
+
+ /**
+ * Sets current time
+ */
+ private void setTimeStamp() {
+ t0 = System.currentTimeMillis();
+ }
+
}



  • perfsonar: r3910 - trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/web, svnlog, 05/29/2008

Archive powered by MHonArc 2.6.16.

Top of Page