You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Andres Portillo <an...@veratech.com.mx> on 2001/08/13 19:17:57 UTC
How to get src for version shipped with TDK 2.1?
Hi All,
I'm trying to the get the src for the turbine version shipped with
the TDK 2.1. (I want this b/c I want to track a bug and I would like to
have the exact same version). I have get from the CVS the Turbine code
with the tag: "T_2_1_0", and compile it.
(running build-turbine.bat); but I noticed some differences between the
jar I just compile and the jar included with TDK 2.1
The most obvious one is the name, since the jar shipped is called
"turbine-2.1.jar" and the one I got is called
"turbine-2.1-dev-unreleased.jar" and also the files sizes are different
the first one has 671 KB and the second one has 651 KB. Any idea?
Thanks in advance.
andres
--
=============================================
Andres G. Portillo D.
Software Engineer
Veratech (www.veratech.com.mx)
=============================================
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Memory problem using TurbineVelocity.handleRequest
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
What you are experiencing with the Context reuse is that the Context
'learns' about the template as it goes through the syntax tree.
When you are hitting lots of different templates, or don't have caching
on, the context scoops up information for each of the templates (w/o
caching, they are considered different templates...)
This issue is not a bug, and is discussed in the developers guide:
http://jakarta.apache.org/velocity/developer-guide.html#Other Context
Issues
See if that helps.
geir
Aravinda Ghosh Addala wrote:
>
> Hello,
>
> I posted the following message in Turbine mailing list. Sorry, if it is not
> relevant.
>
> Thanks,
> Aravinda.
>
> -----Original Message-----
> From: Aravinda Ghosh Addala [mailto:aravinda_addala@majorband.co.uk]
> Sent: Thursday, August 16, 2001 14:27
> To: turbine-dev@jakarta.apache.org
> Subject: RE: Memory problem using TurbineVelocity.handleRequest
>
> Thanks a lot.
>
> I tried with caching turned on, but it didn't help.
>
> But, when I created context everytime in the loop, there was no memory leak.
> I tried this 100,000 iterations.
>
> I will definitely post it in velocity-dev list.
>
> Aravinda.
>
> -----Original Message-----
> From: jmcnally [mailto:jmcnally]On Behalf Of John McNally
> Sent: Wednesday, August 15, 2001 21:14
> To: turbine-dev@jakarta.apache.org
> Subject: Re: Memory problem using TurbineVelocity.handleRequest
>
> Torque was having a memory problem similar to this and it was solved (I
> thought), but maybe I only fixed the problem enough for an average size
> schema to pass through.
>
> A memory problem was occuring in velocity when passing the same Context
> to multiple templates (or the same template multiple times.) The
> problem does not occur if you are caching templates, so make sure you
> have that turned on. If you are still experiencing the problem you
> should try restructuring the code, so that you are creating a new
> Context for each pass through the loop.
>
> I think this is a velocity issue, so you might want to let them in on
> what your findings are.
>
> john mcnally
>
> Aravinda Ghosh Addala wrote:
> >
> > Hi,
> >
> > I have bit strange memory problem. I wrote a java application that uses
> > standalone Turbine to
> > send emails using qmail. I have chosen turbine standalone to use different
> > services, importantyly
> > TurbineVelocity.
> >
> > I have to call TurbineVelocity.handleRequest method in a loop to send
> > several emails using qmail.
> >
> > This application seems to have memory problems and ultimately crashing due
> > to out of memory.
> >
> > I tried to find out the memory used (using java.lang.Runtime) and figured
> > out that if I comment
> > TurbineVelocity.handleRequest call there was no memory leak at all. I have
> > to use this call 500,000 times
> > in a loop.
> >
> > I am using TDK 2.1.
> >
> > Any suggestions are much appreciated
> >
> > Thanks,
> > Aravinda
> >
> > My code looks like this:
> >
> > // Turbine
> > import org.apache.velocity.context.Context;
> > import org.apache.turbine.util.TurbineConfig;
> > import org.apache.turbine.services.resources.TurbineResources;
> > import org.apache.turbine.services.velocity.TurbineVelocity;
> > import org.apache.turbine.Turbine;
> > import org.apache.turbine.util.Log;
> > import org.apache.turbine.util.ServerData;
> > import org.apache.turbine.util.template.TemplateLink;
> > import org.apache.turbine.util.db.pool.DBConnection;
> > import org.apache.turbine.services.db.TurbineDB;
> >
> > //My imports here
> >
> > /**
> > * Application to stream emails to customers using qmail-inject
> > *
> > * @author Aravinda
> > * @version 0.1
> > */
> > public class SendBulkMails
> > {
> >
> > public SendBulkMails() throws Exception
> > {
> > //SOME OTHER CODE
> >
> > //Initializing turbine
> > TurbineConfig tc = new TurbineConfig(".",
> > "conf/TurbineResources.properties");
> > Turbine turbine = new Turbine();
> > turbine.init(tc);
> >
> > }
> >
> > public static void main (String args[])
> > {
> > try
> > {
> > long before;
> > long after;
> > float time;
> >
> > // Create a stream to the log file
> > FileOutputStream fo = new FileOutputStream("logs/timer.log");
> > PrintStream ps = new PrintStream(fo);
> >
> > // Initliase turbine
> >
> > SendBulkMails mail = new SendBulkMails();
> >
> > // Get the context
> > Context context = TurbineVelocity.getContext();
> >
> > before = System.currentTimeMillis();
> >
> > int i = 0;
> >
> > while(i < numberOfUsers)
> > {
> >
> > customer = new Customer();
> > //Other objects
> >
> > context.put("Customer" , customer);
> >
> > //increment mail count
> > i++;
> >
> > ps.println("Used Mem : " +
> > (java.lang.Runtime.getRuntime().totalMemory() -
> > java.lang.Runtime.getRuntime().freeMemory()));
> >
> > //send template output to System.out
> >
> > TurbineVelocity.handleRequest(context, sEmailTemplate,
> > System.out);
> >
> > System.out.print("\n\n");
> >
> > context.remove("Customer");
> >
> > //TurbineVelocity.requestFinished(context);
> >
> > customer = null;
> > //other objects = null;
> >
> > }
> >
> > after = System.currentTimeMillis();
> >
> > time = (after - before) / 1000f;
> >
> > ps.println("-- Sent " + i + " emails in " + time + "
> seconds! --");
> >
> > // Close the log stream
> > ps.close();
> > fo.close();
> > }
> > catch(Exception e)
> > {
> > //Log error and exis
> > System.exit(1);
> >
> > }
> > }
> >
> > }
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
Developing for the web? See http://jakarta.apache.org/velocity/
Well done is better than well said - New England Proverb
Memory problem using TurbineVelocity.handleRequest
Posted by Aravinda Ghosh Addala <ar...@majorband.co.uk>.
Hello,
I posted the following message in Turbine mailing list. Sorry, if it is not
relevant.
Thanks,
Aravinda.
-----Original Message-----
From: Aravinda Ghosh Addala [mailto:aravinda_addala@majorband.co.uk]
Sent: Thursday, August 16, 2001 14:27
To: turbine-dev@jakarta.apache.org
Subject: RE: Memory problem using TurbineVelocity.handleRequest
Thanks a lot.
I tried with caching turned on, but it didn't help.
But, when I created context everytime in the loop, there was no memory leak.
I tried this 100,000 iterations.
I will definitely post it in velocity-dev list.
Aravinda.
-----Original Message-----
From: jmcnally [mailto:jmcnally]On Behalf Of John McNally
Sent: Wednesday, August 15, 2001 21:14
To: turbine-dev@jakarta.apache.org
Subject: Re: Memory problem using TurbineVelocity.handleRequest
Torque was having a memory problem similar to this and it was solved (I
thought), but maybe I only fixed the problem enough for an average size
schema to pass through.
A memory problem was occuring in velocity when passing the same Context
to multiple templates (or the same template multiple times.) The
problem does not occur if you are caching templates, so make sure you
have that turned on. If you are still experiencing the problem you
should try restructuring the code, so that you are creating a new
Context for each pass through the loop.
I think this is a velocity issue, so you might want to let them in on
what your findings are.
john mcnally
Aravinda Ghosh Addala wrote:
>
> Hi,
>
> I have bit strange memory problem. I wrote a java application that uses
> standalone Turbine to
> send emails using qmail. I have chosen turbine standalone to use different
> services, importantyly
> TurbineVelocity.
>
> I have to call TurbineVelocity.handleRequest method in a loop to send
> several emails using qmail.
>
> This application seems to have memory problems and ultimately crashing due
> to out of memory.
>
> I tried to find out the memory used (using java.lang.Runtime) and figured
> out that if I comment
> TurbineVelocity.handleRequest call there was no memory leak at all. I have
> to use this call 500,000 times
> in a loop.
>
> I am using TDK 2.1.
>
> Any suggestions are much appreciated
>
> Thanks,
> Aravinda
>
> My code looks like this:
>
> // Turbine
> import org.apache.velocity.context.Context;
> import org.apache.turbine.util.TurbineConfig;
> import org.apache.turbine.services.resources.TurbineResources;
> import org.apache.turbine.services.velocity.TurbineVelocity;
> import org.apache.turbine.Turbine;
> import org.apache.turbine.util.Log;
> import org.apache.turbine.util.ServerData;
> import org.apache.turbine.util.template.TemplateLink;
> import org.apache.turbine.util.db.pool.DBConnection;
> import org.apache.turbine.services.db.TurbineDB;
>
> //My imports here
>
> /**
> * Application to stream emails to customers using qmail-inject
> *
> * @author Aravinda
> * @version 0.1
> */
> public class SendBulkMails
> {
>
> public SendBulkMails() throws Exception
> {
> //SOME OTHER CODE
>
> //Initializing turbine
> TurbineConfig tc = new TurbineConfig(".",
> "conf/TurbineResources.properties");
> Turbine turbine = new Turbine();
> turbine.init(tc);
>
> }
>
> public static void main (String args[])
> {
> try
> {
> long before;
> long after;
> float time;
>
> // Create a stream to the log file
> FileOutputStream fo = new FileOutputStream("logs/timer.log");
> PrintStream ps = new PrintStream(fo);
>
> // Initliase turbine
>
> SendBulkMails mail = new SendBulkMails();
>
> // Get the context
> Context context = TurbineVelocity.getContext();
>
> before = System.currentTimeMillis();
>
> int i = 0;
>
> while(i < numberOfUsers)
> {
>
> customer = new Customer();
> //Other objects
>
> context.put("Customer" , customer);
>
> //increment mail count
> i++;
>
> ps.println("Used Mem : " +
> (java.lang.Runtime.getRuntime().totalMemory() -
> java.lang.Runtime.getRuntime().freeMemory()));
>
> //send template output to System.out
>
> TurbineVelocity.handleRequest(context, sEmailTemplate,
> System.out);
>
> System.out.print("\n\n");
>
> context.remove("Customer");
>
> //TurbineVelocity.requestFinished(context);
>
> customer = null;
> //other objects = null;
>
> }
>
> after = System.currentTimeMillis();
>
> time = (after - before) / 1000f;
>
> ps.println("-- Sent " + i + " emails in " + time + "
seconds! --");
>
> // Close the log stream
> ps.close();
> fo.close();
> }
> catch(Exception e)
> {
> //Log error and exis
> System.exit(1);
>
> }
> }
>
> }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
RE: Memory problem using TurbineVelocity.handleRequest
Posted by Aravinda Ghosh Addala <ar...@majorband.co.uk>.
Thanks a lot.
I tried with caching turned on, but it didn't help.
But, when I created context everytime in the loop, there was no memory leak.
I tried this 100,000 iterations.
I will definitely post it in velocity-dev list.
Aravinda.
-----Original Message-----
From: jmcnally [mailto:jmcnally]On Behalf Of John McNally
Sent: Wednesday, August 15, 2001 21:14
To: turbine-dev@jakarta.apache.org
Subject: Re: Memory problem using TurbineVelocity.handleRequest
Torque was having a memory problem similar to this and it was solved (I
thought), but maybe I only fixed the problem enough for an average size
schema to pass through.
A memory problem was occuring in velocity when passing the same Context
to multiple templates (or the same template multiple times.) The
problem does not occur if you are caching templates, so make sure you
have that turned on. If you are still experiencing the problem you
should try restructuring the code, so that you are creating a new
Context for each pass through the loop.
I think this is a velocity issue, so you might want to let them in on
what your findings are.
john mcnally
Aravinda Ghosh Addala wrote:
>
> Hi,
>
> I have bit strange memory problem. I wrote a java application that uses
> standalone Turbine to
> send emails using qmail. I have chosen turbine standalone to use different
> services, importantyly
> TurbineVelocity.
>
> I have to call TurbineVelocity.handleRequest method in a loop to send
> several emails using qmail.
>
> This application seems to have memory problems and ultimately crashing due
> to out of memory.
>
> I tried to find out the memory used (using java.lang.Runtime) and figured
> out that if I comment
> TurbineVelocity.handleRequest call there was no memory leak at all. I have
> to use this call 500,000 times
> in a loop.
>
> I am using TDK 2.1.
>
> Any suggestions are much appreciated
>
> Thanks,
> Aravinda
>
> My code looks like this:
>
> // Turbine
> import org.apache.velocity.context.Context;
> import org.apache.turbine.util.TurbineConfig;
> import org.apache.turbine.services.resources.TurbineResources;
> import org.apache.turbine.services.velocity.TurbineVelocity;
> import org.apache.turbine.Turbine;
> import org.apache.turbine.util.Log;
> import org.apache.turbine.util.ServerData;
> import org.apache.turbine.util.template.TemplateLink;
> import org.apache.turbine.util.db.pool.DBConnection;
> import org.apache.turbine.services.db.TurbineDB;
>
> //My imports here
>
> /**
> * Application to stream emails to customers using qmail-inject
> *
> * @author Aravinda
> * @version 0.1
> */
> public class SendBulkMails
> {
>
> public SendBulkMails() throws Exception
> {
> //SOME OTHER CODE
>
> //Initializing turbine
> TurbineConfig tc = new TurbineConfig(".",
> "conf/TurbineResources.properties");
> Turbine turbine = new Turbine();
> turbine.init(tc);
>
> }
>
> public static void main (String args[])
> {
> try
> {
> long before;
> long after;
> float time;
>
> // Create a stream to the log file
> FileOutputStream fo = new FileOutputStream("logs/timer.log");
> PrintStream ps = new PrintStream(fo);
>
> // Initliase turbine
>
> SendBulkMails mail = new SendBulkMails();
>
> // Get the context
> Context context = TurbineVelocity.getContext();
>
> before = System.currentTimeMillis();
>
> int i = 0;
>
> while(i < numberOfUsers)
> {
>
> customer = new Customer();
> //Other objects
>
> context.put("Customer" , customer);
>
> //increment mail count
> i++;
>
> ps.println("Used Mem : " +
> (java.lang.Runtime.getRuntime().totalMemory() -
> java.lang.Runtime.getRuntime().freeMemory()));
>
> //send template output to System.out
>
> TurbineVelocity.handleRequest(context, sEmailTemplate,
> System.out);
>
> System.out.print("\n\n");
>
> context.remove("Customer");
>
> //TurbineVelocity.requestFinished(context);
>
> customer = null;
> //other objects = null;
>
> }
>
> after = System.currentTimeMillis();
>
> time = (after - before) / 1000f;
>
> ps.println("-- Sent " + i + " emails in " + time + "
seconds! --");
>
> // Close the log stream
> ps.close();
> fo.close();
> }
> catch(Exception e)
> {
> //Log error and exis
> System.exit(1);
>
> }
> }
>
> }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
Re: Memory problem using TurbineVelocity.handleRequest
Posted by John McNally <jm...@collab.net>.
Torque was having a memory problem similar to this and it was solved (I
thought), but maybe I only fixed the problem enough for an average size
schema to pass through.
A memory problem was occuring in velocity when passing the same Context
to multiple templates (or the same template multiple times.) The
problem does not occur if you are caching templates, so make sure you
have that turned on. If you are still experiencing the problem you
should try restructuring the code, so that you are creating a new
Context for each pass through the loop.
I think this is a velocity issue, so you might want to let them in on
what your findings are.
john mcnally
Aravinda Ghosh Addala wrote:
>
> Hi,
>
> I have bit strange memory problem. I wrote a java application that uses
> standalone Turbine to
> send emails using qmail. I have chosen turbine standalone to use different
> services, importantyly
> TurbineVelocity.
>
> I have to call TurbineVelocity.handleRequest method in a loop to send
> several emails using qmail.
>
> This application seems to have memory problems and ultimately crashing due
> to out of memory.
>
> I tried to find out the memory used (using java.lang.Runtime) and figured
> out that if I comment
> TurbineVelocity.handleRequest call there was no memory leak at all. I have
> to use this call 500,000 times
> in a loop.
>
> I am using TDK 2.1.
>
> Any suggestions are much appreciated
>
> Thanks,
> Aravinda
>
> My code looks like this:
>
> // Turbine
> import org.apache.velocity.context.Context;
> import org.apache.turbine.util.TurbineConfig;
> import org.apache.turbine.services.resources.TurbineResources;
> import org.apache.turbine.services.velocity.TurbineVelocity;
> import org.apache.turbine.Turbine;
> import org.apache.turbine.util.Log;
> import org.apache.turbine.util.ServerData;
> import org.apache.turbine.util.template.TemplateLink;
> import org.apache.turbine.util.db.pool.DBConnection;
> import org.apache.turbine.services.db.TurbineDB;
>
> //My imports here
>
> /**
> * Application to stream emails to customers using qmail-inject
> *
> * @author Aravinda
> * @version 0.1
> */
> public class SendBulkMails
> {
>
> public SendBulkMails() throws Exception
> {
> //SOME OTHER CODE
>
> //Initializing turbine
> TurbineConfig tc = new TurbineConfig(".",
> "conf/TurbineResources.properties");
> Turbine turbine = new Turbine();
> turbine.init(tc);
>
> }
>
> public static void main (String args[])
> {
> try
> {
> long before;
> long after;
> float time;
>
> // Create a stream to the log file
> FileOutputStream fo = new FileOutputStream("logs/timer.log");
> PrintStream ps = new PrintStream(fo);
>
> // Initliase turbine
>
> SendBulkMails mail = new SendBulkMails();
>
> // Get the context
> Context context = TurbineVelocity.getContext();
>
> before = System.currentTimeMillis();
>
> int i = 0;
>
> while(i < numberOfUsers)
> {
>
> customer = new Customer();
> //Other objects
>
> context.put("Customer" , customer);
>
> //increment mail count
> i++;
>
> ps.println("Used Mem : " +
> (java.lang.Runtime.getRuntime().totalMemory() -
> java.lang.Runtime.getRuntime().freeMemory()));
>
> //send template output to System.out
>
> TurbineVelocity.handleRequest(context, sEmailTemplate,
> System.out);
>
> System.out.print("\n\n");
>
> context.remove("Customer");
>
> //TurbineVelocity.requestFinished(context);
>
> customer = null;
> //other objects = null;
>
> }
>
> after = System.currentTimeMillis();
>
> time = (after - before) / 1000f;
>
> ps.println("-- Sent " + i + " emails in " + time + " seconds! --");
>
> // Close the log stream
> ps.close();
> fo.close();
> }
> catch(Exception e)
> {
> //Log error and exis
> System.exit(1);
>
> }
> }
>
> }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
RE: Memory problem using TurbineVelocity.handleRequest
Posted by Gareth Coltman <ga...@majorband.co.uk>.
Hi,
I know that this has been discussed before but I have search user and dev archives at www.mail-archive.com and can't find any
details. We are running a turbine app for lots of users and we have just moved deployed unto multiple web-servers with sticky
sessions using the IP. We have started to experience "infinite redirect" errors when requesting any page. If you close your browser
these go away - sometimes.
I have a suspicion it might be something to do with timedout sessions.
Anyway, if this is a problem that has been solved already please point me at the correct reading material!
Thanks
Gareth
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
RE: Memory problem using TurbineVelocity.handleRequest
Posted by Gareth Coltman <ga...@majorband.co.uk>.
Hi,
I know that this has been discussed before but I have search user and dev archives at www.mail-archive.com and can't find any
details. We are running a turbine app for lots of users and we have just moved deployed unto multiple web-servers with sticky
sessions using the IP. We have started to experience "infinite redirect" errors when requesting any page. If you close your browser
these go away - sometimes.
I have a suspicion it might be something to do with timedout sessions.
Anyway, if this is a problem that has been solved already please point me at the correct reading material!
Thanks
Gareth
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
Memory problem using TurbineVelocity.handleRequest
Posted by Aravinda Ghosh Addala <ar...@majorband.co.uk>.
Hi,
I have bit strange memory problem. I wrote a java application that uses
standalone Turbine to
send emails using qmail. I have chosen turbine standalone to use different
services, importantyly
TurbineVelocity.
I have to call TurbineVelocity.handleRequest method in a loop to send
several emails using qmail.
This application seems to have memory problems and ultimately crashing due
to out of memory.
I tried to find out the memory used (using java.lang.Runtime) and figured
out that if I comment
TurbineVelocity.handleRequest call there was no memory leak at all. I have
to use this call 500,000 times
in a loop.
I am using TDK 2.1.
Any suggestions are much appreciated
Thanks,
Aravinda
My code looks like this:
// Turbine
import org.apache.velocity.context.Context;
import org.apache.turbine.util.TurbineConfig;
import org.apache.turbine.services.resources.TurbineResources;
import org.apache.turbine.services.velocity.TurbineVelocity;
import org.apache.turbine.Turbine;
import org.apache.turbine.util.Log;
import org.apache.turbine.util.ServerData;
import org.apache.turbine.util.template.TemplateLink;
import org.apache.turbine.util.db.pool.DBConnection;
import org.apache.turbine.services.db.TurbineDB;
//My imports here
/**
* Application to stream emails to customers using qmail-inject
*
* @author Aravinda
* @version 0.1
*/
public class SendBulkMails
{
public SendBulkMails() throws Exception
{
//SOME OTHER CODE
//Initializing turbine
TurbineConfig tc = new TurbineConfig(".",
"conf/TurbineResources.properties");
Turbine turbine = new Turbine();
turbine.init(tc);
}
public static void main (String args[])
{
try
{
long before;
long after;
float time;
// Create a stream to the log file
FileOutputStream fo = new FileOutputStream("logs/timer.log");
PrintStream ps = new PrintStream(fo);
// Initliase turbine
SendBulkMails mail = new SendBulkMails();
// Get the context
Context context = TurbineVelocity.getContext();
before = System.currentTimeMillis();
int i = 0;
while(i < numberOfUsers)
{
customer = new Customer();
//Other objects
context.put("Customer" , customer);
//increment mail count
i++;
ps.println("Used Mem : " +
(java.lang.Runtime.getRuntime().totalMemory() -
java.lang.Runtime.getRuntime().freeMemory()));
//send template output to System.out
TurbineVelocity.handleRequest(context, sEmailTemplate,
System.out);
System.out.print("\n\n");
context.remove("Customer");
//TurbineVelocity.requestFinished(context);
customer = null;
//other objects = null;
}
after = System.currentTimeMillis();
time = (after - before) / 1000f;
ps.println("-- Sent " + i + " emails in " + time + " seconds! --");
// Close the log stream
ps.close();
fo.close();
}
catch(Exception e)
{
//Log error and exis
System.exit(1);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Memory problem using TurbineVelocity.handleRequest
Posted by Aravinda Ghosh Addala <ar...@majorband.co.uk>.
Hi,
I have bit strange memory problem. I wrote a java application that uses
standalone Turbine to
send emails using qmail. I have chosen turbine standalone to use different
services, importantyly
TurbineVelocity.
I have to call TurbineVelocity.handleRequest method in a loop to send
several emails using qmail.
This application seems to have memory problems and ultimately crashing due
to out of memory.
I tried to find out the memory used (using java.lang.Runtime) and figured
out that if I comment
TurbineVelocity.handleRequest call there was no memory leak at all. I have
to use this call 500,000 times
in a loop.
I am using TDK 2.1.
Any suggestions are much appreciated
Thanks,
Aravinda
My code looks like this:
// Turbine
import org.apache.velocity.context.Context;
import org.apache.turbine.util.TurbineConfig;
import org.apache.turbine.services.resources.TurbineResources;
import org.apache.turbine.services.velocity.TurbineVelocity;
import org.apache.turbine.Turbine;
import org.apache.turbine.util.Log;
import org.apache.turbine.util.ServerData;
import org.apache.turbine.util.template.TemplateLink;
import org.apache.turbine.util.db.pool.DBConnection;
import org.apache.turbine.services.db.TurbineDB;
//My imports here
/**
* Application to stream emails to customers using qmail-inject
*
* @author Aravinda
* @version 0.1
*/
public class SendBulkMails
{
public SendBulkMails() throws Exception
{
//SOME OTHER CODE
//Initializing turbine
TurbineConfig tc = new TurbineConfig(".",
"conf/TurbineResources.properties");
Turbine turbine = new Turbine();
turbine.init(tc);
}
public static void main (String args[])
{
try
{
long before;
long after;
float time;
// Create a stream to the log file
FileOutputStream fo = new FileOutputStream("logs/timer.log");
PrintStream ps = new PrintStream(fo);
// Initliase turbine
SendBulkMails mail = new SendBulkMails();
// Get the context
Context context = TurbineVelocity.getContext();
before = System.currentTimeMillis();
int i = 0;
while(i < numberOfUsers)
{
customer = new Customer();
//Other objects
context.put("Customer" , customer);
//increment mail count
i++;
ps.println("Used Mem : " +
(java.lang.Runtime.getRuntime().totalMemory() -
java.lang.Runtime.getRuntime().freeMemory()));
//send template output to System.out
TurbineVelocity.handleRequest(context, sEmailTemplate,
System.out);
System.out.print("\n\n");
context.remove("Customer");
//TurbineVelocity.requestFinished(context);
customer = null;
//other objects = null;
}
after = System.currentTimeMillis();
time = (after - before) / 1000f;
ps.println("-- Sent " + i + " emails in " + time + " seconds! --");
// Close the log stream
ps.close();
fo.close();
}
catch(Exception e)
{
//Log error and exis
System.exit(1);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
Re: How to get src for version shipped with TDK 2.1?
Posted by Andres Portillo <an...@veratech.com.mx>.
Hi Eric,
Thanks for the reply. I already download this file, but since it
contains the only the src code (and not the build environment) I need to
copy some stuff from the CVS version to be able to compile it. I have now
the jar version for that src. (The file size is still different 675 KB vs
671 KB, but I think I will use this version since I'm kind of short of
time).
I appreciate your help.
andres
Eric Dobbs wrote:
> On Monday, August 13, 2001, at 11:17 AM, Andres Portillo wrote:
>
> > I'm trying to the get the src for the turbine version shipped with
> > the TDK 2.1.
>
> Is this what you're looking for?
> http://jakarta.apache.org/builds/jakarta-
> turbine/release/2.1/turbine-src-2.1.tar.gz
>
> -Eric
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
--
=============================================
Andres G. Portillo D.
Software Engineer
Veratech (www.veratech.com.mx)
=============================================
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: How to get src for version shipped with TDK 2.1?
Posted by Eric Dobbs <er...@dobbse.net>.
On Monday, August 13, 2001, at 11:17 AM, Andres Portillo wrote:
> I'm trying to the get the src for the turbine version shipped with
> the TDK 2.1.
Is this what you're looking for?
http://jakarta.apache.org/builds/jakarta-
turbine/release/2.1/turbine-src-2.1.tar.gz
-Eric
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org