<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <br>
    <br>
    <div class="moz-cite-prefix">On 9/4/17 3:11 AM, Shafi Ahmad wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:131072bd-7d03-4f79-8ca0-6c26f9bbe315@default">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:"Calibri",sans-serif;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1"><o:p></o:p>
        <p class="MsoNormal"><o:p><br>
          </o:p></p>
        <p class="MsoNormal">The method hasListeners() is referenced
           inside MemoryImpl.java and defined in
           NotificationEmitterSupport.<o:p></o:p></p>
        <p class="MsoNormal">This method is not present in
           NotificationBroadcasterSupport so I added it to
          NotificationBroadcasterSupport.<o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p></p>
        <p class="MsoNormal">Jdk10 bug: <a
            href="https://bugs.openjdk.java.net/browse/JDK-8170299"
            moz-do-not-send="true">https://bugs.openjdk.java.net/browse/JDK-8170299</a><o:p></o:p></p>
        <p class="MsoNormal">Webrev link: <a
            href="http://cr.openjdk.java.net/%7Eshshahma/8170299/webrev.01/"
            moz-do-not-send="true">http://cr.openjdk.java.net/~shshahma/8170299/webrev.01/</a><o:p></o:p></p>
        <p class="MsoNormal"><o:p> </o:p><br>
        </p>
      </div>
    </blockquote>
    This patch adds a new public method in
    NotificationBroadcasterSupport.  I think this fix wants to avoid
    adding this public method since this fix is intended to be backport.<br>
    <br>
    MemoryImpl checks if there is any listener registered to avoid
    instantiating the notification object if no listener handles it.<br>
    <br>
    Replacing the internal sun.management.NotificationEmitterSupport
    with NotificationBroadcasterSupport is a good change.  I suggest to
    file a RFE to consider adding hasListeners method as a separate
    issue.  <br>
    <pre><span class="new"> 171     static final class ThreadExecutor implements Executor {</span>
<span class="new"> 172         public void execute(Runnable r) { new Thread(r).start(); }</span>
<span class="new"> 173     } 
</span>
</pre>
    This creates a new thread for each listener to handle each
    notification which is overkill.   You can create one system daemon
    thread to handle all notifications for all listeners.  <br>
    <br>
    For this fix, you could simply update NotificationEmitterSupport to
    create a system daemon thread to handle all notifications. 
    NotificationEmitterSupport::sendNotification should also be updated
    to ignore the exception (currently it throws an exception).  <br>
    <pre style="background-color:#ffffff;color:#000000;font-family:'Menlo';font-size:9.0pt;">Mandy</pre>
    <br>
  </body>
</html>