From users-return-55068-apmail-cocoon-users-archive=cocoon.apache.org@cocoon.apache.org Tue Sep 02 09:57:41 2003 Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 99126 invoked from network); 2 Sep 2003 09:57:41 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 2 Sep 2003 09:57:41 -0000 Received: (qmail 59382 invoked by uid 500); 2 Sep 2003 09:56:57 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 59353 invoked by uid 500); 2 Sep 2003 09:56:56 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: users@cocoon.apache.org Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 59330 invoked from network); 2 Sep 2003 09:56:56 -0000 Received: from unknown (HELO mailgw.12snap.com) (213.86.173.100) by daedalus.apache.org with SMTP; 2 Sep 2003 09:56:56 -0000 Received: from greensnapper4.sw.12snap.com (unknown [192.168.255.254]) by mailgw.12snap.com (Postfix) with ESMTP id DEDA110B85B for ; Tue, 2 Sep 2003 10:53:57 +0100 (BST) Received: by greensnapper4.sw.12snap.com with Internet Mail Service (5.5.2653.19) id ; Tue, 2 Sep 2003 10:57:06 +0100 Message-ID: <81E15CF44C5077458F0D7B92C6C4336E03983C@beta.munich.12snap.com> From: Jorg Heymans To: "'users@cocoon.apache.org'" Subject: RE: thread safety of cocoon Date: Tue, 2 Sep 2003 10:56:41 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Ok now I'm confused again :) Say I have my transformer with following code (hope the indentation stays) MyTransformer extends AbstractDOMTransformer implements LogEnabled, Cacheable { //instance variable private StringBuffer sb; public void transform....{ /// } public void startDocument ... { sb=new StringBuffer(); } public void startElement(...) ...{ //add certain elements to our stringbuffer } public void endDocument ... { //process stringbuffer sb.append(...); sb.replace(....); sb = null; } } Can my stringbuffer be overwritten by the second request during processing of the first request if two near concurrent requests hit the same pipeline? Sorry to drill down into this but I need to be sure. Thanks Jorg -----Original Message----- From: Vadim Gritsenko [mailto:vadim.gritsenko@verizon.net] Sent: Montag, 1. September 2003 21:06 To: users@cocoon.apache.org Subject: Re: thread safety of cocoon Upayavira wrote: > Jorg Heymans wrote: > >> Say i write my own transformer (or serializer, or generator doesn't >> matter), > Transformers, in particular, can not be threadsafe. They are all Recyclable. This is due Transformer interface design (setContentHandler method in AbstractXMLProducer.java). Vadim >> is it true then that a new instance of my custom class is created >> each time >> it is executed in a pipeline? (uncached) >> >> My code relies on a few instance variables (simple ones like Logger >> but also >> more crucial ones like StringBuffers for SAX parsing ), I'ld really >> hate to >> find out now that instance variables aren't thread safe in cocoon. >> > AFAIU, you need to make your component implement ThreadSafe for it to > be shared across threads. The default is that a new component is > created for each invocation. > > Regards, Upayavira --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org