Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

MQQueueConnectionFactory and threading  RSS feed

 
Stuart Bell
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am exploring the world of JMS and MQ Series at the moment and have came across a baffling problem. I am running MQ Series v5.3 locally on my development PC, I have a Queue Manager and a Queue set up. In my Java app,I am using the base MQ java classes to create a connection, rather than use JNDI as it is not a requirement.

My client app can run in two ways. Single thread, standard application which puts a string "Hello World" onto my queue using the following method to create the connection:

public QueueConnection createConnection() {
QueueConnection result=null;
MQQueueConnectionFactory qcf = new MQQueueConnectionFactory();
qcf.setQueueManager("APP.QM");
result = qcf.createQueueConnection();
}

This works perfectly well and when viewing the queue in MQ Explorer you can see that the queue message count increases by 1. Fine.

My app can also work in a threaded sense, where it implements runnable interface and in the run() method it sleeps for 10 seconds and should send a message to my queue every time it wakes up (that is a high level view of its behaviour). However, running like this inside my own thread, when my class attempts to access the above connection method, it stops and hangs indefinitely. This is shown more acutely when running in WSAD 5.1 in the debugger. When I step onto this line, the thread halts on the line:

result = qcf.createQueueConnection();

I am using JDK 1.3.1 and MQ Series 5.3. Does this sound familiar to anyone? I can only assume that it is is something to do with perhaps security or threading. When running in a non-threaded mode, ie just from the Main thread this all works fine. It is only when it attempts to work in my own spawned thread.

Any thoughts?

Thanks,


Stuart
 
Stuart Bell
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to follow up on my original post.

When it hangs on this line, there is no exceptions thrown, no system log errors, nothing. The behaviour that is witnessed is literally, the thread hangs. You can see that the application is still running, but it is not doing anything.

Regards,


Stuart
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!