Mark Kiami

Greenhorn
+ Follow
since Apr 21, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mark Kiami

Is it possible to use an EJB Timer in this case?
An EJB Timer is a SLSB that can run a business logic periodically, they are managed by the Timer Server of the EJB Container.
Stateless Session EJB use pooling.
Stateful Session EJB use caching.
EJB Entities use both.
Message Driven Beans use pooling.

Full details are in the EJB Container sepcification here.
Anyone knows why the Stateless EJB instance is always the same even with a pool size of zero ?

namrata suri wrote:
Here, the functions of the bean are visible and I do not want that. How can I use beans to solve the problem.



Hi,

Could you please clarify the question, do you mean the method of the EJB is visible in the JSP, and you don't want that? Could you post the code of the EJB?

For info you can use the <%= %> notation in the JSP, which is lighter than <% out.println(); %>

For example the following line

can be written:


Hello,

First message on Java Ranch

I'm currently working on SLSB Stateless Session Bean, and more specifically doing some tests on an instance variable of the SL EJB.

I know, instance variables for SLSB are not supposed to be used - only maybe to keep track of an internal state for the EJB - and should not be accessed by the Client. I'm just doing this test to fully understand the mecanics of the EJB container and the pooling.

Ok so I create a simple EJB with a simple counter as an instance variable, and a log to keep track of the value:



The remote interface looks like this:



And a client that calls the retrieveSomeString method:



I'm using Glassfish, for testing purposes and for understanding how this case should work, I set:
Initial and Minimum Pool Size: 0
Maximum Pool Size: 0


After three runs of the client, I get the following log on the server side:

INFO: [SLSB log] : privateState value is 1
INFO: [SLSB log] : privateState value is 2
INFO: [SLSB log] : privateState value is 3


which is weird because this means that the same instance of the EJB is always running.
Since the pool is set to 0, souldn't the SLSB be created when needed then directly destroyed?

Thanks