Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Originally posted by Chris Mathews:
The database would be the most natural and easiest place to manage this lock. Why are you moving away from databases again?
I think could go with an in-memory lock, probably implemented as a Singleton. The real reason Singletons are frowned upon in J2EE is two-fold:
1) Global variables are generally bad.
2) Singletons don't play nice in clusters.
However, it is obvious that that no matter how the lock is implemented, it must be globally accessible to all EJBs if it is to be effective.
If you really wanted to follow J2EE Dogma then you could create your lock and access it through JNDI. However, I don't think that this additional complexity is actually going to gain you anything...
I was just thinking of a really nasty way this could be done using the Command Pattern and a bunch of Entity Beans Lock Managers (one for each security). However, I won't say anything else for fear of retribution from Kyle.
Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Originally posted by Kyle Brown:
OK, following with that analogy, would you put a big 1/2 pound padlock through your pants pocket and your wallet to keep it safe? Seems like the car is a better alternative...
Kyle
nitzan levi :-)
Originally posted by nitzan levi:
hi,
you can use a statefull session bean that will do the orders , the OrederCrosserBean will get the handle to this statefull from the jndi(only when it realy needs it) , and if another OrederCrosserBean instance is currently working with this statefull then the container will throw you an exception. then you can deside if you want to try untill the statefull will be free or not !
Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
SCJP 1.4, SCWCD, SCBCD 1.3
Originally posted by Sudd Ghosh:
From my past experience, and a lot of appl tuning experience, I feel that database should be the last resort for doing any temporary storage. Whatever can be done in memory should be done that way. If one doesn't have to worry about losing some temporary info, memory storage should be the way. Even if one has to go the extra mile using beans, that should be preferred. Database should be used only for some permanent storage requirement from which some other appl will benefit.
The reason is, DB access will always remain slower as compared to memory access.
Thanks, Sudd
Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
SCJP 1.4, SCWCD, SCBCD 1.3
I am not a spy. Definitely. Definitely not a spy. Not me. No way. But this tiny ad ...
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|