This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

calling static translation methods from multiple EJBs in clustered environment  RSS feed

 
Stanislav Kulak
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I need to create translation table that will be used by multiple session and entity beans. I can not modify database, so it is not an option. I would like to create a class with static translation method, see a possible sample below

Will there be any issues (concurrency??) if such static method is called from multiple session/entity beans in clustered environment?

I just started working with EJB, sorry if it is a stupid question.
Here is a sample code:
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the EJBs are distributed, then it is possible that the static variables will contain different values in the JVMs. This is why non-final static variables are forbidden by the EJB spec.
 
Stanislav Kulak
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it is a good point. thank you for reply. I forgot to put a final keyword. I fixed this sample code
Is there any possible issues?

Here is ajusted sample code:
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that looks fine.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!