• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please Explain....

 
Raja Sagar Panamgipalli
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all...

Can any one elaborate the below programming restriction ?

"An enterprise Bean must not use read/write static fields. Using read-only ( final) static fields is allowed."

Thank you..

Sagar
 
sawan parihar
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An enterprise Bean must not use read/write static fields. Using read-only ( final) static fields is allowed


This is disallowed because the app may be distributed. Suppose we allow updating the static fields then only those instances running in the same JVM as the updating instance will have access to the new value while the other instances in the other JVM won't get the latest value.

That means the behaviour will change depending on whether the app is distributed or not. Due to this only read only static filed are allowed so that after declaring it final its value can't be changed.

Hope that helps.
 
KasiMurugan Ramasamy
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Raja Sagar,

Some EJB container supports Clusters(I think you know about cluster). This means the Same Application replicated on the different Servers in the same cluster. So each server create own static field for read /write.

So cluster aware EJBobject stub(Which can route the client request to any server in the cluster with respect to load balance etc ) which is resided on the client. So static read/write field would not be consistence.

I hope you will get me.

Thanks & Regards
Kasimurugan R.
 
Raja Sagar Panamgipalli
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey..thanx guys...

That was a basic question...i got...

thanks guys..
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is more an issue of distributing the instances rather than clustering. The EJB container reserves the option of distributing enterprise beans across multiple JVMs, which are running on the same server or on any of a cluster of servers.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic