Re: [OT] using static helper classes within servlets

2009-06-15 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tim, On 6/15/2009 12:43 PM, Tim Funk wrote: > correction: The double checked idiom was "fixed" in java5. The variable > which is checked needs to be declared as volatile. The link states that > at the bottom. ...which is why I said: >> There are cas

Re: [OT] using static helper classes within servlets

2009-06-15 Thread David Blevins
On Jun 15, 2009, at 9:32 AM, Christopher Schultz wrote: On 6/14/2009 5:43 PM, David Blevins wrote: Regardless of that choice we will still handle sychronization of instantiation, so double-check-locking or other things will not be necessary. NB: DCL does not work in Java. Period. http://www

Re: using static helper classes within servlets

2009-06-15 Thread Sid Sidney
I appreciate all of the great input. Thanks!!! --- On Mon, 6/15/09, Jonathan Mast wrote: From: Jonathan Mast Subject: Re: using static helper classes within servlets To: "Tomcat Users List" Date: Monday, June 15, 2009, 2:32 PM Sid, what everyone is saying about my first reply to yo

Re: using static helper classes within servlets

2009-06-15 Thread Jonathan Mast
z [mailto:ch...@christopherschultz.net] > > Subject: Re: using static helper classes within servlets > > > > You can get a significant performance improvement by doing this > > instead: > > > > private static final SomeBean someBean = new SomeBean(); > > &

RE: using static helper classes within servlets

2009-06-15 Thread Caldarale, Charles R
> From: Christopher Schultz [mailto:ch...@christopherschultz.net] > Subject: Re: using static helper classes within servlets > > You can get a significant performance improvement by doing this > instead: > > private static final SomeBean someBean = new SomeBean(); > >

RE: [OT] using static helper classes within servlets

2009-06-15 Thread Caldarale, Charles R
> From: Christopher Schultz [mailto:ch...@christopherschultz.net] > Subject: Re: [OT] using static helper classes within servlets > > NB: DCL does not work in Java. Period. While that statement was true for 1.4 and prior JVMs, 1.5 actually made DCL work. > http://www.cs.umd

Re: [OT] using static helper classes within servlets

2009-06-15 Thread Tim Funk
correction: The double checked idiom was "fixed" in java5. The variable which is checked needs to be declared as volatile. The link states that at the bottom. -Tim Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 David, On 6/14/2009 5:43 PM, David Blevins wrote:

Re: [OT] using static helper classes within servlets

2009-06-15 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 David, On 6/14/2009 5:43 PM, David Blevins wrote: > Regardless of that choice we > will still handle sychronization of instantiation, so > double-check-locking or other things will not be necessary. NB: DCL does not work in Java. Period. http://www.

Re: using static helper classes within servlets

2009-06-15 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jonathan, On 6/14/2009 1:01 PM, Jonathan Mast wrote: > class BeanBag { > private static SomeBean someBean = null; > > public static synchronized getSomeBean() { > if (someBean == null) someBean = new SomeBean(); >

Re: using static helper classes within servlets

2009-06-15 Thread Leon Rosenberg
On Mon, Jun 15, 2009 at 4:39 PM, Caldarale, Charles R wrote: >> From: Sid Sidney [mailto:pvcsv...@yahoo.com] >> Subject: Re: using static helper classes within servlets > > On a modern JVM, the synchronized block around the retrieval of the reference > will not cost much.  

RE: using static helper classes within servlets

2009-06-15 Thread Caldarale, Charles R
> From: Sid Sidney [mailto:pvcsv...@yahoo.com] > Subject: Re: using static helper classes within servlets > > I was hoping to avoid this by making the delegate a static > class or maybe a singleton. Not sure what you mean by "static class"; do you mean references to

Re: using static helper classes within servlets

2009-06-15 Thread Sid Sidney
't want to use the synchronized keyword b/c I'm sure it will affect performance and our site has a heavy load.  --- On Sun, 6/14/09, David Blevins wrote: From: David Blevins Subject: Re: using static helper classes within servlets To: "Tomcat Users List" Date: Sunday, June

Re: using static helper classes within servlets

2009-06-14 Thread David Blevins
: Thanks David, but we are stuck with Struts and EJB 2.1 at the moment. --- On Sun, 6/14/09, David Blevins wrote: From: David Blevins Subject: Re: using static helper classes within servlets To: "Tomcat Users List" Date: Sunday, June 14, 2009, 5:43 PM Hey all, If the goal is to

Re: using static helper classes within servlets

2009-06-14 Thread Sid Sidney
Thanks David, but we are stuck with Struts and EJB 2.1 at the moment. --- On Sun, 6/14/09, David Blevins wrote: From: David Blevins Subject: Re: using static helper classes within servlets To: "Tomcat Users List" Date: Sunday, June 14, 2009, 5:43 PM Hey all, If the goal is to e

Re: using static helper classes within servlets

2009-06-14 Thread David Blevins
contenu fourni. Date: Sun, 14 Jun 2009 13:01:31 -0400 Subject: Re: using static helper classes within servlets From: jhmast.develo...@gmail.com To: users@tomcat.apache.org I've not done anything with EJBs and I'm not sure what exactly you mean by static "properties".

Re: using static helper classes within servlets

2009-06-14 Thread Pid
Leon Rosenberg wrote: > Hello, > > On Sun, Jun 14, 2009 at 7:01 PM, Jonathan > Mast wrote: >> I've not done anything with EJBs and I'm not sure what exactly you mean by >> static "properties". I have however dealt with reducing instantiations in >> servlets. I simply created a BeanBag class with

Re: using static helper classes within servlets

2009-06-14 Thread Leon Rosenberg
Hello, On Sun, Jun 14, 2009 at 7:01 PM, Jonathan Mast wrote: > I've not done anything with EJBs and I'm not sure what exactly you mean by > static "properties".  I have however dealt with reducing instantiations in > servlets.  I simply created a BeanBag class with static methods to each one > of

RE: using static helper classes within servlets

2009-06-14 Thread Martin Gainty
n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > Date: Sun, 14 Jun 2009 13:01:31 -0400 > Subject: Re: using static h

Re: using static helper classes within servlets

2009-06-14 Thread Sid Sidney
ronized keyword. --- On Sun, 6/14/09, Jonathan Mast wrote: From: Jonathan Mast Subject: Re: using static helper classes within servlets To: "Tomcat Users List" Date: Sunday, June 14, 2009, 1:01 PM I've not done anything with EJBs and I'm not sure what exactly you mean by s

Re: using static helper classes within servlets

2009-06-14 Thread Jonathan Mast
I've not done anything with EJBs and I'm not sure what exactly you mean by static "properties". I have however dealt with reducing instantiations in servlets. I simply created a BeanBag class with static methods to each one of my beans; these are not "proper" beans, but where simply objects that

using static helper classes within servlets

2009-06-14 Thread Sid Sidney
  HI,   In my web app, my servlets user several delegate classes that connect to ejbs (session beans.)  I was thinking about putting these delegates into a helper class as static properties. That way my servlets can just reference the same delegates. I don't want to