Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why can't we use 'static' in EJB?

 
rui lin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would you please tell me why?
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use static variables -- as long as their read-only (final). The reason for not being allowed to use read-write static variables is that the EJB container would have hard time synchronizing the static variable across the cluster.
 
rui lin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to Lasse.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic