This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I read this somewhere... "There is a general advice from wise people that we should not use static classes because the classes are static within a class loader whereas an application server may have more than 1 class loader within the same JVM." Would someone explain this !!!
Let me know if I am wrong ! <img src="smile.gif" border="0">
I can't think offhand why particularly "static" classes are an issue - for one thing, I'm not sure what that means - but I can personally testify that web appservers can bite you because they may use different classpaths internally. If you actually have classes coming from more than one VM, you need something like RMI to communicate between them. Just on the chance that the message got garbled coming from the "experts" and since this forum covers EJBs, I would mention that static members of an EJB should be avoided unless they are invariant (final).
Customer surveys are for companies who didn't pay proper attention to begin with.
Thomas Paul
mister krabs
Ranch Hand
Joined: May 05, 2000
Posts: 13974
posted
0
Originally posted by Tim Holloway: Just on the chance that the message got garbled coming from the "experts" and since this forum covers EJBs, I would mention that static members of an EJB should be avoided unless they are invariant (final).
And the reason is that if a class with a static member is loaded by more than one class loader, then changes to one static member will not be reflected in the other static member. In other words, there are no guarantees that static variables will be shared across all instances of a class.