OK.. I'm having some confusion with the Singleton/Prototype management system in spring - especially with respect to POJO access and EJB access.
I have a EJB defined in a context file as shown below. Now, I know that the ProxyFactoryBean is a singleton - but that DOESN'T mean that the EJB I'm trying to access is also a singleton, does it??
Also I have the following POJO data objects defined..Code:<bean id="Stations" class="org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean"> <property name="jndiName"> <value>ejb/Stations</value> </property> <property name="jndiEnvironment"> <props> <prop key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop> <prop key="java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces</prop> <prop key="java.naming.provider.url">jnp://localhost:1099</prop> </props> </property> <property name="businessInterface"> <value>com.bar.foo.StationsService</value> </property> </bean>
But what's confusing is that I'm seeing these types of messages from the logs in JBoss coming from Spring..Code:<bean name = "RequestListColorsDAO" singleton="false" class="com.far.foo.dao.RequestListColorsDAOImpl" > </bean>
And I'll see multiple lines that say singletons are being created for EJBs as well...Code:13:01:37,006 INFO [DefaultListableBeanFactory] Pre-instantiating singletons in factory [org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [dataSource,RequestListColorsDAO,RequestListDAO,RequestHoldersDAO,HoldersDAO,HolderEquipmentDAO,OSMRequest,Stations,Devices]; Root of BeanFactory hierarchy
AND I see muliple lines like this:Code:13:01:36,075 INFO [DefaultListableBeanFactory] Creating shared instance of singleton bean 'Stations' 13:01:36,085 INFO [DefaultListableBeanFactory] Creating shared instance of singleton bean 'Stations'
Now.. I can't have EJBs being singletons.. I need to create mulitple instances in JBoss. Otherwise I can't handle multiple requests with any decent efficiency.Code:13:01:38,728 INFO [ClassPathXmlApplicationContext] 9 beans defined in ApplicationContext [org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=15235194] 13:01:38,738 INFO [ClassPathXmlApplicationContext] 9 beans defined in ApplicationContext [org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=16651101]
Am I misunderstanding these messages? How do I make sure that the singleton 'factory' is actually creating *muliple* EJB instances and *multiple* DAO implementations?


Reply With Quote