Re: Servlet inter-communication

2006-05-05 Thread Michael Echerer
Samuli Elomaa wrote: > Hi, > Is there any otherway for two servlets in same tomcat to communicate > together except by http requests? Eg. could two servlets use somekind > of shared memory? or send signals to each other? Hi, whatever others suggested, just use the Servlet Spec 2.3+ standard: T

Re: Servlet inter-communication

2006-05-04 Thread Antonio Petrelli
Leon Rosenberg ha scritto: Hmm... instead of using a 3-liner I'm supposed to plug in a whole container, even a lightweight one? What will come next? Installing Jboss for config-file-reading? You know; i really liked singleton when I used to be a Swing programmer. But it raises a serious issue

Re: Servlet inter-communication

2006-05-03 Thread Leon Rosenberg
On 5/3/06, Darryl Miles <[EMAIL PROTECTED]> wrote: Maybe a useful URL to help address this matter when it bites, look for the java code in the forum thread: http://forum.hibernate.org/viewtopic.php?t=935948&start=150 Something to put at the end of your javax.servlet.ServletContextListener#conte

Re: Servlet inter-communication

2006-05-03 Thread Leon Rosenberg
On 5/3/06, Antonio Petrelli <[EMAIL PROTECTED]> wrote: Leon Rosenberg ha scritto: > Even if it doesn't, is this a real problem? I mean reloading a webapp > in production environment is a greater nogo than using a singleton, > isn't it? > Yes it is! In our case we have an webapp update system tha

Re: Servlet inter-communication

2006-05-03 Thread Darryl Miles
Maybe a useful URL to help address this matter when it bites, look for the java code in the forum thread: http://forum.hibernate.org/viewtopic.php?t=935948&start=150 Something to put at the end of your javax.servlet.ServletContextListener#contextDestroyed(ServletContextEvent). Abstracting

RE: Servlet inter-communication

2006-05-03 Thread Peter Crowther
> From: Leon Rosenberg [mailto:[EMAIL PROTECTED] > I mean reloading a webapp > in production environment is a greater nogo than using a singleton, > isn't it? Given the number of posts in here about OOMEs over the last year or so that have been traced down to running out of PermGen due to reloadi

Re: Servlet inter-communication

2006-05-03 Thread Antonio Petrelli
Leon Rosenberg ha scritto: Even if it doesn't, is this a real problem? I mean reloading a webapp in production environment is a greater nogo than using a singleton, isn't it? Yes it is! In our case we have an webapp update system that undeploys the old webapp and deploys a new version. And an

Re: Servlet inter-communication

2006-05-03 Thread Leon Rosenberg
On 5/3/06, Peter Crowther <[EMAIL PROTECTED]> wrote: > From: Leon Rosenberg [mailto:[EMAIL PROTECTED] > Could you explain it a bit more? What's the difference whether I have > 10 instances of the same class or just one for reloading? In a Singleton: - the class holds a reference to the classloa

RE: Servlet inter-communication

2006-05-03 Thread Peter Crowther
> From: Leon Rosenberg [mailto:[EMAIL PROTECTED] > Could you explain it a bit more? What's the difference whether I have > 10 instances of the same class or just one for reloading? In a Singleton: - the class holds a reference to the classloader; - the class holds a reference to the singleton i

Re: Servlet inter-communication

2006-05-03 Thread Leon Rosenberg
On 5/3/06, Antonio Petrelli <[EMAIL PROTECTED]> wrote: Thomas Bolding ha scritto: > Indeed. If it is within the same context this is trivial - look into > singleton design pattern. It's a bad idea to use singletons in a web application, especially when the application needs to be reloaded (this

Re: Servlet inter-communication

2006-05-03 Thread Stas Ostapenko
How about JMS stuff ? For example Commons Messenger - http://jakarta.apache.org/commons/sandbox/messenger/. Does anybody used it ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Servlet inter-communication

2006-05-03 Thread gslt
>> From: Samuli Elomaa [mailto:[EMAIL PROTECTED] >> Is there any otherway for two servlets in same tomcat to communicate >> together except by http requests? Eg. could two servlets use >> somekind of shared memory? or send signals to each other? > >Both could in theory rendezvous at a common fi

Re: Servlet inter-communication

2006-05-03 Thread Samuli Elomaa
Thanks, Solved the problem by using singleton, hopefully I won't end up with deadlock in somepoint. Samuli - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Servlet inter-communication

2006-05-03 Thread Peter Crowther
> From: Samuli Elomaa [mailto:[EMAIL PROTECTED] > Is there any otherway for two servlets in same tomcat to communicate > together except by http requests? Eg. could two servlets use > somekind of shared memory? or send signals to each other? Both could in theory rendezvous at a common filename

Re: Servlet inter-communication

2006-05-03 Thread Antonio Petrelli
Thomas Bolding ha scritto: Indeed. If it is within the same context this is trivial - look into singleton design pattern. It's a bad idea to use singletons in a web application, especially when the application needs to be reloaded (this is one of the causes that make lots of people write abou

RE: Servlet inter-communication

2006-05-03 Thread Thomas Bolding
Indeed. If it is within the same context this is trivial - look into singleton design pattern. If the servlets are from different contexts you will have to enable crosscontext in your server.xml I assume. In any case be aware of race conditions/dead locks - Java5.0 has new semaphore types which mi