<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Will,<br>
      <br>
      I like the API proposal but one thing that jumps out for me is to
      combine or rather overload singleNodeSubmission with
      singleNodeSubmission(int failOverCount) and remove failoverRetries
      method. The first singleNodeSubmission does not failover while the
      second one does with the specified failOverCount. That way we
      don't have to keep state and throw IllegalStateException when
      someone erroneously calls failOverRetries. <br>
      <br>
      Vladimir<br>
      <br>
      <br>
      On 2017-02-21 10:11 AM, William Burns wrote:<br>
    </div>
    <blockquote
cite="mid:CA+YCuUOTFzbH-Uu5imBBUsy2OCMDufbNtW3qZ2zhZVgnrsTE4Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>
                <div>As many of you are may or may not be aware the
                  ClusterExecutor interface and implementation were
                  introduced into Infinispan 8.2 [1].  This class is a
                  new API that can be used to submit commands to other
                  nodes in a way similar to DistributedExecutor does
                  while also not being tied to a cache.<br>
                  <br>
                </div>
                The first implementation of ClusterExecutor did not
                include a couple features that DistributedExecutor has.
                For this post I will concentrate on failover and
                execution policies. My plan is to introduce some API to
                Infinispan 9 to allow for ClusterExecutor to also offer
                these capabilities.<br>
                <br>
              </div>
              The first change is that I wanted to add additional
              options to Execution Policies.  The execution policy is
              used to limit sending messages to nodes based on their
              topology (site, rack &amp; machine id).  The old execution
              policy allowed for SAME_MACHINE, SAME_RACK, SAME_SITE and
              ALL.  I plan on adding the opposite of the SAME and also
              supporting DIFFERENT_MACHINE, DIFFERENT_RACK and
              DIFFERENT_SITE in case if the user wants to ensure that
              data is processed elsewhere. Unless you think this is
              unneeded?<br>
              <br>
            </div>
            The API changes I am thinking of are as below (included in
            email to allow for responses inline).  Note that existing
            methods would be unchanged and thus submit and execute
            methods would be used to send commands still. One big
            difference is that I have not allowed for the user to
            control the failover node or the target node when doing a
            single submission with multiple available targets.  In my
            mind if a user wants this they should do it themselves
            manually, but this is open for discussion as well.<br>
            <br>
            <pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:&quot;dejavu sans mono&quot;;font-size:9pt"><span style="color:rgb(128,128,128);font-style:italic">/**
