[jboss-user] [EJB/JBoss] - Singleton EJB

ahachmann do-not-reply at jboss.com
Thu Nov 16 12:14:53 EST 2006


Hello,
I realized, that the Singleton Pattern  seems not to be such a common one.
I tried the workaround with the Poolsize.

This is my jboss.xml:

  | <?xml version="1.0"?>
  | <jboss>
  | 	<enterprise-beans>
  | 		<session>
  | 			<ejb-name>SessionLogCacheImpl</ejb-name>
  | 			<configuration-name>Standard Singleton Stateless SessionBean</configuration-name>
  | 		</session>
  | 	</enterprise-beans>
  | 	<container-configurations>
  | 		<container-configuration extends="Standard Stateless SessionBean">
  | 			<container-name>Standard Singleton Stateless SessionBean</container-name>
  | 			<container-pool-conf>
  | 				<MaximumSize>1</MaximumSize>
  | 				<strictMaximumSize>true</strictMaximumSize>
  | 			</container-pool-conf>
  | 		</container-configuration>
  | 	</container-configurations>
  | </jboss>

But this does not work properly.

I need this singleton for the reason that i want to store objects in a single set from every Client. First I tried to use static sets. This worked out. 
But i read that static should not be used in EJB. 
Forther more this EJB has a timer. So when I have more than one EJB in the pool, the Timer will be called more than once.

The only way i see to get this working is using singleton. But aint getting this to work.

Has anyone any suggestion?

Thanks for your Help,
                           Alexander

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3986628#3986628

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3986628



More information about the jboss-user mailing list