I need to create a dispatch table (in memory) that can be accessed by all my ejbs. I do not want to have a copy of this table in all my ejbs, but rather have it reside in memroy somewhere on the server for all ejbs to access.
I thought of an entity ejb with empty load/store methods, such that the entity represented only the in memory table.
Any ideas?
-
creating an EJB singleton (8 messages)
- Posted by: Rob Tessier
- Posted on: November 07 2000 13:57 EST
Threaded Messages (8)
- creating an EJB singleton by Jeffrey Wise on November 07 2000 15:47 EST
- creating an EJB singleton by Saket Agrawal on November 08 2000 08:40 EST
- creating an EJB singleton by Grainne Coghlan on November 08 2000 12:36 EST
- creating an EJB singleton by Dave Wolf on November 09 2000 20:38 EST
- creating an EJB singleton by Chiew Lee on November 10 2000 11:34 EST
- creating an EJB singleton by Dave Wolf on November 13 2000 02:48 EST
- creating an EJB singleton by John McRobb on November 20 2000 10:22 EST
- how to create singleton EJB by Doru Ambrus on June 21 2007 03:21 EDT
- creating an EJB singleton by Chiew Lee on November 10 2000 11:34 EST
-
creating an EJB singleton[ Go to top ]
- Posted by: Jeffrey Wise
- Posted on: November 07 2000 15:47 EST
- in response to Rob Tessier
Rob-
Sounds ok. Make sure that you mark the bean as read-only, transaction-not-supported in the deployment descriptor and set a very long rad-timeout. Also set the max pool size to 1 - this shold increase the likelyhood that the LRU count for the singleton stays high enough for the bean not to get passivated. -
creating an EJB singleton[ Go to top ]
- Posted by: Saket Agrawal
- Posted on: November 08 2000 08:40 EST
- in response to Rob Tessier
Why don't you try a state full session bean with one set and one get method.
saket -
creating an EJB singleton[ Go to top ]
- Posted by: Grainne Coghlan
- Posted on: November 08 2000 12:36 EST
- in response to Saket Agrawal
I've been thinking about this as well.
But I wonder how would the other ejbs share the same stateful session bean?
The reference to the stateful been could be published in a known place ( say JNDI ).
So, each ejb could gets a reference to the single stateful session bean - they want to share the same state.
But what happens if two or more of the ejbs access the same stateful session bean concurrently.
I think that an exception is thrown.(EJB 1.1 spec. section 6.11.6)
-
creating an EJB singleton[ Go to top ]
- Posted by: Dave Wolf
- Posted on: November 09 2000 20:38 EST
- in response to Rob Tessier
There is no real legal portable way to accomplish this in EJB 1.1
1) There are no singletons
2) Singleton design patterns are illegal
3) Things like maxpoolsize are non portabloe and proprietary
4) Non read-only static members are illegal
5) Thread syncrhonization primitives are illegal
Your best best would be to store the in-memory table into an in-memory database via JDBC. THis would be totally legal and portable and safe.
Dave Wolf
Internet Applications Division
Sybase
-
creating an EJB singleton[ Go to top ]
- Posted by: Chiew Lee
- Posted on: November 10 2000 11:34 EST
- in response to Dave Wolf
forget abt using EJBs to store the dispatch table info.
u could simply use a singleton to achieve this. All your EJBs could then access this info as and when they need it.
i've some similar requirement & i used the above technique. The performance is superb.
alex
-
creating an EJB singleton[ Go to top ]
- Posted by: Dave Wolf
- Posted on: November 13 2000 14:48 EST
- in response to Chiew Lee
Please understand the use of singletons is VERY VERY non portable and basically illegal.
Dave Wolf
Internet Applications Division
Sybase
-
creating an EJB singleton[ Go to top ]
- Posted by: John McRobb
- Posted on: November 20 2000 10:22 EST
- in response to Chiew Lee
I just want to create a plain vanilla singleton. My problem is that I want to refresh the values which works fine. The only problem is that we have a number of weblogic instances and I want a simple means of hitting all of them with the changes. Is it possible to share a singleton across instances or is there an alternative solution -
how to create singleton EJB[ Go to top ]
- Posted by: Doru Ambrus
- Posted on: June 21 2007 15:21 EDT
- in response to Chiew Lee
How did you create a singleton stateless EJB? I am using WAS 6.1.