| Summary: | Undesirable messages appear on console due to listener registered twice | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Kevin Mooney <kmooney> |
| Component: | TPTP | Assignee: | Alex Nan <apnan> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P1 | CC: | jkubasta, jptoomey, paulslau, slavescu |
| Version: | unspecified | Keywords: | plan |
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | closed460 | ||
|
Description
Kevin Mooney
I have spent some time debugging this on the RPT side, and am changing components and adding some additional detail as a result of that investigation. I have debugged this issue, and I now understand why we're seeing this message. The problem is actually exposed by an IBM etools plug-in which adds additional support on top of what is provided by TPTP, although I believe this is simply a defect in the extensibility mechanism in TPTP (where we incorrectly interpret this condition as an error.)
TPTP has out of the box support for storing some EMF models in Cloudscape databases (CBE log, symptom databases, correlation models, etc.) When the IBM consuming product saves its statistical model, it goes through the normal TPTP Hierarchy infrastructure, which in turn reads in extensions of the org.eclipse.hyades.resources.database.database_extensions extension point. Base TPTP supports Cloudscape as a database backing store for several TPTP models in the org.eclipse.hyades.resources.database plug-in through a class called org.eclipse.hyades.resources.database.internal.extensions.cloudscape.CloudscapeExtension. This class registers its support for file extensions trcadb, corrdb and symptomdb in the following method:
protected String[] getInternalSupportedPostfixes() {
return new String[]{"__" + getCloudscapeExtensionName() + ".trcadb", "__" + getCloudscapeExtensionName() + ".corrdb","__" + getCloudscapeExtensionName() + ".symptomdb"};
}
In the IBM consuming product we also ship an IBM etools plug-in that adds support for DB2, and also adds additional correlation support for Cloudscape. That plug-in is com.ibm.etools.ac.resources.database. Within that plug-in there is another extension of the org.eclipse.hyades.resources.database.database_extensions extension point for supporting Cloudscape databases, and that extension references the class com.ibm.etools.resources.database.extension.cloudscape.CorrelationCloudscapeExtension. CorrelationCloudscapeExtension actually extends the TPTP class mentioned above (org.eclipse.hyades.resources.database.internal.extensions.cloudscape.CloudscapeExtension), but it overrides the createCorrelationCommand() method, presumably adding support for improved (non-time based) correlation.
The DatabaseRegistryReader class (org.eclipse.hyades.resources.database.internal.impl.DatabaseRegistryReader), which is responsible for making a registry of classes that support the org.eclipse.hyades.resources.database extension point, has support for registering multiple classes in for a given file extension, and the class in the etools plug-in correctly declares itself as a higher priority (2) that the superclass in the base TPTP plug-in (1). However, the DatabaseRegistryReader class incorrectly identifies this as in error condition in the readElement() method:
if (DatabaseExtensions.getInstance().containsKey(postfix) && ((Float)getPriorities().get(postfix)).floatValue() >= priority) {
logError(element, "A databaseExtension for postfix \""+postfix+"\" with higher or equal priority already exists, databaseExtension \""+databaseExtensions+"\" will be ignored.");
} else {
DatabaseExtensions.getInstance().put(postfix, databaseExtensions);
getPriorities().put(postfix,new Float(priority));
}
This logError method writes these spurious error messages to the console, which is quite ugly for *nix users who routinely see all console output and may interpret this as a real error.
Below is a stack trace that shows roughly how the consuming product gets to the offending method in DatabaseRegistryReader:
Thread [TCPDataFiller] (Suspended (breakpoint at line 80 in DatabaseRegistryReader))
DatabaseRegistryReader.readElement(HyadesConfigurationElement) line: 80
DatabaseRegistryReader(RegistryReader).internalReadElement(HyadesConfigurationElement) line: 306
DatabaseRegistryReader(RegistryReader).platformReadRegistry() line: 326
DatabaseRegistryReader(RegistryReader).readRegistry() line: 225
DatabaseExtensions.getInstance() line: 46
DBHyadesResourceExtension.getSupportedPostfixes() line: 297
HyadesResourceRegistryReader.readElement(HyadesConfigurationElement) line: 209
HyadesResourceRegistryReader(RegistryReader).internalReadElement(HyadesConfigurationElement) line: 306
HyadesResourceRegistryReader(RegistryReader).platformReadRegistry() line: 326
HyadesResourceRegistryReader(RegistryReader).readRegistry() line: 225
HyadesResourceExtensions.getInstance() line: 47
TRCAgentImpl.getDefaultEvents() line: 440
TRCAgentImpl.eGet(int, boolean, boolean) line: 704
TRCAgentImpl(BasicEObjectImpl).eGet(EStructuralFeature, boolean, boolean) line: 595
TRCAgentImpl(BasicEObjectImpl).eGet(EStructuralFeature, boolean) line: 587
HierarchyXMIResourceImpl.traverseContaintment(EObject) line: 448
HierarchyXMIResourceImpl.buildObjectsMap() line: 429
HierarchyXMIResourceImpl.doSave(OutputStream, Map) line: 411
HierarchyXMIResourceImpl(ResourceImpl).save(OutputStream, Map) line: 993
HierarchyXMIResourceImpl(ResourceImpl).save(Map) line: 881
<...> product code <...>
TCPDataServer$TCPDataProcessorNew.writeMessage(int, byte[]) line: 1015
TCPDataServer$TCPDataProcessorNew.processCurrentBuffer() line: 961
TCPDataServer$TCPDataProcessorNew.run() line: 706
Having said all that, I recommend a simple fix to org.eclipse.hyades.resources.database.internal.impl.DatabaseRegistryReader.readElement(HyadesConfigurationElement) that only emits an error message if two classes are registered for the same postfix with the same priority. If multiple classes are registered with different priorities, then the higher priority one should win and there's no ambiguity as to which one should be used. We shouldn't report that as an error condition. Marius, can you recommend an owner for this defect? If you agree with my suggestion, we'd really like to get this fixed in 4.5. Thanks, --Joe (In reply to comment #4) > Marius, can you recommend an owner for this defect? If you agree with my > suggestion, we'd really like to get this fixed in 4.5. > > Thanks, > --Joe > Thanks Joe. Can you please update the hours worked in debugging this symptom? Since this defected is related to the log/stats model, Alex would be the most likely candidate to integrate the fix. Updating hours worked per Paul's request. I've changed the method org.eclipse.hyades.resources.database.internal.impl.DatabaseRegistryReader.readElement(HyadesConfigurationElement) to log the message only when running in model debug mode, i.e. ModelDebugger.INSTANCE.debug flag turned on. By default this flag if off. As of TPTP 4.6.0, TPTP is in maintenance mode and focusing on improving quality by resolving relevant enhancements/defects and increasing test coverage through test creation, automation, Build Verification Tests (BVTs), and expanded run-time execution. As part of the TPTP Bugzilla housecleaning process (see http://wiki.eclipse.org/Bugzilla_Housecleaning_Processes), this enhancement/defect is verified/closed by the Project Lead since this enhancement/defect has been resolved and unverified for more than 1 year and considered to be fixed. If this enhancement/defect is still unresolved and reproducible in the latest TPTP release (http://www.eclipse.org/tptp/home/downloads/), please re-open. As of TPTP 4.6.0, TPTP is in maintenance mode and focusing on improving quality by resolving relevant enhancements/defects and increasing test coverage through test creation, automation, Build Verification Tests (BVTs), and expanded run-time execution. As part of the TPTP Bugzilla housecleaning process (see http://wiki.eclipse.org/Bugzilla_Housecleaning_Processes), this enhancement/defect is verified/closed by the Project Lead since this enhancement/defect has been resolved and unverified for more than 1 year and considered to be fixed. If this enhancement/defect is still unresolved and reproducible in the latest TPTP release (http://www.eclipse.org/tptp/home/downloads/), please re-open. |