[JCA/JBoss] - Re: WorkManager thread pooling
by vickyk
"avzak" wrote :
| Am i missing something here?
|
No , I looked at the code which displays the Min/Max pool size , here is it
public int getMinimumPoolSize()
| {
| return executor.getCorePoolSize();
| }
|
| public void setMinimumPoolSize(int size)
| {
| synchronized (executor)
| {
| // Don't let the min size > max size
| if (executor.getMaximumPoolSize() < size)
| {
| executor.setCorePoolSize(size);
| executor.setMaximumPoolSize(size);
| }
| }
| }
|
| public int getMaximumPoolSize()
| {
| return executor.getMaximumPoolSize();
| }
|
| public void setMaximumPoolSize(int size)
| {
| synchronized (executor)
| {
| executor.setCorePoolSize(size);
| executor.setMaximumPoolSize(size);
| }
| }
http://anonsvn.jboss.org/repos/common/common-core/trunk/src/main/java/org...
In the above core you will see calling the setMaximumPoolSize() sets executor.setCorePoolSize(size) and the getMinPoolSize() displays the corePoolSize .
Actaully in setMaximumPoolSize(..) the executor.setCorePoolSize(size); should be set only if the size(max size)<getMinimumPoolSize().
Even in older version of the ThreadPool I see the similar implementation
| public void setMaximumPoolSize(int size)
| {
| synchronized (executor)
| {
| executor.setMinimumPoolSize(size);
| executor.setMaximumPoolSize(size);
| // Don't let the min size > max size
| if (executor.getKeepAliveSize() > size)
| executor.setKeepAliveSize(size);
| }
| }
http://anonsvn.jboss.org/repos/common/common-core/tags/2.0.0/src/main/jav...
A quicker solution would be to have the custom ThreadPool Implementation which would take care of min/max pool count, you can simply take the jboss code and introduce the check as I have explained earlier .
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115646#4115646
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115646
17 years
[JBoss Seam] - Page history
by Marx3
Hello
I design stack of invocations (history). I need to display on every page sth like this:
MainPage->List1->Edit1->List2->List1->Edit1
Every position is clickable so I can fast return to page from history
I did NavigationManager with stack inside, and every action push/pop from stack
But i have such problems:
1)Edit1 starts long conversation which I don't want to have
2)List1 is invoked in two differenst steps and going back gives List1 with overwritten for example filters
3)Pressing 'back' in browser gives inconsistent results (it doesn't pop from stack as it should).
4)Every action must go through NavigationManager, so it's more complicated and slower
Is there any better method to do it?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115641#4115641
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115641
17 years
[JBoss Seam] - Re: Entity EJB3.0 Unit Testing - How to setup JNDI datasourc
by sushmu
Finally Integration testing of EJB works with Maven!
I have 3 modules as described in Maven guide.
1. EJB
2. WAR
3. EAR
Entity beans testing is done in EJB module as described in previous post.
Session beans testing is done in WAR module since it requires the servlet/facelet functionality. One additional step on top of the previous explanation was to copy 'components.xml' in 'target/test-classes/WEB-INF' folder.
The Action to test:
package com.ibt.intellidocs.dummy;
|
| import static org.jboss.seam.ScopeType.EVENT;
| import org.jboss.seam.log.Log;
|
| import javax.persistence.EntityManager;
| import java.io.Serializable;
| import java.util.List;
|
| @Stateful
| @Scope(EVENT)
| @Name("dummyUserAction")
| public class DummyUserAction
| implements IDummyUserLocal, Serializable
| {
| @Logger
| Log log;
|
| @In(required = true)
| private DummyUser dummyUser;
|
| @PersistenceContext
| private EntityManager entityManager;
|
| private String verify;
| private boolean registered;
|
| public DummyUser findDummyUser(long id)
| {
| return entityManager.find(DummyUser.class, id);
| }
|
| public long register()
| {
| if (dummyUser.getPassword().equals(verify))
| {
| List existing = entityManager.createQuery
| ("select u.username from DummyUser u where u.username=#{dummyUser.username}")
| .getResultList();
| if (existing.size() == 0)
| {
| entityManager.persist(dummyUser);
| log.info("Username #{dummyUser.username} already exists");
| registered = true;
| }
| else
| {
| log.info("Username #{dummyUser.username} already exists");
| }
| }
| else
| {
| log.info("Re-enter your password");
| verify = null;
| }
| return dummyUser.getId();
| }
|
| public String getVerify()
| {
| return verify;
| }
|
| public void setVerify(String verify)
| {
| this.verify = verify;
| }
|
| @Destroy
| @Remove
| public void destroy()
| {
| log.info("dummySeamBean#destroy.. Done!");
| }
|
| public DummyUser getDummyUser()
| {
| return dummyUser;
| }
|
| public void setDummyUser(DummyUser dummyUser)
| {
| this.dummyUser = dummyUser;
| }
| }
|
The Test:
package com.ibt.intellidocs.dummy;
|
| import org.jboss.seam.mock.BaseSeamTest;
| import org.jboss.seam.mock.SeamTest;
| import org.testng.annotations.Test;
|
| import java.util.logging.Logger;
|
| public class DummyUserActionTest
| extends SeamTest
| {
|
| Logger log = Logger.getLogger(DummyUserActionTest.class.getName());
|
| @Test
| public void testSeamComponents()
| throws Exception
| {
| new BaseSeamTest.FacesRequest("/dummy/registerDummyUser.xhtml")
| {
| @Override
| protected void invokeApplication()
| throws Exception
| {
| setValue("#{dummyUser.name}", "test1");
| setValue("#{dummyUser.username}", "test1");
| setValue("#{dummyUser.password}", "test1");
| setValue("#{dummyUserAction.verify}", "test1");
| Object id = invokeAction("#{dummyUserAction.register}");
| log.info("TEST: Registred User with id: " + id);
| }
| }.run();
|
| }
|
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4115639#4115639
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4115639
17 years