Re[2]: Sticky servlet

2007-09-19 Thread Kamil Burzynski
Hello,

 I see no reason you would need your servlet to stay in memory. As long
 as it is alive when needed (that is when requests arrive) it's enough.
 Maybe you problem is that it does much than serving request, like 
 running background thread, send message to people and so on. Then you 

Exactly. I am using some external API which is receiving endless data
stream (namely stock price changes), and have to be running 24h, every
day. Running a background thread or something like this would do for me.
Answering mere HTTP requests is not enough.

 might simply need to separate the servlet (part that answer a client) 
 from the service object (part that handle various thread). The service

Yes, I was considering running some 'background' daemon for that.

 object could be started/stopped by a simple servletContextListener and
 attached to JNDI. The servlet would then request that object from JNDI.

I have no knowledge (yet) in servletContextListener and JNDI yet (and
this may be the sole reason why I am asking such questions instead of
just using it), but from your mail I reckon, that it will just be the
solution for me. I have to google for this now.

 If you don't like to use JNDI you can still attach it to application scope.

I dont know yet if I like JNDI ;)

 This will be more easy to maintain and more performant than delegating
 work to another server and add an other row of TCP/IP packets.

Yeah, I was concerned about performance and complexity of my alternative
solution (separate executable + tcp socket + custom protocol or at least
some rpc which would use a lot of xml).

 Kamil Burzynski a écrit :
 Hello,

   
 Please read the other responses to this thread, since they are correct that
 there is no guarantee.  However, the current implementation of TC (3.3-6.0)
 will not unload a Servlet unless the entire context is reloaded (with a
 slight exception for JSP pages).  But then you are programming against
 Tomcat itself, in an area where there is no guarantee that it won't change
 in the future, and it may not work if you try to move to another Servlet
 container.
 

 Yeah, I was afraid of getting such answer, actually ;) In my project it
 would be enough to code against current version of Tomcat, though I
 would like a clean solution. So, it seems, that I'll do standalone
 server and then webapp will connect to it via some protocol (I am not
 familiar with java world enough to know if any good rpc is there - most
 probably it is).

 Thanks for all answers.

   

 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-- 
Best regards from
Kamil Burzynski


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Sticky servlet

2007-09-18 Thread Kamil Burzynski
Hello,

 I would like to create one of my servlets to be 'sticky': to be sure
that Tomcat will never try to remove this servlet from memory.
Is load-on-startup enough? I know that it will start my servlet as
soon as tomcat starts, but will tomcat ever try to remove such servlet?
E.g. if there will be 1 month of inactivity, or so much requests arrive
that out-of-memory will happen?
Maybe I should create some background thread or socket or whatever?

Any solutions appreciated, thanks in advance.

-- 
Best regards from
Kamil Burzynski


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re[2]: Sticky servlet

2007-09-18 Thread Kamil Burzynski
Hello,

 In j2ee specs, there is no provision for unloading an unused servlet. 
 Once a servlet has been tarted (load-on-startup or triggered by user 
 query), i never get unloaded, unless webapp gets unloaded, which occurs
 at shutdown or during a redeploy (administrative task)

Thanks for quick reply. So, it seems, that I have guarantee, that my
servlet once started, will live as long as my webapp/tomcat will live..
this is exactly what I was looking for.

-- 
Best regards from
Kamil Burzynski


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re[2]: Sticky servlet

2007-09-18 Thread Kamil Burzynski
Hello,

 Please read the other responses to this thread, since they are correct that
 there is no guarantee.  However, the current implementation of TC (3.3-6.0)
 will not unload a Servlet unless the entire context is reloaded (with a
 slight exception for JSP pages).  But then you are programming against
 Tomcat itself, in an area where there is no guarantee that it won't change
 in the future, and it may not work if you try to move to another Servlet
 container.

Yeah, I was afraid of getting such answer, actually ;) In my project it
would be enough to code against current version of Tomcat, though I
would like a clean solution. So, it seems, that I'll do standalone
server and then webapp will connect to it via some protocol (I am not
familiar with java world enough to know if any good rpc is there - most
probably it is).

Thanks for all answers.

-- 
Best regards from
Kamil Burzynski


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]