<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Looks good, except that the pseudocode for dealing with a CancellableCommand (on the recipient node) should look like:<div><br></div><div>* Receive command</div><div>* if CancellableCommand, register with CancellationService</div><div>* Perform command</div><div>* If CancellableCommand, un-register from CancellationService</div><div><br></div><div>That last step was missing from your detail below. &nbsp;I presume that would require a CancellationService#unregisterThread(UUID u) ?</div><div><br></div><div>- Manik</div><div><br><div><div>On 21 Sep 2012, at 11:42, Vladimir Blagojevic &lt;<a href="mailto:vblagoje@redhat.com">vblagoje@redhat.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi,<br><br>I wanted to run by you guys design of command cancellation Manik and I <br>talked about recently. For more background regarding this task read <br><a href="https://issues.jboss.org/browse/ISPN-1042">https://issues.jboss.org/browse/ISPN-1042</a><br><br>At originating node I would have each Cancellable command create its <br>UUID as part of constructor. After that command gets sent away to remote <br>VMs but just before it gets executed there we associated thread with <br>UUID by calling CancellationService.registerThread (as a first line of <br>code in Command#perform). After registration has been setup Cancellable <br>command goes into potentially lengthy (in seconds) execution. If needed <br>we would be able to send CancelCommand which would call <br>CancellationService#cancelTask with UUID. CancelTask would interrupt the <br>associated thread.<br><br>WDYT?<br><br>Regards,<br>Vladimir<br><br>Cancellation of tasks:<br><br>class CancellationService {<br> &nbsp;UUID registerThread(Thread t, UUID uuid) {<br> &nbsp;&nbsp;&nbsp;&nbsp;// put thread in map, associate with newly give UUID<br> &nbsp;&nbsp;&nbsp;}<br> &nbsp;void cancelTask(UUID uuid) {<br>// &nbsp;&nbsp;&nbsp;&nbsp;look up thread, interrupt if exists.<br> &nbsp;&nbsp;}<br>}<br><br>interface CancellableCommand {<br> &nbsp;&nbsp;UUID getCommandUUID();<br>}<br><br>command CancelCommand {<br> &nbsp;&nbsp;Object perform() {<br>// &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Calls CancellationService.cancelTask with UUID. &nbsp;The UUID is a <br>parameter of this command.<br> &nbsp;}<br>}<br>_______________________________________________<br>infinispan-dev mailing list<br>infinispan-dev@lists.jboss.org<br>https://lists.jboss.org/mailman/listinfo/infinispan-dev<br></blockquote></div><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><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-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><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-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>--</div><div>Manik Surtani</div><div><a href="mailto:manik@jboss.org">manik@jboss.org</a></div><div><a href="http://twitter.com/maniksurtani">twitter.com/maniksurtani</a></div><div><br></div><div><div>Platform Architect, JBoss Data Grid</div><div><a href="http://red.ht/data-grid">http://red.ht/data-grid</a></div></div></div></span></div></span></div></span>
</div>
<br></div></body></html>