<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    this seems good. I think introducing an atomic state field instead
    of 2 boolean fields is better than synchronizing the methods.<br>
    <br>
    thanks<br>
    <br>
    -- Ron<br>
    <br>
    <br>
    On 12.08.2011 07:06, &#51060;&#55148;&#49849; (Trustin Lee) wrote:
    <blockquote cite="mid:0A92BD7DDEDA4DFE867D7834FCED03C0@gmail.com"
      type="cite">
      <div>I actually realized what you intended to say. &nbsp;Could you
        review my fix:
        <div><br>
        </div>
        <div>&nbsp;
<a class="moz-txt-link-freetext" href="https://github.com/netty/netty/commit/dbb239203460253f84b0f848b8f05e3b6e11a2fd">https://github.com/netty/netty/commit/dbb239203460253f84b0f848b8f05e3b6e11a2fd</a></div>
        <div><br>
        </div>
        <div>Cheers</div>
      </div>
      <div><br>
        --&nbsp;<br>
        <a moz-do-not-send="true" href="http://gleamynode.net/">Trustin
          Lee</a><br>
      </div>
      <p style="color: #A0A0A8;">On Friday, August 12, 2011 at 1:46 PM,
        Trustin Lee wrote:</p>
      <blockquote type="cite"
style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
        <span>
          <div>
            <div>Hi Ron,<br>
              <br>
              I like the alternative 2. However, could you explain why
              the public<br>
              methods in HashedWheelTimeout should be synchronized? Is
              there<br>
              anything thread-unsafe there?<br>
              <br>
              Thanks<br>
              <br>
              On Tue, Aug 9, 2011 at 4:54 PM, &lt;<a
                moz-do-not-send="true" href="mailto:rzo@gmx.de">rzo@gmx.de</a>&gt;
              wrote:<br>
              <blockquote type="cite">
                <div>Hello,<br>
                  <br>
                  given that the implementation is using "approximated
                  times" a call to Timeout.cancel() may not cancel the
                  task.<br>
                  <br>
                  I think that the problem is:<br>
                  <br>
                  public void cancel() {<br>
                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (isExpired()) {<br>
                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return;<br>
                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>
                  <br>
                  <br>
                  where isExpired checks:<br>
                  <br>
                  System.currentTimeMillis() &gt; deadline<br>
                  <br>
                  Solution:<br>
                  Alternative 1:<br>
                  <br>
                  remove the check:<br>
                  <br>
                  if (isExpired()) {<br>
                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return;<br>
                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>
                  <br>
                  Alternative 2:<br>
                  <br>
                  new field:<br>
                  <br>
                  boolean expired = false.<br>
                  <br>
                  this is set to true in:<br>
                  <br>
                  HashedWheelTimeout.expire()<br>
                  <br>
                  and isExpired()<br>
                  {<br>
                  &nbsp; return canceled || expired;<br>
                  }<br>
                  <br>
                  <br>
                  I also propose that the public methods on
                  HashedWheelTimeout be synchronized.<br>
                  <br>
                  What do you think ?<br>
                  <br>
                  -- Ron<br>
                  <a moz-do-not-send="true"
                    href="http://sourceforge.net/projects/yajsw">http://sourceforge.net/projects/yajsw</a><br>
                  --<br>
                  NEU: FreePhone - 0ct/min Handyspartarif mit
                  Geld-zur&uuml;ck-Garantie!<br>
                  Jetzt informieren: <a moz-do-not-send="true"
                    href="http://www.gmx.net/de/go/freephone">http://www.gmx.net/de/go/freephone</a><br>
                  _______________________________________________<br>
                  netty-users mailing list<br>
                  <a moz-do-not-send="true"
                    href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a><br>
                  <a moz-do-not-send="true"
                    href="https://lists.jboss.org/mailman/listinfo/netty-users">https://lists.jboss.org/mailman/listinfo/netty-users</a><br>
                </div>
              </blockquote>
              <br>
              <br>
              <br>
              -- <br>
              Trustin Lee, <a moz-do-not-send="true"
                href="http://gleamynode.net">http://gleamynode.net</a>/<br>
            </div>
          </div>
        </span> </blockquote>
      <div> <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
netty-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/netty-users">https://lists.jboss.org/mailman/listinfo/netty-users</a></pre>
    </blockquote>
    <br>
  </body>
</html>