Package org.apache.velocity.io

Examples of org.apache.velocity.io.VelocityWriter.recycle()


            {
                vw = new VelocityWriter(new OutputStreamWriter(output, encoding), 4*1024, true);
            }
            else
            {
                vw.recycle(new OutputStreamWriter(output, encoding));
            }
          
            template.merge(context, vw);
        }
        finally
View Full Code Here


            {
                vw = new VelocityWriter(writer, 4 * 1024, true);
            }
            else
            {
                vw.recycle(writer);
            }
            performMerge(template, context, vw);
        }
        finally
        {
View Full Code Here

                    // 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)
                {
                    velocity.debug("VelocityViewServlet: " +
View Full Code Here

                                                               encoding),
                                        4 * 1024, true);
            }
            else
            {
                vw.recycle(new OutputStreamWriter(output, encoding));
            }
          
            template.merge(context, vw);
        }
        finally
View Full Code Here

                    /*
                     * Clear the VelocityWriter's reference to its
                     * internal OutputStreamWriter to allow the latter
                     * to be GC'd while vw is pooled.
                     */
                    vw.recycle(null);

                    writerPool.put(vw);
                }
            }
            catch (Exception e)
View Full Code Here

        try {
            vw = (VelocityWriter) writerPool.get();
            if (vw == null)
                vw = new VelocityWriter(new OutputStreamWriter(out, encoding), 4 * 1024, true);
            else
                vw.recycle(new OutputStreamWriter(out, encoding));

            if (vw == null)
                Debug.logWarning("[VelocityViewHandler.eval] : VelocityWriter is NULL", module);

            template.merge(context, vw);
View Full Code Here

            if (velocityWriter == null) {
                velocityWriter =
                    new VelocityWriter(writer, WRITER_BUFFER_SIZE, true);

            } else {
                velocityWriter.recycle(writer);
            }

            template.merge(context, velocityWriter);

        } catch (Exception error) {
View Full Code Here

                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();
View Full Code Here

            if (velocityWriter == null) {
                velocityWriter =
                    new VelocityWriter(writer, WRITER_BUFFER_SIZE, true);

            } else {
                velocityWriter.recycle(writer);
            }

            template.merge(velocityContext, velocityWriter);

        } catch (Exception error) {
View Full Code Here

                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();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.