<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><font class="Apple-style-span" face="Courier">dusura,</font><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier">As I said, there is no 'safe' general mechanism for stopping</font></div><div><font class="Apple-style-span" face="Courier">one Java Thread from another. The Interrupt mechanism in Java is</font></div><div><font class="Apple-style-span" face="Courier">simply a convenience for *very simple cases*, or for debugging,</font></div><div><font class="Apple-style-span" face="Courier">and cannot be regarded </font><span class="Apple-style-span" style="font-family: Courier; ">as safe on public interfaces.</span></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier">In particular:</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier">* changes to the design of a service </font><span class="Apple-style-span" style="font-family: Courier; ">might involve invoking more</span></div><div><span class="Apple-style-span" style="font-family: Courier; "> or fewer other threads (in which case you might be interrupting</span></div><div><font class="Apple-style-span" face="Courier"> the wrong one);</font></div><div><font class="Apple-style-span" face="Courier">* services might be invoked which themselves quietly consume</font></div><div><font class="Apple-style-span" face="Courier"> interrupts;</font></div><div><font class="Apple-style-span" face="Courier">* interrupts which fail to be trapped (due to timing considerations)</font></div><div><font class="Apple-style-span" face="Courier"> can contaminate the thread for the next time it is run;</font></div><div><font class="Apple-style-span" face="Courier">* it is not possible to tell the difference between spurious interrupts</font></div><div><font class="Apple-style-span" face="Courier"> (part of the Java VM rules for wait(timeout)) and deliberate</font></div><div><font class="Apple-style-span" face="Courier"> external interrupts.</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier">It is much better to architect a solution. For example, in your case,</font></div><div><font class="Apple-style-span" face="Courier">send a message to your client application which causes it to perform </font></div><div><font class="Apple-style-span" face="Courier">an orderly </font><span class="Apple-style-span" style="font-family: Courier; ">shutdown (including, one would expect, cancelling consumers </span></div><div><span class="Apple-style-span" style="font-family: Courier; ">and closing connections as we have discussed</span><span class="Apple-style-span" style="font-family: Courier; ">). The client might</span></div><div><span class="Apple-style-span" style="font-family: Courier; ">already have such a message architected, or if not, design one.</span></div><div><span class="Apple-style-span" style="font-family: Courier; "><br></span></div><div><font class="Apple-style-span" face="Courier">In the next release of RabbitMQ </font><span class="Apple-style-span" style="font-family: Courier; ">the thread upon which consumers</span></div><div><font class="Apple-style-span" face="Courier">perform their callbacks need neither </font><span class="Apple-style-span" style="font-family: Courier; ">be the client thread, nor the </span></div><div><span class="Apple-style-span" style="font-family: Courier; ">connection thread, nor a thread dedicated to a particular channel.</span></div><div><span class="Apple-style-span" style="font-family: Courier; "><br></span></div><div><span class="Apple-style-span" style="font-family: Courier; ">In these circumstances, you are much better off calling a standard</span></div><div><span class="Apple-style-span" style="font-family: Courier; ">interface like basicCancel().</span></div><div><font class="Apple-style-span" face="Courier"><br></font><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 12px; ">Steve Powell </span><span class="Apple-style-span" style="font-size: 11px; ">(<i>a happy bunny</i>)</span></font></div></div><div style="font-family: Georgia; font-size: medium; font-weight: normal; font-style: normal; "><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 11px; "><div style="font-family: Helvetica; font-size: 12px; "><i><font class="Apple-style-span" face="Georgia" size="2"><span class="Apple-style-span" style="font-size: 10px; ">----------some definitions from the SPD----------</span></font></i></div><div style="font-family: Helvetica; font-size: 12px; "><font class="Apple-style-span" face="Georgia" size="2"><span class="Apple-style-span" style="font-size: 10px; "><b>Rigatoni</b> </span><font class="Apple-style-span" size="2"><span class="Apple-style-span" style="font-size: 10px; "><i>n.</i></span></font><span class="Apple-style-span" style="font-size: 10px; "> A prime-ministerial grin.</span></font></div><div style="font-family: Helvetica; font-size: 12px; "><font class="Apple-style-span" face="Georgia" size="2"><span class="Apple-style-span" style="font-size: 10px; "><b>Nigella</b> <i>n.</i> The next bottle-size up from a </span></font><span class="Apple-style-span" style="line-height: 15px; "><font class="Apple-style-span" face="Georgia" size="2"><span class="Apple-style-span" style="font-size: 10px; ">Nebuchadnezzar</span></font></span><font class="Apple-style-span" face="Georgia" size="2"><span class="Apple-style-span" style="font-size: 10px; ">.</span></font></div><div style="font-family: Helvetica; font-size: 12px; "><font class="Apple-style-span" face="Georgia" size="2"><span class="Apple-style-span" style="font-size: 10px; "><b>Homily</b> </span></font><font class="Apple-style-span" face="Georgia" size="2"><span class="Apple-style-span" style="font-size: 10px; "><i>adv.</i> Rather like a frenchman.</span></font></div></span></font></div></div></span></div></span></div></span></span></span>
</div>
<br><div><div>On 21 Oct 2011, at 01:28, dusura wrote:</div><blockquote type="cite"><font class="Apple-style-span" color="#144fae"><a href="http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2011-October/015649.html">http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2011-October/015649.html</a></font></blockquote></div><br></div></body></html>