108109110111112113114115116117118
{ vw = new VelocityWriter(pw, 4 * 1024, true); } else { vw.recycle(pw); } // Place the VelocityWriter into the Context context.put(VELOCITY_WRITER_ATTR, vw); template.merge(context, vw);
132133134135136137138139140141142
// nicely with others. vw.flush(); /* This hack sets the VelocityWriter's internal ref to the * PrintWriter to null to keep memory free while * the writer is pooled. See bug report #18951 */ vw.recycle(null); writerPool.put(vw); } } catch (Exception e) {
10041005100610071008100910101011101210131014
{ vw = new VelocityWriter(writer, 4 * 1024, true); } else { vw.recycle(writer); } performMerge(template, context, vw); } finally {
10211022102310241025102610271028102910301031
// nicely with others. vw.flush(); /* This hack sets the VelocityWriter's internal ref to the * PrintWriter to null to keep memory free while * the writer is pooled. See bug report #18951 */ vw.recycle(null); writerPool.put(vw); } catch (Exception e) { getLog().debug("Trouble releasing VelocityWriter: " +
109110111112113114115116117118119
133134135136137138139140141142143
342343344345346347348349350351352
if (velocityWriter == null) { velocityWriter = new VelocityWriter(writer, WRITER_BUFFER_SIZE, true); } else { velocityWriter.recycle(writer); } template.merge(context, velocityWriter); } catch (Exception error) {
377378379380381382383384385386387
velocityWriter.flush(); // Clear the VelocityWriter's reference to its // internal Writer to allow the latter // to be GC'd while vw is pooled. velocityWriter.recycle(null); writerPool.put(velocityWriter); } writer.flush();
419420421422423424425426427428429
if (velocityWriter == null) { velocityWriter = new VelocityWriter(writer, WRITER_BUFFER_SIZE, true); } else { velocityWriter.recycle(writer); } template.merge(velocityContext, velocityWriter); } catch (Exception error) {
454455456457458459460461462463464