Skip to Content.
Sympa Menu

perfsonar-dev - r1880 - trunk/perfsonar/src/org/perfsonar/service/measurementPoint/flowType

Subject: perfsonar development work

List archive

r1880 - trunk/perfsonar/src/org/perfsonar/service/measurementPoint/flowType


Chronological Thread 
  • From:
  • To:
  • Subject: r1880 - trunk/perfsonar/src/org/perfsonar/service/measurementPoint/flowType
  • Date: Thu, 4 Jan 2007 16:26:04 -0500

Author: joost
Date: 2007-01-04 16:26:03 -0500 (Thu, 04 Jan 2007)
New Revision: 1880

Modified:

trunk/perfsonar/src/org/perfsonar/service/measurementPoint/flowType/ConfigFileWriter.java

trunk/perfsonar/src/org/perfsonar/service/measurementPoint/flowType/ZebedeeControl.java
Log:


Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/flowType/ConfigFileWriter.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/flowType/ConfigFileWriter.java
2007-01-04 21:05:52 UTC (rev 1879)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/flowType/ConfigFileWriter.java
2007-01-04 21:26:03 UTC (rev 1880)
@@ -21,6 +21,7 @@
public class ConfigFileWriter {

/**
+ * Creates a config file for the nfdump proces
*
* @param key The unique key of this tunnel (will be the filename).
* @param params Parameters derived from the soap request.
@@ -38,7 +39,7 @@
AuxiliaryComponentManager.getInstance().
getComponent(ComponentNames.CONFIG);

- String configBasePath =
configuration.getProperty("service.mp.flow.client_dir");
+ String configBasePath =
configuration.getProperty("service.mp.flow.client_dir");

File configFile = new File(configBasePath + "/" + key + ".xml");

@@ -59,4 +60,27 @@

out.close();
}
+
+ /**
+ * Deletes the written config file for the nfdump proces
+ * @param key The unique key of this tunnel (will be the filename).
+ * @throws SystemException
+ */
+ public static void delete(Integer key) throws SystemException {
+ LoggerComponent logger = (LoggerComponent)
+ AuxiliaryComponentManager.getInstance().
+ getComponent(ComponentNames.LOGGER);
+
+ ConfigurationComponent configuration = (ConfigurationComponent)
+ AuxiliaryComponentManager.getInstance().
+ getComponent(ComponentNames.CONFIG);
+
+ String configBasePath =
configuration.getProperty("service.mp.flow.client_dir");
+
+ File configFile = new File(configBasePath + "/" + key + ".xml");
+
+ if(configFile.exists()) {
+ configFile.delete();
+ }
+ }
}

Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/flowType/ZebedeeControl.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/flowType/ZebedeeControl.java
2007-01-04 21:05:52 UTC (rev 1879)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementPoint/flowType/ZebedeeControl.java
2007-01-04 21:26:03 UTC (rev 1880)
@@ -130,8 +130,9 @@
* @param clientIP The flow subscribers ip address.
* @param outPort The port on wich the client wants to receive the
flows. This port is supplied by the subscriber.
* @throws IOException When the program execution failed.
+ * @throws SystemException
*/
- public Integer startTunnel(String clientIP, Integer outPort) throws
IOException {
+ public Integer startTunnel(String clientIP, Integer outPort) throws
IOException, SystemException {
//Get a new unique key
Integer key = newKey();

@@ -158,26 +159,27 @@
* Stop a running tunnel (kills the zebedee process).
*
* @param key Unique key identifying the client (supplied by the
service).
+ * @throws SystemException
*/
- public void stopTunnel(Integer key) {
- logger.debug("ZebedeeControl: stopping tunnel with key " + key + ".");
- //Get the process that needs to be killed
- Process processToKill = processList.get(key);
- //Destroy (hard-kill) the process
- processToKill.destroy();
- //Remove the key from the processList and the keepAliveList
- processList.remove(key);
- keepAliveList.remove(key);
+ public void stopTunnel(Integer key) throws SystemException {
+ logger.debug("ZebedeeControl: stopping tunnel with key " +
key + ".");
+ //Get the process that needs to be killed
+ Process processToKill = processList.get(key);
+ //Destroy (hard-kill) the process
+ processToKill.destroy();
+ //Remove the key from the processList and the keepAliveList
+ processList.remove(key);
+ keepAliveList.remove(key);
+ ConfigFileWriter.delete(key);
}

/**
* Infinate loop wich checks the keepalive times of the active tunnels.
- *
* @see Runnable.run
*/
public void run() {
- // Infinate loop
- while (true) {
+ // Infinate loop
+ while (true) {
try {
Thread.sleep(SLEEPTIME);
} catch (InterruptedException e) {
@@ -185,8 +187,13 @@
logger.error("ZebedeeControl: InterruptedException! " +
e.getMessage());
}
//run the checkForTimeouts method to check for timeouts, and to
close timed-out tunnels
- checkForTimeouts();
- }
+ try {
+ checkForTimeouts();
+ } catch (SystemException e) {
+ e.printStackTrace();
+ logger.error("ZebedeeControl:
SystemException! " + e.getMessage());
+ }
+ }
}

/**
@@ -195,18 +202,19 @@
* @param key The unique key for the clients tunnel connection.
*/
public void keepAlive(Integer key) {
- logger.debug("ZebedeeControl: keeping alive tunnel with key " + key +
".");
- // current time
- Long now = (Long) System.currentTimeMillis();
-
- //add or update this key with the current time
- keepAliveList.put(key, now);
+ logger.debug("ZebedeeControl: keeping alive tunnel with key "
+ key + ".");
+ // current time
+ Long now = (Long) System.currentTimeMillis();
+
+ //add or update this key with the current time
+ keepAliveList.put(key, now);
}

/**
* Checks the keepAliveList list for timed-out tunnels and closes them.
+ * @throws SystemException
*/
- private void checkForTimeouts() {
+ private void checkForTimeouts() throws SystemException {
logger.debug("ZebedeeControl: checking for timeouts.");
// temporary list with timed out tunnel connections
ArrayList<Integer> tunnelsToClose = new ArrayList<Integer>();



  • r1880 - trunk/perfsonar/src/org/perfsonar/service/measurementPoint/flowType, svnlog, 01/04/2007

Archive powered by MHonArc 2.6.16.

Top of Page