velocity-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 8838] - context utility method calls are not thread safe
Date Mon, 06 May 2002 20:25:33 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8838>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8838

context utility method calls are not thread safe





------- Additional Comments From ivan.bella@capita.com  2002-05-06 20:25 -------
1) I am absolutely sure that a new context is created per merge as the
   context is created just before I merge (in the same method).
2) I am absolutely sure that a new writer is create per merge as that is
   also create just before the merge (in the same method).  The writer
   is an OutputStreamWriter on top of a ByteArrayOutputStream:

The method that runs within one thread looks like this:

  VelocityContext context = new VelocityContext();
  context.put("DO", dataObject);
  context.put("Parts", new Parts());

  ByteArrayOutputStream stream = new ByteArrayOutputStream();
  Writer writer = new OutputStreamWriter(stream, "ISO98859-1");

  Velocity.mergeTemplate(templateFile, "ISO8859-1", context, writer);

3) The Parts instance and the dataObject are completely new objects each time.
   I verified this just to make sure.  Parts is simply a utility class as
   described.  The dataObject is a data model with simple get and put methods.

I really tried to take this one down to ground to verify it was not something
in my code.

--
To unsubscribe, e-mail:   <mailto:velocity-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-dev-help@jakarta.apache.org>


Mime
View raw message