dev@glassfish.java.net

[gf-dev] Re: EJB pool

From: Ceyhun Erturk <erturk.ceyhun_at_yandex.com>
Date: Tue, 10 Feb 2015 14:45:14 +0300

If any configuration information for an enterprise bean is not specified in the glassfish-ejb-jar.xml file, it defaults to a corresponding setting in the EJB container if an equivalency exists.
Try on web.xml to add ejb-ref AsyncService element and deploy.

09.02.2015, 19:33, "Janario Oliveira" <janarioliver_at_gmail.com>:
> Hi guys,
>
> I am trying to configure an ejb bean pool. But it is not working.
>
> I have one stateless (AsyncService) and I have added glassfish-ejb-jar.xml in WEB-INF
>
> glassfish-ejb-jar.xml:
> <sun-ejb-jar>
> š š <enterprise-beans>
> š š š š <ejb>
> š š š š š š <ejb-name>AsyncService</ejb-name>
> š š š š š š <bean-pool>
> š š š š š š š š <steady-pool-size>2</steady-pool-size>
> š š š š š š š š <resize-quantity>1</resize-quantity>
> š š š š š š š š <max-pool-size>5</max-pool-size>
> š š š š š š š š <pool-idle-timeout-in-seconds>300</pool-idle-timeout-in-seconds>
> š š š š š š </bean-pool>
> š š š š </ejb>
> š š </enterprise-beans>
> </sun-ejb-jar>
>
> It should limit AsyncService in maximum 5 instances. I've added a PostConstruct method to log creations.
>
> AsyncService:
> @Stateless
> public class AsyncService {
> š š @PostConstruct
> š š private void init() { System.out.println("Contruct AsyncService"); }
> š š @Asynchronous
> š š public Future<LocalDateTime> asyncTest() {...}
> }
>
> Calling the asyncTest in a loop of 15 times it creates more the maximum configured.
>
> Is there another way to configure that or are my configurations wrong?