<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=WordSection1>
<p class=MsoNormal>ubuntu-10.04.1-server-amd64<o:p></o:p></p>
<p class=MsoNormal>RabbitMQ 2.1.0, generic install<o:p></o:p></p>
<p class=MsoNormal>Java client: rabbitmq-java-client-bin-2.1.0<o:p></o:p></p>
<p class=MsoNormal>Java 1.5<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>The following code hangs on conn.close(). Specifying a
timeout did not help. No issues when run on RabbitMQ 2.0.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>--Steve<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal style='text-autospace:none'><b><span style='font-size:10.0pt;
font-family:"Courier New";color:#7F0055'>package</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> com.bla.rabbit.test;</span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><b><span style='font-size:10.0pt;
font-family:"Courier New";color:#7F0055'>import</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>
com.rabbitmq.client.Channel;</span><span style='font-size:10.0pt;font-family:
"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><b><span style='font-size:10.0pt;
font-family:"Courier New";color:#7F0055'>import</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>
com.rabbitmq.client.Connection;</span><span style='font-size:10.0pt;font-family:
"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><b><span style='font-size:10.0pt;
font-family:"Courier New";color:#7F0055'>import</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> com.rabbitmq.client.ConnectionFactory;</span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><b><span style='font-size:10.0pt;
font-family:"Courier New";color:#7F0055'>import</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>
com.rabbitmq.client.MessageProperties;</span><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><b><span style='font-size:10.0pt;
font-family:"Courier New";color:#7F0055'>public</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><b><span
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>class</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> Small {</span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><span
style='font-size:10.0pt;font-family:"Courier New";color:#3F5FBF'>/**</span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><span
style='font-size:10.0pt;font-family:"Courier New";color:#3F5FBF'>*</span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><b><span
style='font-size:10.0pt;font-family:"Courier New";color:#7F9FBF'>@param</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><span
style='font-size:10.0pt;font-family:"Courier New";color:#3F5FBF'>args</span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><span
style='font-size:10.0pt;font-family:"Courier New";color:#3F5FBF'>*/</span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><b><span
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>public</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><b><span
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>static</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><b><span
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>void</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> main(String[]
args) {</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> String
exchange = </span><span style='font-size:10.0pt;font-family:"Courier New";
color:#2A00FF'>"myexchangename"</span><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>;</span><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> String
queue = </span><span style='font-size:10.0pt;font-family:"Courier New";
color:#2A00FF'>"myqueuename"</span><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>;</span><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> String
route = </span><span style='font-size:10.0pt;font-family:"Courier New";
color:#2A00FF'>"myroutingkey"</span><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>;</span><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> String
msg = </span><span style='font-size:10.0pt;font-family:"Courier New";
color:#2A00FF'>"hello"</span><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>;</span><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><b><span
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>byte</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>[]
messageBodyBytes = msg.getBytes();</span><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> ConnectionFactory
factory = </span><b><span style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>new</span></b><span style='font-size:10.0pt;font-family:"Courier New";
color:black'> ConnectionFactory();</span><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> factory.setUsername(</span><span
style='font-size:10.0pt;font-family:"Courier New";color:#2A00FF'>"guest"</span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>);</span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> factory.setPassword(</span><span
style='font-size:10.0pt;font-family:"Courier New";color:#2A00FF'>"guest"</span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>);</span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> factory.setHost(</span><span
style='font-size:10.0pt;font-family:"Courier New";color:#2A00FF'>"127.0.0.1"</span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>);</span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> factory.setVirtualHost(</span><span
style='font-size:10.0pt;font-family:"Courier New";color:#2A00FF'>"test"</span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>);</span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><b><span
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>try</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> {</span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> Connection
conn = factory.newConnection();</span><span style='font-size:10.0pt;font-family:
"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> Channel
pushChannel = conn.createChannel();</span><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> pushChannel.exchangeDeclare(exchange,
</span><span style='font-size:10.0pt;font-family:"Courier New";color:#2A00FF'>"direct"</span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>, </span><b><span
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>true</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>);</span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> pushChannel.queueDeclare(queue,
</span><b><span style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>true</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>, </span><b><span
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>false</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>, </span><b><span
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>false</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>, </span><b><span
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>null</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>);</span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> pushChannel.queueBind(queue,
exchange, route);</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> System.</span><i><span
style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>out</span></i><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>.println(</span><span
style='font-size:10.0pt;font-family:"Courier New";color:#2A00FF'>"publish"</span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>);</span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> pushChannel.basicPublish(exchange,
route, </span><b><span style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>true</span></b><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>, </span><b><span style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>true</span></b><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>, MessageProperties.</span><i><span style='font-size:10.0pt;
font-family:"Courier New";color:#0000C0'>PERSISTENT_TEXT_PLAIN</span></i><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>,
messageBodyBytes);</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> <o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> //
we hang here</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> System.</span><i><span
style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>out</span></i><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>.println(</span><span
style='font-size:10.0pt;font-family:"Courier New";color:#2A00FF'>"start
close"</span><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>);</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> conn.close();</span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> System.</span><i><span
style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>out</span></i><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>.println(</span><span
style='font-size:10.0pt;font-family:"Courier New";color:#2A00FF'>"end
close"</span><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>);</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> }
</span><b><span style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>catch</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> (Exception ex)
{</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> ex.printStackTrace();</span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> }</span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> }</span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>}</span><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:.5in'><o:p> </o:p></p>
</div>
</body>
</html>