perfsonar-dev - perfsonar: r5325 - in branches/new-structure-with-base2/ps-mdm-ls: contrib/SOAPRequestAuxilary/src/pl/psnc src/main/java/org/perfsonar/service/lookupservice/summarization
Subject: perfsonar development work
List archive
perfsonar: r5325 - in branches/new-structure-with-base2/ps-mdm-ls: contrib/SOAPRequestAuxilary/src/pl/psnc src/main/java/org/perfsonar/service/lookupservice/summarization
Chronological Thread
- From:
- To:
- Subject: perfsonar: r5325 - in branches/new-structure-with-base2/ps-mdm-ls: contrib/SOAPRequestAuxilary/src/pl/psnc src/main/java/org/perfsonar/service/lookupservice/summarization
- Date: Fri, 23 Oct 2009 09:14:25 -0400
Author: trzaszcz
Date: 2009-10-23 09:14:24 -0400 (Fri, 23 Oct 2009)
New Revision: 5325
Modified:
branches/new-structure-with-base2/ps-mdm-ls/contrib/SOAPRequestAuxilary/src/pl/psnc/RegistrationTest.py
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/LSSummarySynchronizationAction.java
Log:
summarization enhancement
Modified:
branches/new-structure-with-base2/ps-mdm-ls/contrib/SOAPRequestAuxilary/src/pl/psnc/RegistrationTest.py
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/contrib/SOAPRequestAuxilary/src/pl/psnc/RegistrationTest.py
2009-10-22 12:00:12 UTC (rev 5324)
+++
branches/new-structure-with-base2/ps-mdm-ls/contrib/SOAPRequestAuxilary/src/pl/psnc/RegistrationTest.py
2009-10-23 13:14:24 UTC (rev 5325)
@@ -41,8 +41,8 @@
strResult=strResult+'%(iteration)d;%(time)f \n' %
{"iteration":t,"time":result_list[t]}
strResult=strResult+'avg;%(time)f \n' % {"time":(sum/len(result_list))}
- f=open("../../../results/result-ls2-exist.txt","w")
- f.write(strResult)
+# f=open("../../../results/result-ls2-exist.txt","w")
+# f.write(strResult)
print "--------------------------"
print strResult
Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/LSSummarySynchronizationAction.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/LSSummarySynchronizationAction.java
2009-10-22 12:00:12 UTC (rev 5324)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/LSSummarySynchronizationAction.java
2009-10-23 13:14:24 UTC (rev 5325)
@@ -12,13 +12,13 @@
/**
*
- * Action synchronize summary data.
- * This component uses ModificationCounterComponent which store nr of
- * modification. This action bases on 2 constant. NR_OF_MODIFICATIONS
- * (boundary value of modification nr; when nr of modification is greater
then
- * NR_OF_MODIFICATIONS then synchronization is required)
- * NR_OF_ITERATION - if this value is equal iteration nr summarization
process is executed
- * only if exists any modifications
+ * Action synchronize summary data. This component uses
+ * ModificationCounterComponent which store nr of modification. This action
+ * bases on 2 constant. NR_OF_MODIFICATIONS (boundary value of modification
nr;
+ * when nr of modification is greater then NR_OF_MODIFICATIONS then
+ * synchronization is required) NR_OF_ITERATION - if this value is equal
+ * iteration nr summarization process is executed only if exists any
+ * modifications
*
* @author trzaszcz
*/
@@ -26,10 +26,11 @@
SchedulerAction {
private int NR_OF_MODIFICATIONS;
+ private boolean summarizationInProgress=false;
private int NR_OF_ITERATIONS;
private int iteration = 0;
- private boolean firstIteration=true;
- private boolean initialized=false;
+ private boolean firstIteration = true;
+ private boolean initialized = false;
private SummarizationDAO summarizationDao;
private SummarizationBuilder builder;
private ModificationCounterComponent component;
@@ -38,14 +39,14 @@
super();
}
- private void initializeElement(){
+ private void initializeElement() {
try {
summarizationDao =
LookupServiceDAOFactory.getSumarizationDAO();
builder = new SummarizationBuilder(summarizationDao);
} catch (PerfSONARException e) {
e.printStackTrace();
}
-
+
try {
ConfigurationManager cm =
ConfigurationManager.getInstance();
@@ -55,61 +56,62 @@
e.printStackTrace();
}
- NR_OF_MODIFICATIONS =
getOption("nrOfModifications").getValueAsInteger();
+ NR_OF_MODIFICATIONS = getOption("nrOfModifications")
+ .getValueAsInteger();
NR_OF_ITERATIONS =
getOption("nrOfIterations").getValueAsInteger();
}
-
+
@Override
public void runAction() {
-
- int nrOfChanges = 0;
-
- if(!initialized){
-
- initializeElement();
- nrOfChanges=component.getCounter();
- initialized=true;
-
- }
-
- try {
-
- if (firstIteration) {
- // in first iteration summary data is built
- synchronizeSummarizationCollection();
- iteration++;
- firstIteration=false;
- } else if (iteration != NR_OF_ITERATIONS) {
-
-
- if (nrOfChanges >= NR_OF_MODIFICATIONS) {
- // if nr of changes is greater then
const NR_OF_MODIFICATIONS -> summary data must be refreshed
+
+ if(!summarizationInProgress){
+ int nrOfChanges = 0;
+
+ if (!initialized) {
+ initializeElement();
+ initialized = true;
+ }
+
+ nrOfChanges = component.getCounter();
+ System.out.println(nrOfChanges+ "
"+NR_OF_MODIFICATIONS);
+ try {
+
+ if (firstIteration) {
+ // in first iteration summary data is
built
synchronizeSummarizationCollection();
- component.resetCounter();
+ iteration++;
+ firstIteration = false;
+ } else if (iteration != NR_OF_ITERATIONS) {
+
+ if (nrOfChanges >=
NR_OF_MODIFICATIONS) {
+ // if nr of changes is
greater then const
+ // NR_OF_MODIFICATIONS ->
summary data must be refreshed
+
synchronizeSummarizationCollection();
+ component.resetCounter();
+ }
+ iteration++;
+ } else {
+ // if NR_OF_ITERATION is equal
iteration nr ...
+ iteration = 0;
+ // summarization is obligatory when
there are any
+ // differences
+ if (nrOfChanges != 0) {
+
synchronizeSummarizationCollection();
+ component.resetCounter();
+ }
}
- iteration++;
- } else {
- // if NR_OF_ITERATION is equal iteration nr
...
- iteration = 0;
- //summarization is obligatory when there are
any differences
- if (nrOfChanges != 0) {
- synchronizeSummarizationCollection();
- component.resetCounter();
- }
+ } catch (PerfSONARException e1) {
+ e1.printStackTrace();
+ }finally{
+ summarizationInProgress=false;
}
-
- } catch (NumberFormatException e1) {
- e1.printStackTrace();
- } catch (PerfSONARException e1) {
- e1.printStackTrace();
- }
+ }
}
private void synchronizeSummarizationCollection() throws
PerfSONARException {
summarizationDao.removeSummaryData();
List<Element> datas = builder.build();
summarizationDao.putBatchData(datas, 100);
-
}
}
- perfsonar: r5325 - in branches/new-structure-with-base2/ps-mdm-ls: contrib/SOAPRequestAuxilary/src/pl/psnc src/main/java/org/perfsonar/service/lookupservice/summarization, svnlog, 10/23/2009
Archive powered by MHonArc 2.6.16.