Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
JSP - A mailing list about Java Server Pages specification and reference
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
Keeping the server side object alive !!!

Keeping the server side object alive !!!

2007-01-15       - By Andre Prasetya

 Back
Reply:     1     2     3     4     5     6  

I attach an example for you.

MigrationUtil is a helper class that needs initialisation when the webapp
started and needs cleaning when the webapp stopped

On 1/16/07, Luis Rivera <luiggiilca@(protected)> wrote:
>
>    Dear Leon,
>
> Thanks for the info, I am reading about Contexts, but I am not sure if
> they
> are created as soon as tomcat starts. This listener seems to be event
> based,
> as long as an event is auto generated after Tomcat has started, it would
> work, or if there is another mechanism that can be used to generate the
> event that is automatic and that does not require a request from the
> client,
> I think it might work.
>
>     Thanks in advance,
>     --Luis R.
>
> On 1/15/07, Leon Rosenberg <rosenberg.leon@(protected)> wrote:
> >
> > I think what you need is a ContextListener. With it, you will be
> > notified when the context (webapp) starts and can perform
> > initialization, and when the context is destroyed you can perform
> > de-initialization (stop your threads, cleanup ressources and such).
> >
> > regards
> > Leon
> >
> > On 1/15/07, Luis Rivera <luiggiilca@(protected)> wrote:
> > >    Hi,
> > >
> > > I would like to know how could I jump start my web service in tomcat
> > before
> > > any call from the client is made. My first version only needed to be
> > > stateless and that worked fine, since I noticed that each call from
> the
> > > client creates a new object in the server. However, now I would like
> to
> > > create some threads because I have a custom administration module
> > > (session/security/database).
> > >
> > > I can create them when the first call is made (using statics), but I
> > would
> > > like to get rid of the overhead in the first call by somehow jump
> > starting
> > > the application to do the loading and initialization that the
> > application
> > > threads need to do, so that the when the first call is made, there is
> no
> > > overhead to pay.
> > >
> > > I am not sure. Is this possible? I am probably not understanding fully
> > the
> > > servlet model or how tomcat/axis is supposed to be stateful at the
> > server
> > > side.
> > >
> > > I guess, if there is a smarter way to do this without using
> > threads/statics
> > > I would like to know where I could find an example.
> > >
> > >    Thanks in advance,
> > >    --Luis R.
> > >
> > >
> >
> > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
> > To start a new topic, e-mail: users@(protected)
> > To unsubscribe, e-mail: users-unsubscribe@(protected)
> > For additional commands, e-mail: users-help@(protected)
> >
> >
>
>


--
-Andre-

People see things the way they are and say "why ?" I see things that never
were and say "Why not ?"

I attach an example for you.<br><br>MigrationUtil is a helper class that needs
initialisation when the webapp started and needs cleaning when the webapp
stopped<br><br><div><span class="gmail_quote">On 1/16/07, <b class="gmail
_sendername">
Luis Rivera</b> &lt;<a href="mailto:luiggiilca@(protected)">luiggiilca@(protected)<
/a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px
solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&nbsp;&nbsp; Dear Leon,<br><br>Thanks for the info, I am reading about Contexts
, but I am not sure if they<br>are created as soon as tomcat starts. This
listener seems to be event based,<br>as long as an event is auto generated
after Tomcat has started, it would
<br>work, or if there is another mechanism that can be used to generate the<br
>event that is automatic and that does not require a request from the client,<br
>I think it might work.<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Thanks in advance,<br>
&nbsp;&nbsp;&nbsp;&nbsp;--Luis R.
<br><br>On 1/15/07, Leon Rosenberg &lt;<a href="mailto:rosenberg.leon
@(protected)">rosenberg.leon@(protected)</a>&gt; wrote:<br>&gt;<br>&gt; I
think what you need is a ContextListener. With it, you will be<br>&gt; notified
when the context (webapp) starts and can perform
<br>&gt; initialization, and when the context is destroyed you can perform<br>
&gt; de-initialization (stop your threads, cleanup ressources and such).<br>&gt;
<br>&gt; regards<br>&gt; Leon<br>&gt;<br>&gt; On 1/15/07, Luis Rivera &lt;
<a href="mailto:luiggiilca@(protected)">luiggiilca@(protected)</a>&gt; wrote:<br>
&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;Hi,<br>&gt; &gt;<br>&gt; &gt; I would like to
know how could I jump start my web service in tomcat<br>&gt; before<br>&gt; &gt
; any call from the client is made. My first version only needed to be
<br>&gt; &gt; stateless and that worked fine, since I noticed that each call
from the<br>&gt; &gt; client creates a new object in the server. However, now I
would like to<br>&gt; &gt; create some threads because I have a custom
administration module
<br>&gt; &gt; (session/security/database).<br>&gt; &gt;<br>&gt; &gt; I can
create them when the first call is made (using statics), but I<br>&gt; would<br
>&gt; &gt; like to get rid of the overhead in the first call by somehow jump
<br>&gt; starting<br>&gt; &gt; the application to do the loading and
initialization that the<br>&gt; application<br>&gt; &gt; threads need to do, so
that the when the first call is made, there is no<br>&gt; &gt; overhead to pay.
<br>&gt; &gt;<br>&gt; &gt; I am not sure. Is this possible? I am probably not
understanding fully<br>&gt; the<br>&gt; &gt; servlet model or how tomcat/axis
is supposed to be stateful at the<br>&gt; server<br>&gt; &gt; side.
<br>&gt; &gt;<br>&gt; &gt; I guess, if there is a smarter way to do this
without using<br>&gt; threads/statics<br>&gt; &gt; I would like to know where I
could find an example.<br>&gt; &gt;<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;Thanks
in advance,
<br>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;--Luis R.<br>&gt; &gt;<br>&gt; &gt;<br>&gt
;<br>&gt; -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
<br>&gt; To start a new topic, e-mail: <a href="mailto:users@(protected)"
>users@(protected)
</a><br>&gt; To unsubscribe, e-mail: <a href="mailto:users-unsubscribe@(protected)
.apache.org">users-unsubscribe@(protected)</a><br>&gt; For additional
commands, e-mail: <a href="mailto:users-help@(protected)">users-help
@(protected)
</a><br>&gt;<br>&gt;<br><br></blockquote></div><br><br clear="all"><br>-- <br>
-Andre-<br><br>People see things the way they are and say &quot;why ?&quot; I
see things that never were and say &quot;Why not ?&quot;

-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.