</span><span style="color:rgb(128,128,128);font-style:italic"> * When a command is submitted it will only be submitted to one node of the available nodes, there is no strict
</span><span style="color:rgb(128,128,128);font-style:italic"> * requirements as to which node is chosen and is implementation specific. Fail over can be used with configuration,
</span><span style="color:rgb(128,128,128);font-style:italic"> * please see {</span><span style="color:rgb(128,128,128);font-weight:bold;font-style:italic">@link </span><span style="color:rgb(128,128,128);font-style:italic">ClusterExecutor#failOverRetries(int)} for more information.
</span><span style="color:rgb(128,128,128);font-style:italic"> * </span><span style="color:rgb(128,128,128);font-weight:bold;font-style:italic">@return </span><span style="color:rgb(128,128,128);font-style:italic">this executor again with commands submitted to a single node
</span><span style="color:rgb(128,128,128);font-style:italic"> */
</span>ClusterExecutor singleNodeSubmission();

<span style="color:rgb(128,128,128);font-style:italic">/**
</span><span style="color:rgb(128,128,128);font-style:italic"> * When a command is submitted it will submit this command to all of the available nodes.  Fail over is not supported
</span><span style="color:rgb(128,128,128);font-style:italic"> * with this configuration. This is the default submission method.
</span><span style="color:rgb(128,128,128);font-style:italic"> * </span><span style="color:rgb(128,128,128);font-weight:bold;font-style:italic">@return </span><span style="color:rgb(128,128,128);font-style:italic">this executor again with commands submitted to all nodes
</span><span style="color:rgb(128,128,128);font-style:italic"> */
</span>ClusterExecutor allNodeSubmission();

<span style="color:rgb(128,128,128);font-style:italic">/**
</span><span style="color:rgb(128,128,128);font-style:italic"> * Enables fail over to occur when using {</span><span style="color:rgb(128,128,128);font-weight:bold;font-style:italic">@link </span><span style="color:rgb(128,128,128);font-style:italic">ClusterExecutor#singleNodeSubmission()}. If the executor
</span><span style="color:rgb(128,128,128);font-style:italic"> * is not currently in the single node submission mode, this method will throw {</span><span style="color:rgb(128,128,128);font-weight:bold;font-style:italic">@link </span><span style="color:rgb(128,128,128);font-style:italic">IllegalStateException}.
</span><span style="color:rgb(128,128,128);font-style:italic"> * When fail over count is applied, a submitted command will be retried up to that many times on the available
</span><span style="color:rgb(128,128,128);font-style:italic"> * command up to desired amount of times until an exception is not met. The one exception that is not retried is a
</span><span style="color:rgb(128,128,128);font-style:italic"> * TimeoutException since this could be related to {</span><span style="color:rgb(128,128,128);font-weight:bold;font-style:italic">@link </span><span style="color:rgb(128,128,128);font-style:italic">ClusterExecutor#timeout(long, TimeUnit)}. Each time the
</span><span style="color:rgb(128,128,128);font-style:italic"> * fail over occurs a random node in the available nodes will be used (trying not to reuse the same node).</span><span style="color:rgb(128,128,128);font-style:italic">
</span><span style="color:rgb(128,128,128);font-style:italic"> * </span><span style="color:rgb(128,128,128);font-weight:bold;font-style:italic">@param </span><span style="color:rgb(61,61,61);font-weight:bold;font-style:italic">failOverCount </span><span style="color:rgb(128,128,128);font-style:italic">how many times this executor will attempt a failover
</span><span style="color:rgb(128,128,128);font-style:italic"> * </span><span style="color:rgb(128,128,128);font-weight:bold;font-style:italic">@return </span><span style="color:rgb(128,128,128);font-style:italic">this executor again with fail over retries applied
</span><span style="color:rgb(128,128,128);font-style:italic"> * </span><span style="color:rgb(128,128,128);font-weight:bold;font-style:italic">@throws </span><span style="color:rgb(128,128,128);font-style:italic">IllegalStateException if this cluster executor is not currently configured for single node submission
</span><span style="color:rgb(128,128,128);font-style:italic"> */
</span>ClusterExecutor failOverRetries(<span style="color:rgb(0,0,128);font-weight:bold">int </span>failOverCount) <span style="color:rgb(0,0,128);font-weight:bold">throws </span>IllegalStateException;

<span style="color:rgb(128,128,128);font-style:italic">/**
</span><span style="color:rgb(128,128,128);font-style:italic"> * Allows for filtering of address nodes by only allowing addresses that match the given execution policy to be used.
</span><span style="color:rgb(128,128,128);font-style:italic"> * Note this method overrides any previous filtering that was done (ie. calling
</span><span style="color:rgb(128,128,128);font-style:italic"> * {</span><span style="color:rgb(128,128,128);font-weight:bold;font-style:italic">@link </span><span style="color:rgb(128,128,128);font-style:italic">ClusterExecutor#filterTargets(Collection)}).
</span><span style="color:rgb(128,128,128);font-style:italic"> * </span><span style="color:rgb(128,128,128);font-weight:bold;font-style:italic">@param </span><span style="color:rgb(61,61,61);font-weight:bold;font-style:italic">policy </span><span style="color:rgb(128,128,128);font-style:italic">the policy to determine which nodes can be used
</span><span style="color:rgb(128,128,128);font-style:italic"> * </span><span style="color:rgb(128,128,128);font-weight:bold;font-style:italic">@return </span><span style="color:rgb(128,128,128);font-style:italic">this executor again with the execution policy applied to determine which nodes are contacted
</span><span style="color:rgb(128,128,128);font-style:italic"> */
</span>ClusterExecutor filterTargets(ClusterExecutionPolicy policy);

<span style="color:rgb(128,128,128);font-style:italic">/**
</span><span style="color:rgb(128,128,128);font-style:italic"> * Allows for filtering of address nodes dynamically per invocation.  The predicate is applied to each member that
</span><span style="color:rgb(128,128,128);font-style:italic"> * is part of the execution policy. Note that this method overrides any previous
</span><span style="color:rgb(128,128,128);font-style:italic"> * filtering that was done (ie. calling {</span><span style="color:rgb(128,128,128);font-weight:bold;font-style:italic">@link </span><span style="color:rgb(128,128,128);font-style:italic">ClusterExecutor#filterTargets(Collection)}).
</span><span style="color:rgb(128,128,128);font-style:italic"> * </span><span style="color:rgb(128,128,128);font-weight:bold;font-style:italic">@param </span><span style="color:rgb(61,61,61);font-weight:bold;font-style:italic">policy </span><span style="color:rgb(128,128,128);font-style:italic">the execution policy applied before predicate to allow only nodes in that group
</span><span style="color:rgb(128,128,128);font-style:italic"> * </span><span style="color:rgb(128,128,128);font-weight:bold;font-style:italic">@param </span><span style="color:rgb(61,61,61);font-weight:bold;font-style:italic">predicate </span><span style="color:rgb(128,128,128);font-style:italic">the dynamic predicate applied each time an invocation is done
</span><span style="color:rgb(128,128,128);font-style:italic"> * </span><span style="color:rgb(128,128,128);font-weight:bold;font-style:italic">@return
</span><span style="color:rgb(128,128,128);font-weight:bold;font-style:italic"> </span><span style="color:rgb(128,128,128);font-style:italic">*/
</span>ClusterExecutor filterTargets(ClusterExecutionPolicy policy, Predicate&lt;? <span style="color:rgb(0,0,128);font-weight:bold">super </span>Address&gt; predicate);</pre>
            <br>
          </div>
          Thanks for any input,<br>
          <br>
        </div>
         - Will<br>
        <div>
          <div><br>
            [1] <a moz-do-not-send="true"
href="https://github.com/infinispan/infinispan/blob/master/core/src/main/java/org/infinispan/manager/ClusterExecutor.java">https://github.com/infinispan/infinispan/blob/master/core/src/main/java/org/infinispan/manager/ClusterExecutor.java</a><br>
            <br>
            <br>
            <div>
              <div><br>
                <br>
              </div>
            </div>
          </div>
        </div>
      </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>
    <p><br>
    </p>
  </body>
</html>