Yes, you can upgrade, but you'll still be required to do synchronization
for the XalanTransformer calls , which adds complication.  Plus you'll have
to rebuild Xalan against the new Xerces.

It will be interesting to see what the fix for synchronizing the Xerces
initialize() and terminate() calls looks like.  The problem is that Xerces
needs to bootstrap a mutex, and it does that in the Initialize() code.
This seems to me to be the classic chicken and egg problem.

Also, we will not be synchronizing calls to XalanTransformer::initialize()
and XalanTransformer::terminate().

Finally, you'll still have an _extremely_ inefficient situation where
you're constantly initializing and terminating things for no good reason.
Your best bet is to call initialization stuff in main() before you start
spinning off threads.

Dave



                                                                                
          
                    "Mark Weaver"                                               
          
                    <[EMAIL PROTECTED]        To:     
<[email protected]>,             
                    .uk>                 <[email protected]>         
          
                                         cc:                                    
          
                    10/30/2001           Subject:     RE: Coredump when using   
          
                    11:06 AM             XalanTransformer.transform()           
          
                                                                                
          
                                                                                
          



This is fixed in the Xerces 1.5.2 release, you might want to consider
upgrading to that if you really need this support.  However, Init/Term are
not thread-safe (there is an open bug for this).

Mark

> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED]
> Sent: 30 October 2001 15:53
> To: [email protected]
> Subject: Re: Coredump when using XalanTransformer.transform()
>
>
>
> Hi Miro,
>
> This the number one Xerces FAQ.  You cannot call XMLPlatforms::Terminate
()
> more than once per process.
>
> Although you _can_ call XalanTransformer::initialize() and
> XalanTransformer::terminate() more than once per process, it is extremely
> efficient to do so, and those calls must be synchronized at the
> application
> level.  If you're not synchronizing those calls, that's the problem.  The
> documentation for XalanTransformer::initialize() and
> XalanTransformer::terminate() is explicit about this.  From
> XalanTransformer.hpp:
>
>      /**
>       * Initialize Xalan.
>       * Should be called only once per process before creating any
>       * instances of XalanTransformer. See class XSLTInit.
>       */
>      static void
>      initialize();
>
>      /**
>       * Terminate Xalan.
>       * Should be called only once per process after deleting all
>       * instances of XalanTransformer. See class XSLTInit.
>       */
>      static void
>      terminate();
>
> This is also made quite clear in all of the sample applications we ship.
>
> I urge you to read the Xerces and Xalan documentation thoroughly
> before you
> post questions to the list.  It will save all of us, but especially
> yourself, lots of time.  If, after reading the documentation, you still
> feel these points are not clear, please feel free to post suggestions for
> the documentation to the list.
>
> By the way, transforming to an ostrstream can be extremely inefficient.
I
> suggest you take a look at the callback interfaces in XalanTransformer,
> which will allow you to get the results of the transformation directly,
> rather than writing it to a dynamically allocated string.  The
performance
> improvement will be considerable.
>
> Dave
>
>
>
>
>
>                     [EMAIL PROTECTED]
>
>                     eus.net              To:
> [email protected]
>                                          cc:     (bcc: David N
> Bertoni/CAM/Lotus)
>                     10/30/2001           Subject:     Coredump
> when using
>                     07:53 AM
> XalanTransformer.transform()
>
>
>
>
>
>
>
>
> Hello,
>
> I am using Xalan ver. 1.2 and Xerces ver. 1.5. on HP-UX 11.00. I rebuilt
> the libraries with the following options:
>
> runConfigure -p hp-11 -c cc -x aCC -d -r pthread
> gmake
>
> I am running a multithreaded application (currently only 2 threads). Each
> thread performs XSL transformation using the following code:
>
> Each thread, after it has been created, calls the initialization:
> XMLPlatformUtils::Initialize() ;
> XalanTransformer::initialize() ;
>
> before it stops, it does clean-up:
> XalanTransformer::terminate() ;
> XMLPlatformUtils::Terminate() ;
>
> and in between repeatedly (some hundreds of times) performs
transformation
> using XalanTransformer class and memory streams:
>
> XalanTransformer  theTransformer ;
>
> istrstream        theXMLStream( x.GetOutMsg(), x.GetOutMsgLength() ) ;
> istrstream        theXSLStream( pMessage->GetXSL().IntBufNotNull(),
> pMessage->GetXSL().Length() ) ;
> ostrstream  theOutStream ;
>
> // ---- Set style sheet parameter "UID" equals to ulUID
> theTransformer.setStylesheetParam( XalanDOMString(XSL_PARAM_UID),
> XalanDOMString(svUID) ) ;
> // ---- Perform Xalan transformation
> if( theTransformer.transform( &theXMLStream, &theXSLStream,
> &theOutStream )
> == 0 )
>   {
>   ...
>
> If the traffic is high, the application coredumps in call to the
transform
> () method. The stack is:
> from transform() call to /opt/aCC/include/tree.cc (14 levels incl.
> endElement and erase).
> If I am running one thread, everything is alright - no coredump.
>
> The stack:
> erase(iterator&,iterator)
> erase(iterator&,iterator,iterator)
> erase(ElemTemplateElement *&)
> endElement
> endElement
> scanEndTag
> scanContent
> scanDocument(InputSource&,?)
> parse(InputSource&,?)
> parseXMLStream(InputSource&,DocumentHandler&,XalanDOMString&)
> parseXMLStream(InputSource&,DocumentHandler&,XalanDOMString&)
> processStylesheet(XSLTInputSource&,StylesheetConstructionContext&)
> ...
> process(XSLTInputSource&,XSLTInputSource&,XSLTResultTarget&)
>
> My question is: Did I do anything wrong? Any help appreciated.
> Thanks in advance, Miro.
>
>
>
>





Reply via email to