Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 28271 Details for
Bug 112371
Performance and memory improvements for the three producer Common Base Event implementations.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
EventFormatterPerformancePatch.txt
EventFormatterPerformancePatch.txt (text/plain), 7.03 KB, created by
Paul Slauenwhite
on 2005-10-13 22:15:50 EDT
(
hide
)
Description:
EventFormatterPerformancePatch.txt
Filename:
MIME Type:
Creator:
Paul Slauenwhite
Created:
2005-10-13 22:15:50 EDT
Size:
7.03 KB
patch
obsolete
>Index: EventFormatter.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.logging.core/src.cbe101/org/eclipse/hyades/logging/events/cbe/util/EventFormatter.java,v >retrieving revision 1.4 >diff -u -r1.4 EventFormatter.java >--- EventFormatter.java 10 Mar 2005 17:32:22 -0000 1.4 >+++ EventFormatter.java 12 Oct 2005 01:40:40 -0000 >@@ -88,6 +88,16 @@ > */ > public final class EventFormatter { > >+ private static SAXEventHandler saxEventHandler = null; >+ >+ private static XMLReader xmlReader = null; >+ >+ /** >+ * Current thread lock for synchronization. >+ * <p> >+ */ >+ private static final Object LOCK = new Object(); >+ > private final static String COMMON_BASE_EVENT_SCHEMA_NAME = "commonbaseevent1_0_1.xsd"; > > private final static String COMMON_BASE_EVENT_SCHEMA_LOCATION_URL = resolveCommonBaseEventSchemaLocation(); >@@ -324,7 +334,13 @@ > * @since 1.0.1 > */ > public static AssociationEngine[] associationEnginesFromCanonicalXMLDoc(InputSource inputSource, boolean validate) throws FormattingException { >- return (parse(inputSource,validate).getAssociationEngines()); >+ >+ synchronized(LOCK){ >+ >+ parse(inputSource,validate); >+ >+ return (saxEventHandler.getAssociationEngines()); >+ } > } > > /** >@@ -1817,7 +1833,13 @@ > * @since 1.0.1 > */ > public static CommonBaseEvent[] eventsFromCanonicalXMLDoc(InputSource inputSource,boolean validate) throws FormattingException { >- return (parse(inputSource,validate).getCommonBaseEvents()); >+ >+ synchronized(LOCK){ >+ >+ parse(inputSource,validate); >+ >+ return (saxEventHandler.getCommonBaseEvents()); >+ } > } > > /** >@@ -2193,61 +2215,70 @@ > > return null; > } >- >- private static SAXEventHandler parse(InputSource inputSource,boolean validate) throws FormattingException{ >+ >+ private static void parse(InputSource inputSource,boolean validate) throws FormattingException{ > > try { > >- SAXEventHandler saxEventHandler = new SAXEventHandler(); >- >- XMLReader xmlReader = null; >- >- //NOTE: The Sun JDK v.1.4.x that includes the Crimson XML parser implementation >- //does not have a default XML reader implementation. >- >- //Attempt to resolve the XML reader: >- try { >- xmlReader = XMLReaderFactory.createXMLReader(); >- >- } >- catch (SAXException s) { >- >- //NOTE: The Sun JDK v.1.4.x that includes the Crimson XML parser implementation >- //uses the value of the system property "org.xml.sax.driver" as the full name of >- //XML reader Java class. >- System.setProperty("org.xml.sax.driver","org.apache.crimson.parser.XMLReaderImpl"); >- >- xmlReader = XMLReaderFactory.createXMLReader(); >- } >- >- xmlReader.setContentHandler(saxEventHandler); >- xmlReader.setErrorHandler(saxEventHandler); >- >- xmlReader.setFeature("http://xml.org/sax/features/validation", validate); >- xmlReader.setFeature("http://xml.org/sax/features/namespaces", validate); >- >- //NOTE: The Sun JDK v.1.4.x that includes the Crimson XML parser implementation >- //does not support schema validation. >- >- //Attempt to configure the XML parser to validate the XML file based on the associated schema(s): >- if(validate){ >- >- try { >- >- xmlReader.setFeature("http://apache.org/xml/features/validation/schema", true); >- xmlReader.setProperty("http://apache.org/xml/properties/schema/external-schemaLocation", "http://www.ibm.com/AC/commonbaseevent1_0_1 ".concat(COMMON_BASE_EVENT_SCHEMA_LOCATION_URL)); >- } >- catch (SAXNotRecognizedException s) { >- >- //If the XML parser cannot be configured to validate the XML file based on the associated schema(s), configure a non-validating XML parser: >- xmlReader.setFeature("http://xml.org/sax/features/validation", false); >- xmlReader.setFeature("http://xml.org/sax/features/namespaces", false); >- } >- } >- >- xmlReader.parse(inputSource); >- >- return saxEventHandler; >+ if (saxEventHandler == null) { >+ saxEventHandler = new SAXEventHandler(); >+ } >+ else { >+ saxEventHandler.init(); >+ } >+ >+ if (xmlReader == null) { >+ >+ //NOTE: The Sun JDK v.1.4.x that includes the Crimson XML parser implementation >+ //does not have a default XML reader implementation. >+ >+ //Attempt to resolve the XML reader: >+ try { >+ xmlReader = XMLReaderFactory.createXMLReader(); >+ } >+ catch (SAXException s) { >+ >+ //NOTE: The Sun JDK v.1.4.x that includes the Crimson XML parser implementation >+ //uses the value of the system property "org.xml.sax.driver" as the full name of >+ //XML reader Java class. >+ System.setProperty("org.xml.sax.driver", "org.apache.crimson.parser.XMLReaderImpl"); >+ >+ xmlReader = XMLReaderFactory.createXMLReader(); >+ } >+ >+ xmlReader.setContentHandler(saxEventHandler); >+ xmlReader.setErrorHandler(saxEventHandler); >+ } >+ >+ xmlReader.setFeature("http://xml.org/sax/features/validation",validate); >+ xmlReader.setFeature("http://xml.org/sax/features/namespaces",validate); >+ >+ //NOTE: The Sun JDK v.1.4.x that includes the Crimson XML parser implementation >+ //does not support schema validation. >+ >+ //Attempt to configure the XML parser to validate the XML file based on the associated schema(s): >+ if (validate) { >+ >+ try { >+ >+ xmlReader.setFeature("http://apache.org/xml/features/validation/schema", true); >+ xmlReader.setProperty("http://apache.org/xml/properties/schema/external-schemaLocation","http://www.ibm.com/AC/commonbaseevent1_0_1 ".concat(COMMON_BASE_EVENT_SCHEMA_LOCATION_URL)); >+ } >+ catch (SAXNotRecognizedException s) { >+ >+ //If the XML parser cannot be configured to validate the XML file based on the associated schema(s), configure a non-validating XML parser: >+ xmlReader.setFeature("http://xml.org/sax/features/validation", false); >+ xmlReader.setFeature("http://xml.org/sax/features/namespaces", false); >+ } >+ } >+ else { >+ >+ //Configure a non-validating XML parser: >+ xmlReader.setFeature("http://xml.org/sax/features/validation",false); >+ xmlReader.setFeature("http://xml.org/sax/features/namespaces",false); >+ } >+ >+ xmlReader.parse(inputSource); > } > catch (Exception e) { > throw new FormattingException(e);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 112371
:
28271
|
30229
|
30238