who dare win!<br />SCJP5(94%)|SCWCD5(86%)|SCBCD(100%)|SCEA in progress
SCJP 1.4, SCWCD 5, SCBCD 5, OCPJWSD 5,SCEA-1, Started Assignment Part 2
My blog- http://rkydesigns.blogspot.com
who dare win!<br />SCJP5(94%)|SCWCD5(86%)|SCBCD(100%)|SCEA in progress
Originally posted by Kenneth Lomvey:
Remember, the container may not manage a pool for stateful bean instances. Stateful beans are always associated with a client. When JNDI lookup (or dependency injection) is performed for a stateful bean, an instance of the stateful bean will be created.
SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Everytime, the client invokes a method, a new Stateful Session Bean is created. So each time it goes through it's lifecycle.
I guess as per the Specs, a container should not manage a pool for Stateful Session Beans. Please correct me if I'm wrong.
your explanation certainly not correct
Container will create if client has not a reference. If it create for every method call what is the usefulness of SF over SL. We you SFs when client can't keep his previous status like for http client (But http session would be lightweight, efficient than SFSB in general)
your explanation certainly not correct
Container will create if client has not a reference. If it create for every method call what is the usefulness of SF over SL. We you SFs when client can't keep his previous status like for http client (But http session would be lightweight, efficient than SFSB in general)
Jothi
SCJP 1.4, SCWCD 5, SCBCD 5, OCPJWSD 5,SCEA-1, Started Assignment Part 2
My blog- http://rkydesigns.blogspot.com
...when everytime the client invokes a first method on SFB for which it has no reference, it creates SFB everytime.
Everytime, the client invokes a method, a new Stateful Session Bean is created. So each time it goes through it's lifecycle.
SCJP 1.4, SCWCD 5, SCBCD 5, OCPJWSD 5,SCEA-1, Started Assignment Part 2
My blog- http://rkydesigns.blogspot.com
Originally posted by Amandeep Singh:
What do you think, even if the client calls this SFB 2nd time or 3rd time..., will it make a new instance of SFB?
SCJP 5 (98%) - SCBCD 5 (98%)
SCJP 1.4, SCWCD 5, SCBCD 5, OCPJWSD 5,SCEA-1, Started Assignment Part 2
My blog- http://rkydesigns.blogspot.com
No, that's definitively wrong. In my CarClient example each cc1.addCar(..) call will start a new transaction but will not lead to the creation of a new bean instance: Just insert some println into the constructor of your bean class. The number of outputs will correspond to the number of lookup's not to the number of addCar calls resp. number of performed transactions.if SFB has only 1 transaction then also it mean's a new intance is created for every new transaction.
So again the new transaction is created only, when the client inokes the method or do lookup for SFB.
SCJP 5 (98%) - SCBCD 5 (98%)
The following steps describe the life cycle of a stateful session bean instance:
- A session bean instance's life starts when a client obtains a reference to a stateful session bean instance through dependency injection or JNDI lookup, or when the client invokes a create<METHOD> method on the session bean's home interface. This causes the container to invoke newInstance on the session bean class to create a new session bean instance.
Regards<br />Tomasz Lewandowski<br />SCJP5 (97%) | SCWCD5 (98%)
The following steps describe the life cycle of a stateful session bean instance:
- A session bean instance's life starts when a client obtains a reference to a stateful session bean instance through dependency injection or JNDI lookup, or when the client invokes a create<METHOD> method on the session bean's home interface. This causes the container to invoke newInstance on the session bean class to create a new session bean instance.
SCJP 1.4, SCWCD 5, SCBCD 5, OCPJWSD 5,SCEA-1, Started Assignment Part 2
My blog- http://rkydesigns.blogspot.com
The following steps describe the life cycle of a stateful session bean instance:
- A session bean instance's life starts when a client obtains a reference to a stateful session bean instance through dependency injection or JNDI lookup, or when the client invokes a create<METHOD> method on the session bean's home interface. This causes the container to invoke newInstance on the session bean class to create a new session bean instance.
who dare win!<br />SCJP5(94%)|SCWCD5(86%)|SCBCD(100%)|SCEA in progress
package com.jfd.clients;
import com.jfd.test.TestRemote;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
public class Client {
public static void main(String [] args) {
try {
Context jndiContext = getInitialContext( );
Object ref = jndiContext.lookup("TestBean/remote");//site1
TestRemote dao = (TestRemote)
PortableRemoteObject.narrow(ref,TestRemote.class);
dao.createPro();//site2
...
}}}
1,When a client invokes the first method on the stateful session bean reference, the bean's life cycle begins.
who dare win!<br />SCJP5(94%)|SCWCD5(86%)|SCBCD(100%)|SCEA in progress
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |