dcsimg

How can one have non-client specific state in stateless session beans?

sachin mahishi

You can use the Environment to get a pointer to a somewhat global state, that's shared among all EJBs:

public class test implements SessionBean
{
 private transient SessionContext ctx;
 static final float PIE=3.14 ;
 private transient Properties    myprops;    

 //all the SessionBean  methods 
 public void setSessionContext(SessionContext ctx) {
    this.ctx = ctx;
    myprops    = ctx.getEnvironment();
  }


}