[JBoss jBPM] - about implementation of JobExecutorThread
by swenker
Hi gurus:
when I read code in JobExecutorThread.I got confused about the following code snip
| Collection acquiredJobs = acquireJobs();
|
| if (! acquiredJobs.isEmpty()) {
| Iterator iter = acquiredJobs.iterator();
| while (iter.hasNext() && isActive) {
| Job job = (Job) iter.next();
| executeJob(job);
| }
|
| } else { // no jobs acquired
| if (isActive) {
| long waitPeriod = getWaitPeriod();
| if (waitPeriod>0) {
| synchronized(jobExecutor) {
| jobExecutor.wait(waitPeriod);
| }
| }
| }
| }
|
acquiredJobs are retrieved by "
select job
from org.jbpm.job.Job as job
where ( (job.lockOwner is null) or (job.lockOwner = :lockOwner) )
and job.retries > 0
and job.dueDate <= :now
and job.isSuspended != true
order by job.dueDate asc"
so I dout that : is the job retrieved really is time to be executed? It's only the latest job ,not anything else.
Can you guys explains a little for me? thanks a lot
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4144869#4144869
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4144869
18 years, 3 months
[JBoss Messaging] - Re: Clustered server preference
by chip_schoch
I hate to belabor the point but it seems you are not quite understanding what I am after. Let me try again.
Here is what I see.
My producer is connected to appserver1. Here is the serverLocatorURI from the factory via the debugger:
bisocket://172.17.20.60:4457/?clientLeasePeriod=10000&clientMaxPoolSize=200&clientSocketClass=org.jboss.jms.client.remoting.ClientSocketWrapper&dataType=jms&marshaller=org.jboss.jms.wireformat.JMSWireFormat&numberOfCallRetries=1&numberOfRetries=10&pingFrequency=214748364&pingWindowFactor=10&socket.check_connection=false&timeout=0&unmarshaller=org.jboss.jms.wireformat.JMSWireFormat
Consumer 1 is connected to appserver1:
bisocket://172.17.20.60:4457/?clientLeasePeriod=10000&clientMaxPoolSize=200&clientSocketClass=org.jboss.jms.client.remoting.ClientSocketWrapper&dataType=jms&marshaller=org.jboss.jms.wireformat.JMSWireFormat&numberOfCallRetries=1&numberOfRetries=10&pingFrequency=214748364&pingWindowFactor=10&socket.check_connection=false&timeout=0&unmarshaller=org.jboss.jms.wireformat.JMSWireFormat
Consumer 2 is connected to appserver2:
bisocket://172.17.20.61:4457/?clientLeasePeriod=10000&clientMaxPoolSize=200&clientSocketClass=org.jboss.jms.client.remoting.ClientSocketWrapper&dataType=jms&marshaller=org.jboss.jms.wireformat.JMSWireFormat&numberOfCallRetries=1&numberOfRetries=10&pingFrequency=214748364&pingWindowFactor=10&socket.check_connection=false&timeout=0&unmarshaller=org.jboss.jms.wireformat.JMSWireFormat
All are using this connectionfactory:
| <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"
| name="jboss.messaging.connectionfactory:service=NoLoadBalanceConnectionFactory"
| xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">
| <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
| <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=bisocket</depends>
| <depends>jboss.messaging:service=PostOffice</depends>
|
| <attribute name="JNDIBindings">
| <bindings>
| <binding>/NoLoadBalanceConnectionFactory</binding>
| <binding>/XANoLoadBalanceConnectionFactory</binding>
| <binding>java:/NoLoadBalanceConnectionFactory</binding>
| <binding>java:/XANoLoadBalanceConnectionFactory</binding>
| </bindings>
| </attribute>
| <attribute name="PrefetchSize">1</attribute>
| <attribute name="SlowConsumers">true</attribute>
| <attribute name="SupportsFailover">false</attribute>
| <attribute name="SupportsLoadBalancing">false</attribute>
| </mbean>
Set DefaultPreserveOrdering=true on the servers
Post 5 messages:
[2008-04-17 09:18:54,613] INFO - Queueing message: Test_Message_0
| [2008-04-17 09:18:54,660] INFO - Queueing message: Test_Message_1
| [2008-04-17 09:18:54,675] INFO - Queueing message: Test_Message_2
| [2008-04-17 09:18:54,691] INFO - Queueing message: Test_Message_3
| [2008-04-17 09:18:54,722] INFO - Queueing message: Test_Message_4
| [2008-04-17 09:20:39,393] INFO - Listener_2 received message: Test_Message_0
| [2008-04-17 09:20:40,440] INFO - Listener_2 received message: Test_Message_1
| [2008-04-17 09:20:41,456] INFO - Listener_2 received message: Test_Message_2
| [2008-04-17 09:20:42,487] INFO - Listener_2 received message: Test_Message_3
| [2008-04-17 09:20:43,519] INFO - Listener_2 received message: Test_Message_4
|
|
| I get message ordering but no client load balancing, as expected.
| But why is Listener_2 getting the messages and not Listener_1? I verified that the messages were put on appserver1 by stopping before creating the consumers and using the jmx-console to see the message count. I also verified that after creating the consumers each appserver had one consumer.
|
| My desired result is that I get message ordering and both listeners consume the messages.
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4144852#4144852
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4144852
18 years, 3 months