<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Now that I am actually implementing
      this I am wondering why don't we simply add getUUID to
      CacheRpcCommand. CancellationService will use this UUID for
      command cancellation, some other services might need UUID for
      something else. Introducing CancellableCommand does not add much
      except bunch of instanceof constructs and explicitly connects UUID
      with concept of command cancellation which might not been only
      valid use of command UUID.<br>
      <br>
      <br>
      On 12-09-21 2:34 PM, Manik Surtani wrote:<br>
    </div>
    <blockquote
      cite="mid:6450D5DA-3286-40C0-BC2B-B6A54C33183A@jboss.org"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      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
              moz-do-not-send="true" 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 moz-do-not-send="true"
              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>
            <a class="moz-txt-link-abbreviated" href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br>
            <a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/infinispan-dev">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><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 moz-do-not-send="true"
                          href="mailto:manik@jboss.org">manik@jboss.org</a></div>
                      <div><a moz-do-not-send="true"
                          href="http://twitter.com/maniksurtani">twitter.com/maniksurtani</a></div>
                      <div><br>
                      </div>
                      <div>
                        <div>Platform Architect, JBoss Data Grid</div>
                        <div><a moz-do-not-send="true"
                            href="http://red.ht/data-grid">http://red.ht/data-grid</a></div>
                      </div>
                    </div>
                  </span></div>
              </span></div>
          </span>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
infinispan-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/infinispan-dev">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a></pre>
    </blockquote>
    <br>
  </body>
</html>