Posted: Thu Jun 24, 2010 6:24 pm Post subject: dead locked while createConnection
Newbie
Joined: 24 Jun 2010 Posts: 2
Hi:
I am using MQ 6.0.2.9 on windows xp;
if I create a new thread, and in the new thread to lookup the QCF and using the qcf to create connection, then the createConnection operation will blocked;
to illustrate the problem , I give a very simple program as following:
public class CheckCreateConnectionDeadLockOfMQ4 {
public static void main(String[] args) {
Runnable r = new Runnable(){
public void run(){
try {
Properties props = new Properties();
props.setProperty (InitialContext.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.fscontext.RefFSContextFactory");
props.setProperty(InitialContext.PROVIDER_URL, "file:C:/JNDI-Directory");
props.setProperty(InitialContext.REFERRAL, "throw");
InitialContext ctx = new InitialContext(props);
ConnectionFactory fac = (ConnectionFactory)ctx.lookup("icqcf");
Connection conn = fac.createConnection();
//do some message process
conn.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("create & close connection success");
}
};
System.out.println("press q to exit");
int c;
while((c = System.in.read()) != 'q')
{
if(c == 'r')
new Thread(r).start();
}
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum