Hi !!!
How do I share data across EJB's. Like a counter or a status attribute which needs to be checked across EJB's before proceeding.
We have an application on weblogic which uses EJB's. The number of requests need to be available across EJB's. In other words I would need to have a static (synchronised) variable which can be written/read by any EJB in the application.
How can I do this.
ThanX & Rgds
Nitya
-
Share Data across EJBs (2 messages)
- Posted by: Nityanand Kambhamettu
- Posted on: December 23 2001 11:29 EST
Threaded Messages (2)
- Share Data across EJBs by raghu tss rao on December 24 2001 12:57 EST
- Share Data across EJBs by Nicholas Hsiao on January 10 2002 13:56 EST
-
Share Data across EJBs[ Go to top ]
- Posted by: raghu tss rao
- Posted on: December 24 2001 12:57 EST
- in response to Nityanand Kambhamettu
Put that in a EJB and other EJB can acess it like a normal EJB.
Things you have to consider is what happens when you deploy ejbs in different servers. Statics wont work then because they are on different VMs
One thing you can do it put the variable in a java class and acess it via JNDI. That effectively solves your singleton issues. -
Share Data across EJBs[ Go to top ]
- Posted by: Nicholas Hsiao
- Posted on: January 10 2002 13:56 EST
- in response to Nityanand Kambhamettu
If you want to write a ejb which control the number of request, you can write it as an entity bean.
And other EJB could always lookup the same "primary" key from the container. Same primary key will mapping to same ejb entity bean instance for you. And all ejbs could access it free. If you make sure that all your ejb/application were running under the same VM, then you can use local interface (EJB 2.0 spec) to improve the performance. If you were not sure about that, then remote interface !!
Nicholas Hsiao