It looks like a great idea. I really didn’t know about that 
ServletContextListener. I've just finished reading a little tutorial and it 
seems very easy to use. I'll tell you something later.

Thanks,
Nuno

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Yoav Shapira
Sent: quinta-feira, 16 de Novembro de 2006 15:56
To: Tomcat Developers List
Subject: Re: How to start a Thread in the same JVM as Tomcat

Hi,
I definitely think it's better for you to create another webapp, even
if it's only used for testing, then it is to muck with
container-specific classes.

I'd prefer a ServletContextListener's contextInitialized method over a
servlet's init() method, for cleanliness, but that's not a major
point.  Just create a trivial webapp: your listener which launches a
thread as you wish, your fault injection code or whatever you want to
call it, and a web.xml file that declares your listener, and that's
it.  It takes less time to create than it did to type any of the
emails on this thread.

Yoav

On 11/16/06, confusionvalley <[EMAIL PROTECTED]> wrote:
> I didn't told you earlier but my objective is to test a webapp that I already 
> have. And I really didn't want to change that webapp or create another webapp 
> to make all the fault-injection stuff. Do you think that creating another 
> webapp is really the best solution?
> If the best solution is to create a new webapp how should i create that *new* 
> webapp? A simple servlet with an init() method (starting when the server 
> starts) that creates the thread and all the fault-injection code? Or do you 
> have any other idea for me?
>
> Cheers,
> Nuno
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Yoav Shapira
> Sent: quinta-feira, 16 de Novembro de 2006 15:06
> To: Tomcat Developers List
> Subject: Re: How to start a Thread in the same JVM as Tomcat
>
> Why would you start it in an internal Tomcat class rather than any of
> your own classes?  Just create a test webapp, and do whatever you want
> in it.
>
> Yoav
>
> On 11/16/06, Nuno Rodrigues <[EMAIL PROTECTED]> wrote:
> > Hello all,
> >
> >
> >
> > I need to put a thread doing some processing in the same JVM as Tomcat.
> >
> > This thread will make some performance measurement inside the JVM and also
> > cause some Resource Exhaustion (CPU consumption, Memory Leaking, etc)
> > problems ( to simulate Fault-Injection).
> >
> > I'm here to ask you where I should start this thread. I've just looked at
> > the source and I'm wondering if I should start that thread in the
> > org.apache.catalina.startup.Bootstrap class.
> >
> > So, I'll wait for an answer from your side to give me this advice.
> >
> >
> >
> > Best regards,
> >
> > Nuno Rodrigues
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to