perfsonar-dev - [GEANT/SA2/ps-java-services] r5499 - branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration
Subject: perfsonar development work
List archive
[GEANT/SA2/ps-java-services] r5499 - branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration
Chronological Thread
- From:
- To:
- Subject: [GEANT/SA2/ps-java-services] r5499 - branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration
- Date: Mon, 22 Feb 2010 10:32:04 GMT
Author: psnc.trzaszczka
Date: 2010-02-22 10:32:04 +0000 (Mon, 22 Feb 2010)
New Revision: 5499
Modified:
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration/AbstractRegistrationAction.java
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration/LSRegistrationAction.java
Log:
LSRegistration improved
Modified:
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration/AbstractRegistrationAction.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration/AbstractRegistrationAction.java
2010-02-22 08:53:35 UTC (rev 5498)
+++
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration/AbstractRegistrationAction.java
2010-02-22 10:32:04 UTC (rev 5499)
@@ -16,6 +16,7 @@
import org.perfsonar.base2.service.configuration.Configuration;
import org.perfsonar.base2.service.configuration.ConfigurationManager;
import org.perfsonar.base2.service.configuration.LookupInformation;
+import org.perfsonar.base2.service.configuration.Option;
import org.perfsonar.base2.service.exceptions.PerfSONARException;
import org.perfsonar.base2.service.requesthandler.ServiceMessage;
import org.perfsonar.base2.service.scheduler.SchedulerAction;
@@ -47,9 +48,11 @@
SchedulerAction {
private boolean initialized = false;
-
+
private Logger logger =
Logger.getLogger(AbstractRegistrationAction.class);
+ private final String KEEP_ALIVE_OPTION="keepAlive";
+
/**
* Message type.
*/
@@ -156,7 +159,35 @@
return registerDataSource;
}
+
+
+ /**
+ *
+ * returns keepAlive option configured in configuration.xml file
+ *
+ * @return
+ * @throws PerfSONARException
+ */
+ protected boolean isKeepAliveEnabled()
+ throws PerfSONARException {
+ Option option=getOption(KEEP_ALIVE_OPTION);
+ if(option!=null){
+ String keepAlive =
getOption(KEEP_ALIVE_OPTION).getValue();
+ if (keepAlive == null || keepAlive.trim().equals(""))
{
+ return false;
+ }
+ if(keepAlive.equals("on")){
+ return true;
+ }else{
+ return false;
+ }
+ }else{
+ return false;
+ }
+
+ }
+
/**
* get registerEventType option value. If not present, take default
*
Modified:
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration/LSRegistrationAction.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration/LSRegistrationAction.java
2010-02-22 08:53:35 UTC (rev 5498)
+++
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration/LSRegistrationAction.java
2010-02-22 10:32:04 UTC (rev 5499)
@@ -22,6 +22,8 @@
private Logger logger = Logger.getLogger(LSRegistrationAction.class);
+ private boolean keepAliveEnabled=false;
+
private LinkedList<URL> lsAddresses;
/**
@@ -37,13 +39,13 @@
lookupInformation = getLookupInformation();
lsAddresses = getLSAddresses();
registrator = getLSRegistrator();
+ keepAliveEnabled=isKeepAliveEnabled();
}
public void execute() {
- boolean sendKeekAlive = false;
ServiceMessage response;
- if (sendKeekAlive) {
+ if (keepAliveEnabled) {
for (int c = 0; c < registeredKeys.size(); c++) {
Element registeredKey = registeredKeys.get(c);
@@ -68,6 +70,8 @@
registeredKeys.remove(registeredKey);
}
}
+ }else{
+ registeredKeys.clear();
}
// if registration using KeepAlive message failed or there
wasn't any
- [GEANT/SA2/ps-java-services] r5499 - branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration, svn-noreply, 02/22/2010
Archive powered by MHonArc 2.6.16.