perfsonar-dev - perfsonar: r2440 - trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType
Subject: perfsonar development work
List archive
perfsonar: r2440 - trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType
Chronological Thread
- From:
- To:
- Subject: perfsonar: r2440 - trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType
- Date: Thu, 31 May 2007 09:05:28 -0400
Author: uros
Date: 2007-05-31 09:05:27 -0400 (Thu, 31 May 2007)
New Revision: 2440
Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/TCMPTypeMeasurementExecutor.java
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/TCMPTypeMeasurementRequest.java
Log:
Added support to turn off parallel tracefile captures in service
configuration.
Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/TCMPTypeMeasurementExecutor.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/TCMPTypeMeasurementExecutor.java
2007-05-31 12:40:49 UTC (rev 2439)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/TCMPTypeMeasurementExecutor.java
2007-05-31 13:05:27 UTC (rev 2440)
@@ -202,6 +202,28 @@
// Verify the incoming request Message
// Throw either RequestException or DataFormatException
TCMPTypeMeasurementRequest req = validateTCMPRequest(request);
+
+ // If simultaneous.traces service property is false, and capture is
+ // already running, do not add another trace
+ boolean simulTraces = false;
+ try {
+ simulTraces =
+ Boolean.valueOf(
+ configuration.getProperty("simultaneous.traces"));
+
+ } catch (Exception e) {}
+
+ if (! simulTraces && TCMPTypeMeasurementRequest.isCaptureRunning()) {
+
+ logger.fatal(type + ".makeMeasurement: Simultaneous traces not"
+ + " allowed (simultaneous.traces is false and capture"
+ + " currently running)!");
+ throw new SystemException(
+ "error.mp.tcmp.simultaneous_traces_not_allowed",
+ "Simultaneous traces are administratively prohibited"
+ + " wait few minutes and try again");
+
+ }
// Add table entry(ies) for the given capture(s) to SQL db.
if (req.getCredentials() != null) {
@@ -282,11 +304,14 @@
Scheduler scheduler = (Scheduler)
AuxiliaryComponentManager.getInstance().getComponent("scheduler");
- if (scheduler == null)
+ if (scheduler == null) {
+ logger.fatal(type + ".makeMeasurement: Scheduler component
missing");
throw new SystemException(
"error.common.no_scheduler",
"No scheduler component in TCMPTypeMeasurementExecutor");
+
+ }
if (req.getSecondEndPointHost() == null) {
@@ -377,6 +402,7 @@
runnedAlready = true;
+ TCMPTypeMeasurementRequest.setCaptureRunning(true);
try {
@@ -691,6 +717,9 @@
monReq.mapiConnect();
this.logger.info(type + ".runAction: Connected to the flow on "
+ hostIf + ", waiting until " +
this.request.getEndTimeParam()
+ + (doLimitPackets ?
+ (" or " + maxTracePackets + " packets are traced") :
+ "")
+ " (tid=" + Thread.currentThread().getId() + ")");
monReq.mapiWaitFlow(
@@ -739,6 +768,8 @@
+ Thread.currentThread().getId() + "): " + e);
}
+
+ TCMPTypeMeasurementRequest.setCaptureRunning(false);
}
Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/TCMPTypeMeasurementRequest.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/TCMPTypeMeasurementRequest.java
2007-05-31 12:40:49 UTC (rev 2439)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType/TCMPTypeMeasurementRequest.java
2007-05-31 13:05:27 UTC (rev 2440)
@@ -163,6 +163,11 @@
* Request authorization holder
*/
private Authorization reqAuthorization = null;
+
+ /**
+ * Is tracefile capture currently running or not?
+ */
+ private static boolean captureRunning = false;
// ---------------------------------- public methods
@@ -711,5 +716,27 @@
return this.reqAuthorization;
}
+
+ /**
+ * Set isCaptureRunning to specified value.
+ *
+ * @param isCaptureRunning
+ */
+ public static void setCaptureRunning(boolean captureRunning) {
+
+ TCMPTypeMeasurementRequest.captureRunning = captureRunning;
+
+ }
+
+ /**
+ * Is currenly any capture is progress or not?
+ *
+ * @return boolean true if capture is currently running, false otherwise
+ */
+ public static boolean isCaptureRunning() {
+
+ return captureRunning;
+
+ }
}
- perfsonar: r2440 - trunk/perfsonar/src/org/perfsonar/service/measurementPoint/tracefileCaptureType, svnlog, 05/31/2007
Archive powered by MHonArc 2.6.16.