Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Stateless EJB Global Variable Timeout question

843829Jan 10 2003 — edited Jan 13 2003
Hi,

In this Stateless EJB:

import javax.ejb.SessionBean;
import javax.ejb.SessionContext;

public class HelloBean implements SessionBean
{
int testnum = 0;
public void ejbCreate()
{
}

public void ejbActivate()
{
}

public void ejbPassivate()
{
}

public void ejbRemove()
{
}

public void setSessionContext(SessionContext ctx)
{
}

public String sayHello(String param)
{
testnum++;
System.out.println("Someone call me!" + testnum);

return "Hello " + param + "! This is an EJB. The current time is " + new java.util.Date() + " The Number is:" + testnum;
}
}


Why "testnum" will keep the value for about 1.5 minutes? If I call this EJB within the 1.5 mins the "testnum" will add the previous value. I don't understand. Because its a stateless session EJB, everytime when I call it the value should be reset.
How can I fix this problem?
Please help

Thanks

Kenny
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 10 2003
Added on Jan 10 2003
4 comments
167 views