• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB and COM  RSS feed

 
unmesh joshi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
How should we pass EJB reference to other thread?
In COM there is concept of Apartment and COM object explictly declares its threding requirements. Why COM needed concept of Apartment and EJB does not need that kind of concept?
Thanks,
Unmesh
 
Vinod John
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by unmesh joshi:

How should we pass EJB reference to other thread?

Why do you want to pass a EJB reference to another thread ? ... can you not lookup a new EJB ? . Two clients can't acesss a Session EJB at a time, though you can configure Entity ejb to be accessed by multiple clients.

In COM there is concept of Apartment and COM object explictly declares its threding requirements. Why COM needed concept of Apartment and EJB does not need that kind of concept?

When comparing two related but vastly different technology on a non neutral forum, it would be better elobrate your question bcos people like me ignorant of your end of the world.
Comming back to your question from my past knowledge of Microsoft enviornment, Apartment threading is used for thread safty. In case of EJB
1) In case of EJB threading issue is taken care by the aplication server, so the user doesn't have to worry it.
2) You are not allowed to start a new thread inside a EJB.
 
unmesh joshi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My basic question was why COM needed something like apartment and EJB does not need this type of concept?
I think COM did not have any transactional semantics attached to it. Enter MTS, many requirements are similar to that of EJB.
All calls to MTS objects are serialized.
You should not spawn multiple threads in an MTS component. (Because the new thread can not get the Context and can not be the part of the transaction)
EJB is more clear in defining the roles transactional objects can play, Entity Bean, Stateless Session Bean and StateFull session bean.
MTS does not clearly defined these types.
I think knowing design philosophy of some architecture its nice to compare it with Other similar architecture. Its OK that EJB is defined in certain way. But why it is so? There are not many resources which define the design philosophy like this. Much of the literature discusses 'how' it is done and none discusses 'why' it is designed in this way.
Is there any good resource on EJB that discusses 'why'?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!