Why is the value of a member preserved in our EJB?
Hello guys!Just before I had to run away a colleague of mine presented a problem that he had between runnings of a statless EJB. A private member kept a value between different executions. The idea was that he should read a value from a database and If true do some logging. But it did not changed even though he changed it in the database. I could not explain why. Below I hope I recall hus code.
@Statless
Public class Myejb
{
Private Boolean log;
Public vid Dosomestuff()
{
If (log==null)
{
log=Readlogsettingfromdb();
}
If(log)
{
system.out.println("logging is true");
}
}
He claims that he started this in a Jboss with the value in the dB set to false during first run and he got no logging. Next run the value set to true in the dB but he get no logging.
The idea was that the EJB would have been initiated before every time it is executed and the log would have been null before each time.
What would you expect would be the outcome?
Or do you think there is a bug somewhere?
Best regards
Fredrik