Skip to content
Snippets Groups Projects
Commit a8d12944 authored by Gwenaelle ABEILLE's avatar Gwenaelle ABEILLE
Browse files

release

parent de3010ce
No related branches found
No related tags found
No related merge requests found
Showing
with 114 additions and 134 deletions
......@@ -2,7 +2,6 @@
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" including="**/*.java" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
......
......@@ -27,11 +27,4 @@
<nature>org.devzuz.q.maven.jdt.core.mavenNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
<linkedResources>
<link>
<name>ArchivingConf</name>
<type>2</type>
<location>C:/SOLEIL_ROOT/tango-soleil-win32-5.5.8RC3/tango/bin/ArchivingConf</location>
</link>
</linkedResources>
</projectDescription>
......@@ -13,7 +13,7 @@
<artifactId>hdbtdbArchivingServers</artifactId>
<name>hdbtdbArchivingServers</name>
<version>2.2.15</version>
<version>2.2.20</version>
<scm>
<connection>${scm.connection.svn.tango-cs}:archiving/server/hdbtdbArchivingServers</connection>
......@@ -42,6 +42,10 @@
<groupId>org.tango</groupId>
<artifactId>TangORB-javadao</artifactId>
</dependency>
<dependency>
<groupId>org.tango</groupId>
<artifactId>JTangoCommons</artifactId>
</dependency>
<dependency>
<groupId>fr.esrf.atk</groupId>
<artifactId>ATKCore</artifactId>
......
......@@ -11,7 +11,7 @@ public abstract class ArchiverCollector {
// This hashtable contains the mode counters by attribute
private final Map<String, ModesCounters> attributeModeCounterMap = new HashMap<String, ModesCounters>();
// Diary file
protected ILogger m_logger;
protected ILogger logger;
/**
* An ModeHandler is associated to each Collector to handle the archiving
......@@ -24,14 +24,14 @@ public abstract class ArchiverCollector {
}
public void setDiaryLogger(ILogger _logger) {
this.m_logger = _logger;
this.logger = _logger;
}
/* Allows to indicate to the collector that a new attribute must be managed */
protected synchronized void addAttribute(String name) {
String lower = name.toLowerCase();
if (attributeModeCounterMap.containsKey(lower)) {
m_logger.trace(ILogger.LEVEL_WARNING, "ArchiverCollector.addAttribute : The attribute " + name
logger.trace(ILogger.LEVEL_WARNING, "ArchiverCollector.addAttribute : The attribute " + name
+ "already exists in the map ==> Counter Re-init");
attributeModeCounterMap.get(lower).init();
} else {
......@@ -71,7 +71,7 @@ public abstract class ArchiverCollector {
doArchive = m_modeHandler.isDataArchivable(mc, dataType, readValueObject, lastValueObject);
} catch (Exception e) {
e.printStackTrace();
this.m_logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName() + "/doArchiveEvent/catch " + e
this.logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName() + "/doArchiveEvent/catch " + e
+ " with the value of " + attCompleteName);
}
......
......@@ -356,26 +356,13 @@ public class DbProxy implements IDbProxy {
}
public Vector<AttributeLightMode> getArchiverCurrentTasks(final String archiverName) throws ArchivingException {
Util.out4.println("DbProxy.getArchiverCurrentTasks");
// Vector<AttributeLightMode> archiverCurrentTasks = new
// Vector<AttributeLightMode>();
final boolean facility = manager.isM_Facility();
try {
final Vector<AttributeLightMode> archiverCurrentTasks = manager
.getDataBase()
.getMode()
.getArchiverCurrentTasks(
(facility ? "//" + new Database().get_tango_host() + "/" : "") + archiverName);
// System.out.println("Current Tasks - " +
// archiverCurrentTasks.size() + ": ");
// for (int i = 0; i < archiverCurrentTasks.size(); i++) {
// final AttributeLightMode attributeLightMode =
// archiverCurrentTasks.elementAt(i);
// System.out.println("******************* " + (i + 1)
// + " *******************");
// System.out.println(attributeLightMode);
// }
return archiverCurrentTasks;
} catch (final DevFailed devFailed) {
final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + GlobalConst.DBT_UNREACH_EXCEPTION;
......
......@@ -126,6 +126,7 @@ import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import Common.Archiver.Collector.ArchiverCollector;
import HdbArchiver.HdbArchiver;
......@@ -151,7 +152,7 @@ public abstract class HdbCollector extends ArchiverCollector {
*/
protected boolean refreshing;
protected boolean isFirstValue;
protected volatile Map<String, Boolean> isFirstValueList = new ConcurrentHashMap<String, Boolean>();
/**
* This parameter specify the number of time a Collector retry the archiving
......@@ -182,7 +183,6 @@ public abstract class HdbCollector extends ArchiverCollector {
public HdbCollector(final HdbModeHandler _modeHandler) {
super(_modeHandler);
isFirstValue = true;
}
/**
......@@ -211,7 +211,7 @@ public abstract class HdbCollector extends ArchiverCollector {
*/
public void addSource(final AttributeLightMode attributeLightMode) throws ArchivingException {
isFirstValue = true;
isFirstValueList.put(attributeLightMode.getAttribute_complete_name().toLowerCase(), true);
if (HdbArchiver.isUseEvents) {
addSourceForEvents(attributeLightMode);
} else {
......@@ -236,16 +236,19 @@ public abstract class HdbCollector extends ArchiverCollector {
/**
* Triggers the collecting action of this HdbCollector.
*/
public synchronized void startCollecting() {
protected synchronized void startCollecting() {
if (!attributeList.isEmpty()) {
if (attributeList.size() == 1) {
if (!attributeList.isRefresherStarted()) {
attributeList.setRefreshInterval(m_modeHandler.getRefreshInterval());
attributeList.setSynchronizedPeriod(true);
attributeList.startRefresher();
refreshing = true;
logger.trace(ILogger.LEVEL_DEBUG, this.getClass() + " start refresh for " + attributeList.getSize()
+ " attributes");
} else {
// force a refresh for newly added attributes
attributeList.refresh();
logger.trace(ILogger.LEVEL_DEBUG, "FORCING refresh for " + this.getClass());
}
}
}
......@@ -253,14 +256,12 @@ public abstract class HdbCollector extends ArchiverCollector {
/**
* Stops the collecting action of this HdbCollector.
*/
public synchronized void stopCollecting() {
Util.out4.println("HdbCollector.stopCollecting");
m_logger.trace(ILogger.LEVEL_INFO, "HdbCollector.stopCollecting");
protected synchronized void stopCollecting() {
try {
if (attributeList.isEmpty()) {
logger.trace(ILogger.LEVEL_DEBUG, this.getClass() + " stop refresh on " + attributeList.getSize()
+ " attributes");
attributeList.stopRefresher();
refreshing = false;
}
} catch (final Exception e) {
Util.out2.println("ERROR !! " + "\r\n" + "\t Origin : \t " + "HdbCollector.stopCollecting" + "\r\n"
+ "\t Reason : \t " + "UNKNOWN_ERROR" + "\r\n" + "\t Description : \t " + e.getMessage() + "\r\n"
......@@ -325,7 +326,7 @@ public abstract class HdbCollector extends ArchiverCollector {
final long newTime = archivingEvent.getTimeStamp();
if (newTime == 0) {
m_logger.trace(ILogger.LEVEL_WARNING, "NOARCHIVING - received a zero timestamp for " + name
logger.trace(ILogger.LEVEL_WARNING, "NOARCHIVING - received a zero timestamp for " + name
+ " - tableName: " + archivingEvent.getTable_name());
return false;
}
......@@ -335,10 +336,10 @@ public abstract class HdbCollector extends ArchiverCollector {
return true;
}
final boolean isAlreadyRegisteredDate = lastTimestampStack.containsDate(newTime, m_logger);
final boolean isValidDate = lastTimestampStack.validateDate(newTime, m_logger);
final boolean isAlreadyRegisteredDate = lastTimestampStack.containsDate(newTime, logger);
final boolean isValidDate = lastTimestampStack.validateDate(newTime, logger);
if (isAlreadyRegisteredDate || !isValidDate) {
m_logger.trace(ILogger.LEVEL_DEBUG, "NOARCHIVING - AlreadyRegisteredDate - attribute: " + name
logger.trace(ILogger.LEVEL_DEBUG, "NOARCHIVING - AlreadyRegisteredDate - attribute: " + name
+ " - timestamp: " + new Timestamp(newTime));
return false;
}
......@@ -368,7 +369,7 @@ public abstract class HdbCollector extends ArchiverCollector {
return ret;
}
public List<String> getAttributeList() {
public synchronized List<String> getAttributeList() {
final List<String> attributeListResult = new ArrayList<String>();
final Enumeration<?> myAttList = attributeList.elements();
while (myAttList.hasMoreElements()) {
......
......@@ -203,8 +203,8 @@ public class Image_RO extends HdbCollector implements IImageListener {
super.setLastTimestamp(snapImageEvent_RO);
} catch (final Exception e) {
final String message = "Problem (ArchivingException) storing Image_RO value";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, e);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, e);
try_number--;
if (try_number > 0) {
......
......@@ -130,7 +130,7 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
evtAdaptHMap = new HashMap<Device, TangoEventsAdapter>();
}
/* synchronized */@Override
@Override
public synchronized void removeSource(final String attributeName) throws ArchivingException {
Util.out2.println("BooleanScalar.removeSource");
......@@ -143,20 +143,18 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
* while ( ( IBooleanScalar ) attributeList.get(attributeName) !=
* null ) {
*/
stopCollecting();
final IBooleanScalar attribute = (IBooleanScalar) attributeList.get(attributeName);
if (attribute != null) {
attribute.removeBooleanScalarListener(this);
attribute.removeErrorListener(this);
attributeList.remove(attributeName);
isFirstValueList.remove(attributeName.toLowerCase());
// informs the mother class that one new attribute must be
// removed
removeAttribute(attributeName);
removeTimestamps(attributeName);
Util.out4.println("\t The attribute named " + attributeName + " was fired from the Collector list...");
if (attributeList.isEmpty()) {
stopCollecting();
}
}
} catch (final Exception e) {
final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed removing '" + attributeName
......@@ -165,6 +163,8 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
final String desc = "Failed while executing " + this.getClass().getSimpleName()
+ ".removeSource() method...";
throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
} finally {
startCollecting();
}
}
......@@ -175,6 +175,7 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
final String attName = attributeLightMode.getAttribute_complete_name();
if (attName != null) {
stopCollecting();
final IBooleanScalar attribute = (IBooleanScalar) attributeList.add(attName);
attribute.addBooleanScalarListener(this);
attribute.addErrorListener(this);
......@@ -183,12 +184,8 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
// informs the mother class that one new attribute must be
// managed
addAttribute(attName);
m_logger.trace(ILogger.LEVEL_INFO, "add archiving for " + attName);
startCollecting();
logger.trace(ILogger.LEVEL_INFO, "add archiving for " + attName);
} else {
m_logger.trace(ILogger.LEVEL_ERROR, "archiving not started because attribute name is null "
+ attributeLightMode);
}
} catch (final ConnectionException e) {
final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed adding '"
......@@ -203,6 +200,8 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
final String desc = "Failed while executing " + this.getClass().getSimpleName() + ".addSource() method...";
throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
} finally {
startCollecting();
}
}
......@@ -361,14 +360,14 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
String attributeName = scalarEvent.getAttribute_complete_name();
try {
boolean doArchive = false;
if (isFirstValue) {
if (isFirstValueList.get(attributeName.toLowerCase())) {
doArchive = true;
isFirstValue = false;
m_logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
isFirstValueList.put(attributeName.toLowerCase(), false);
logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
} else {
final ModesCounters mc = getModeCounter(attributeName);
if (mc == null) {
m_logger.trace(ILogger.LEVEL_ERROR, attributeName + " Attribute Counters unknown");
logger.trace(ILogger.LEVEL_ERROR, attributeName + " Attribute Counters unknown");
} else {
doArchive = doArchiveEvent(mc, scalarEvent.getData_type(), scalarEvent.getReadValue(),
getLastValue(scalarEvent), attributeName);
......@@ -382,8 +381,8 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
setLastValue(scalarEvent, scalarEvent.getReadValue());
} catch (final Exception e) {
final String message = "Problem storing BooleanScalar value";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, e);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, e);
try_number--;
if (try_number > 0) {
......@@ -414,13 +413,13 @@ public abstract class BooleanScalar extends HdbCollector implements IBooleanScal
final String errorMess = this.getClass().getSimpleName() + ".errorChange : Unable to read the attribute named "
+ errorEvent.getSource().toString();
Util.out3.println(errorMess);
m_logger.trace(ILogger.LEVEL_ERROR, errorMess);
logger.trace(ILogger.LEVEL_ERROR, errorMess);
try {
processEventScalar(getNullValueScalarEvent(errorEvent, TangoConst.Tango_DEV_BOOLEAN, getWritableValue()),
DEFAULT_TRY_NUMBER);
} catch (final Exception e) {
super.m_logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
super.logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
+ ".errorChange : during processEventScalar creation execp : " + e);
e.printStackTrace();
}
......
......@@ -139,8 +139,8 @@ public class BooleanScalar_RO extends BooleanScalar {
processEventScalar(scalarEvent, tryNumber);
final String message = "Problem in BooleanScalar_RO/booleanScalarChange";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, exE);
}
}
......
......@@ -143,8 +143,8 @@ public class BooleanScalar_RW extends BooleanScalar {
processEventScalar(scalarEvent, tryNumber);
final String message = "Problem in BooleanScalar_RW/booleanScalarChange";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, exE);
}
}
......
......@@ -124,8 +124,8 @@ public class BooleanScalar_WO extends BooleanScalar {
processEventScalar(scalarEvent, tryNumber);
final String message = "Problem in BooleanScalar_WO/booleanScalarChange";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, exE);
}
}
......
......@@ -176,7 +176,7 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
public synchronized void removeSource(final String attributeName) throws ArchivingException {
Util.out2.println("NumberScalar.removeSource");
m_logger.trace(ILogger.LEVEL_INFO, "===> Entering " + this.getClass().getSimpleName() + ".removeSource for "
logger.trace(ILogger.LEVEL_INFO, "===> Entering " + this.getClass().getSimpleName() + ".removeSource for "
+ attributeName);
if (HdbArchiver.isUseEvents) {
......@@ -188,20 +188,18 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
* while ( ( INumberScalar ) attributeList.get(attributeName) !=
* null ) {
*/
stopCollecting();
final INumberScalar attribute = (INumberScalar) attributeList.get(attributeName);
if (attribute != null) {
attribute.removeNumberScalarListener(this);
attribute.removeErrorListener(this);
attributeList.remove(attributeName);
m_logger.trace(ILogger.LEVEL_INFO, "\t The attribute was fired from the Collector list...");
isFirstValueList.remove(attributeName.toLowerCase());
logger.trace(ILogger.LEVEL_INFO, "\t The attribute was fired from the Collector list...");
// informs the mother class that one new attribute must be
// removed
removeAttribute(attributeName);
removeTimestamps(attributeName);
if (attributeList.isEmpty()) {
m_logger.trace(ILogger.LEVEL_INFO, "===> StopCollecting is requested ");
stopCollecting();
}
}
} catch (final Exception e) {
final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed removing '" + attributeName
......@@ -211,8 +209,7 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
+ ".removeSource() method...";
throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
} finally {
m_logger.trace(ILogger.LEVEL_INFO, "===> Exiting " + this.getClass().getSimpleName() + ".removeSource for "
+ attributeName);
startCollecting();
}
}
......@@ -223,6 +220,7 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
final String attName = attributeLightMode.getAttribute_complete_name();
if (attName != null) {
INumberScalar attribute = null;
stopCollecting();
attribute = (INumberScalar) attributeList.add(attName);
attribute.addNumberScalarListener(this);
attribute.addErrorListener(this);
......@@ -231,11 +229,7 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
// informs the mother class that one new attribute must be
// managed
addAttribute(attName);
m_logger.trace(ILogger.LEVEL_INFO, "add archiving for " + attName);
startCollecting();
} else {
m_logger.trace(ILogger.LEVEL_ERROR, "archiving not started because attribute name is null "
+ attributeLightMode);
logger.trace(ILogger.LEVEL_INFO, "add archiving for " + attName);
}
} catch (final ConnectionException e) {
final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed adding '"
......@@ -249,6 +243,8 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
final String desc = "Failed while executing " + this.getClass().getSimpleName() + ".addSource() method...";
throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
} finally {
startCollecting();
}
}
......@@ -419,17 +415,18 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
scalarEvent.avoidUnderFlow();
boolean doArchive = false;
if (isFirstValue) {
if (isFirstValueList.get(attributeName.toLowerCase())) {
doArchive = true;
isFirstValue = false;
m_logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
isFirstValueList.put(attributeName.toLowerCase(), false);
logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
} else {
final ModesCounters mc = getModeCounter(attributeName);
if (mc == null) {
m_logger.trace(ILogger.LEVEL_ERROR, attributeName + " Attribute Counters unknown ");
logger.trace(ILogger.LEVEL_ERROR, attributeName + " Attribute Counters unknown ");
} else {
doArchive = doArchiveEvent(mc, scalarEvent.getData_type(), scalarEvent.getReadValue(),
getLastValue(scalarEvent), attributeName);
}
}
......@@ -441,8 +438,8 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
} catch (final Exception e) {
e.printStackTrace();
final String message = "Problem storing NumberScalar value";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, e);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, e);
try_number--;
if (try_number > 0) {
......@@ -473,7 +470,7 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
final String errorMess = this.getClass().getSimpleName() + ".errorChange : Unable to read the attribute named "
+ errorEvent.getSource().toString();
Util.out3.println(errorMess);
super.m_logger.trace(ILogger.LEVEL_ERROR, errorMess);
super.logger.trace(ILogger.LEVEL_ERROR, errorMess);
/* Must be change because the number scalar are not only double */
try {
......@@ -481,7 +478,7 @@ public abstract class NumberScalar extends HdbCollector implements INumberScalar
getNullValueScalarEvent(errorEvent, ((AAttribute) errorEvent.getSource()).getTangoDataType(),
getWritableValue()), tryNumber);
} catch (final Exception e) {
super.m_logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
super.logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
+ ".errorChange : during processEventScalar creation execp : " + e);
e.printStackTrace();
}
......
......@@ -157,8 +157,8 @@ public class NumberScalar_RO extends NumberScalar {
processEventScalar(scalarEvent, tryNumber);
final String message = "Problem in NumberScalar_RO/numberScalarChange";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, exE);
}
}
......
......@@ -182,8 +182,8 @@ public class NumberScalar_RW extends NumberScalar {
processEventScalar(scalarEvent, tryNumber);
final String message = "Problem in NumberScalar_RW/numberScalarChange";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, exE);
}
}
......
......@@ -140,8 +140,8 @@ public class NumberScalar_WO extends NumberScalar {
processEventScalar(scalarEvent, tryNumber);
final String message = "Problem in NumberScalar_RW/numberScalarChange";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, exE);
}
}
......
......@@ -80,19 +80,18 @@ public abstract class StateScalar extends HdbCollector implements IDevStateScala
* while ( ( IDevStateScalar ) attributeList.get(attributeName) !=
* null ) {
*/
stopCollecting();
final IDevStateScalar attribute = (IDevStateScalar) attributeList.get(attributeName);
if (attribute != null) {
attribute.removeDevStateScalarListener(this);
attribute.removeErrorListener(this);
attributeList.remove(attributeName);
isFirstValueList.remove(attributeName.toLowerCase());
Util.out4.println("\t The attribute named " + attributeName + " was fired from the Collector list...");
// informs the mother class that one new attribute must be
// removed
removeAttribute(attributeName);
removeTimestamps(attributeName);
if (attributeList.isEmpty()) {
stopCollecting();
}
}
} catch (final Exception e) {
final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed removing '" + attributeName
......@@ -101,6 +100,8 @@ public abstract class StateScalar extends HdbCollector implements IDevStateScala
final String desc = "Failed while executing " + this.getClass().getSimpleName()
+ ".removeSource() method...";
throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
} finally {
startCollecting();
}
}
......@@ -114,6 +115,7 @@ public abstract class StateScalar extends HdbCollector implements IDevStateScala
// ==
// null )
// {
stopCollecting();
IDevStateScalar attribute = null;
attribute = (IDevStateScalar) attributeList.add(attName);
......@@ -123,11 +125,7 @@ public abstract class StateScalar extends HdbCollector implements IDevStateScala
// informs the mother class that one new attribute must be
// managed
addAttribute(attName);
m_logger.trace(ILogger.LEVEL_INFO, "add archiving for " + attName);
startCollecting();
} else {
m_logger.trace(ILogger.LEVEL_ERROR, "archiving not started because attribute name is null "
+ attributeLightMode);
logger.trace(ILogger.LEVEL_INFO, "add archiving for " + attName);
}
} catch (final ConnectionException e) {
......@@ -143,6 +141,8 @@ public abstract class StateScalar extends HdbCollector implements IDevStateScala
final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
final String desc = "Failed while executing " + this.getClass().getSimpleName() + ".addSource() method...";
throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
} finally {
startCollecting();
}
}
......@@ -300,15 +300,15 @@ public abstract class StateScalar extends HdbCollector implements IDevStateScala
String attributeName = scalarEvent.getAttribute_complete_name();
try {
boolean doArchive = false;
if (isFirstValue) {
if (isFirstValueList.get(attributeName.toLowerCase())) {
doArchive = true;
isFirstValue = false;
m_logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
isFirstValueList.put(attributeName.toLowerCase(), false);
logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
} else {
final ModesCounters mc = getModeCounter(attributeName);
if (mc == null) {
m_logger.trace(ILogger.LEVEL_ERROR, attributeName + "attribute Counters unknown");
logger.trace(ILogger.LEVEL_ERROR, attributeName + "attribute Counters unknown");
} else {
doArchive = doArchiveEvent(mc, scalarEvent.getData_type(), scalarEvent.getReadValue(),
getLastValue(scalarEvent), attributeName);
......@@ -322,8 +322,8 @@ public abstract class StateScalar extends HdbCollector implements IDevStateScala
setLastValue(scalarEvent, scalarEvent.getReadValue());
} catch (final Exception e) {
final String message = "Problem storing StateScalar value";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, e);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, e);
try_number--;
if (try_number > 0) {
......@@ -358,13 +358,13 @@ public abstract class StateScalar extends HdbCollector implements IDevStateScala
final String errorMess = this.getClass().getSimpleName() + ".errorChange : Unable to read the attribute named "
+ errorEvent.getSource().toString();
Util.out3.println(errorMess);
super.m_logger.trace(ILogger.LEVEL_ERROR, errorMess);
super.logger.trace(ILogger.LEVEL_ERROR, errorMess);
try {
processEventScalar(getNullValueScalarEvent(errorEvent, TangoConst.Tango_DEV_STATE, getWritableValue()),
tryNumber);
} catch (final Exception e) {
super.m_logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
super.logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
+ ".errorChange : during processEventScalar creation execp : " + e);
e.printStackTrace();
}
......
......@@ -104,8 +104,8 @@ public class StateScalar_RO extends StateScalar {
processEventScalar(scalarEvent, tryNumber);
final String message = "Problem in StateScalar_RO/devStateScalarChange";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, exE);
}
}
......
......@@ -82,19 +82,18 @@ public abstract class StringScalar extends HdbCollector implements IStringScalar
* while ( ( IStringScalar ) attributeList.get(attributeName) !=
* null ) {
*/
stopCollecting();
final IStringScalar attribute = (IStringScalar) attributeList.get(attributeName);
if (attribute != null) {
attribute.removeStringScalarListener(this);
attribute.removeErrorListener(this);
attributeList.remove(attributeName);
isFirstValueList.remove(attributeName.toLowerCase());
Util.out4.println("\t The attribute named " + attributeName + " was fired from the Collector list...");
// informs the mother class that one new attribute must be
// removed
removeAttribute(attributeName);
removeTimestamps(attributeName);
if (attributeList.isEmpty()) {
stopCollecting();
}
}
} catch (final Exception e) {
final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed removing '" + attributeName
......@@ -103,6 +102,8 @@ public abstract class StringScalar extends HdbCollector implements IStringScalar
final String desc = "Failed while executing " + this.getClass().getSimpleName()
+ ".removeSource() method...";
throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
} finally {
startCollecting();
}
}
......@@ -113,6 +114,7 @@ public abstract class StringScalar extends HdbCollector implements IStringScalar
try {
final String attName = attributeLightMode.getAttribute_complete_name();
if (attName != null) {
stopCollecting();
IStringScalar attribute = null;
attribute = (IStringScalar) attributeList.add(attName);
......@@ -122,11 +124,7 @@ public abstract class StringScalar extends HdbCollector implements IStringScalar
// informs the mother class that one new attribute must be
// managed
addAttribute(attName);
m_logger.trace(ILogger.LEVEL_INFO, "add archiving for " + attName);
startCollecting();
} else {
m_logger.trace(ILogger.LEVEL_ERROR, "archiving not started because attribute name is null "
+ attributeLightMode);
logger.trace(ILogger.LEVEL_INFO, "add archiving for " + attName);
}
} catch (final ConnectionException e) {
final String message = GlobalConst.ARCHIVING_ERROR_PREFIX + " : " + "Failed adding '"
......@@ -141,6 +139,8 @@ public abstract class StringScalar extends HdbCollector implements IStringScalar
final String reason = GlobalConst.TANGO_COMM_EXCEPTION;
final String desc = "Failed while executing " + this.getClass().getSimpleName() + ".addSource() method...";
throw new ArchivingException(message, reason, ErrSeverity.WARN, desc, "", e);
} finally {
startCollecting();
}
}
......@@ -304,15 +304,15 @@ public abstract class StringScalar extends HdbCollector implements IStringScalar
String attributeName = scalarEvent.getAttribute_complete_name();
try {
boolean doArchive = false;
if (isFirstValue) {
if (isFirstValueList.get(attributeName.toLowerCase())) {
doArchive = true;
isFirstValue = false;
m_logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
isFirstValueList.put(attributeName.toLowerCase(), false);
logger.trace(ILogger.LEVEL_DEBUG, attributeName + " first value, forcing archiving");
} else {
final ModesCounters mc = getModeCounter(attributeName);
if (mc == null) {
m_logger.trace(ILogger.LEVEL_ERROR, attributeName + " Attribute Counters unknown");
logger.trace(ILogger.LEVEL_ERROR, attributeName + " Attribute Counters unknown");
} else {
doArchive = doArchiveEvent(mc, scalarEvent.getData_type(), scalarEvent.getReadValue(),
getLastValue(scalarEvent), attributeName);
......@@ -326,8 +326,8 @@ public abstract class StringScalar extends HdbCollector implements IStringScalar
setLastValue(scalarEvent, scalarEvent.getReadValue());
} catch (final Exception e) {
final String message = "Problem storing StringScalar value";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, e);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, e);
try_number--;
if (try_number > 0) {
......@@ -357,13 +357,13 @@ public abstract class StringScalar extends HdbCollector implements IStringScalar
final String errorMess = this.getClass().getSimpleName() + ".errorChange : Unable to read the attribute named "
+ errorEvent.getSource().toString();
Util.out3.println(errorMess);
super.m_logger.trace(ILogger.LEVEL_ERROR, errorMess);
super.logger.trace(ILogger.LEVEL_ERROR, errorMess);
try {
processEventScalar(getNullValueScalarEvent(errorEvent, TangoConst.Tango_DEV_STRING, getWritableValue()),
tryNumber);
} catch (final Exception e) {
super.m_logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
super.logger.trace(ILogger.LEVEL_ERROR, this.getClass().getSimpleName()
+ ".errorChange : during processEventScalar creation execp : " + e);
e.printStackTrace();
}
......
......@@ -102,8 +102,8 @@ public class StringScalar_RO extends StringScalar {
processEventScalar(scalarEvent, tryNumber);
final String message = "Problem in StringScalar_RO/stringScalarChange";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, exE);
}
}
......
......@@ -105,8 +105,8 @@ public class StringScalar_RW extends StringScalar {
processEventScalar(scalarEvent, tryNumber);
final String message = "Problem in StringScalar_RW/stringScalarChange";
super.m_logger.trace(ILogger.LEVEL_ERROR, message);
super.m_logger.trace(ILogger.LEVEL_ERROR, exE);
super.logger.trace(ILogger.LEVEL_ERROR, message);
super.logger.trace(ILogger.LEVEL_ERROR, exE);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment