You can configure a servlet to load on startup in web.xml and then do
your startup work in the servlet's init() method.

<servlet>
  <servlet-name>MyServlet</servlet-name>
  <servlet-class>foo.bar. MyServlet </servlet-class>
  <load-on-startup>1</load-on-startup>
</servlet>



On Fri, Jul 31, 2009 at 12:54 PM, Ben2008<[email protected]> wrote:
>
> Very useful indeed.
> And yes i mean serverside lifecycle.
> Is there a way to subscibe to server startup process?
> I want to initialise some things if my server starts. For example
> create my database connection pool.
> I dont want to wait for the first user request to do all that stuff.
>
> Thank you in advance.
>
>
>
> On Jul 30, 10:53 pm, Isaac Truett <[email protected]> wrote:
>> Ben,
>>
>> I think you may be confused about the boundary between your GWT client
>> and your server. The EntryPoint is just the first piece of your code
>> that gets executed on the client, like a main() method. Any variables
>> you declare in the EntryPoint or elsewhere in client code remain as
>> long as the browser stays on your host page (subject to scoping, live
>> reference, and garbage collection). Database connections, which can
>> only exist on the server, will exist as long as your connection pool
>> keeps them around (you are using connection pooling, aren't you?).
>>
>> Some other things that might interest you are the servlet life cycle
>> (which might answer your question about how long your web application
>> "lives" on the server) and Gears (which could help you keep data on
>> the client between visits):
>>
>> http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Servlets4.htmlhttp://gears.google.com/
>>
>> Hope that helps.
>> - Isaac
>>
>>
>>
>> On Tue, Jul 28, 2009 at 12:31 PM, Ben2008<[email protected]> wrote:
>>
>> > Hi Folks,
>> > If I have a heavy load web application i do not want to rebuild some
>> > data (eg. creating instances and loading stuff from database etc.) for
>> > every page request.
>> > I want to do that once at startup or any later point and keep things
>> > alive as long as my webservice is online.And i would prefer a nice way
>> > to clear it if my server is shutting down.
>>
>> > My Question is, how long does an Entry Point instance live and is
>> > there a way to keep variables (like database connections or anything
>> > else)  as long as the server is up?
>>
>> > I wrote some mini applications, but that did not satisfy me.- Hide quoted 
>> > text -
>>
>> - Show quoted text -
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to