<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p>Run into an interesting issue. &nbsp;Not sure if its an RI problem, or something else. &nbsp;Actually not even sure if its a problem just surprised me.</p>
<p><br>
</p>
<p>I have two very simple main methods here:</p>
<p><br>
</p>
<p></p>
<div>try(SeContainer container = SeContainerInitializer.newInstance()</div>
<div>.addPackages(Pojo.class)</div>
<div>.disableDiscovery()</div>
<div>.initialize()) {</div>
<div>Event&lt;Object&gt; event = container.getBeanManager().getEvent();</div>
<div>FixedThreadPoolExecutorServices executorServices = new FixedThreadPoolExecutorServices(2);</div>
<div>CompletionStage&lt;Pojo&gt; completionStage = event.fireAsync(new Pojo(&quot;this is asynchronous&quot;), NotificationOptions.ofExecutor(executorServices.getTaskExecutor()));</div>
<div>completionStage.<span>whenCompleteAsync</span>((pojo, throwable) -&gt; event.fire(new Pojo(pojo.showName() &#43; &quot;, and now this is synchronous&quot;)));</div>
<div>Thread.sleep(500L);</div>
<div>}</div>
<br>
<p></p>
<p></p>
<div>public static void main(String...args) throws Exception{</div>
<div>try(SeContainer container = SeContainerInitializer.newInstance()</div>
<div>.addPackages(Pojo.class)</div>
<div>.disableDiscovery()</div>
<div>.initialize()) {</div>
<div>Event&lt;Object&gt; event = container.getBeanManager().getEvent();</div>
<div>CompletionStage&lt;Pojo&gt; completionStage = event.fireAsync(new Pojo(&quot;this is asynchronous&quot;));</div>
<div>completionStage.<span>whenCompleteAsync</span>((pojo, throwable) -&gt; event.fire(new Pojo(pojo.showName() &#43; &quot;, and now this is synchronous&quot;)));</div>
<div>Thread.sleep(500L);</div>
<div>}</div>
<div>}</div>
<br>
<p></p>
<p><br>
</p>
<p>In the first, I'm using a custom executor (a 2 thread pool executor) and the latter just using the default unspecified version, which weld seems to use a fork-join pool. &nbsp;In both of these examples, I use the
<span>whenCompleteAsync</span> method. &nbsp;in the first method, I always see the fired event being handled in a different thread than what handled the first event. &nbsp;In the second method, I always see the fired events both being handled in the same thread. &nbsp;Is
 that just the behavior of fork-join? Or something special happening?</p>
<p><br>
</p>
<p>John</p>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p></p>
</div>
</div>
</div>
<hr>
NOTICE: This e-mail message and any attachments may contain confidential, proprietary, and/or privileged information which should be treated accordingly. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this
 message, and destroy all physical and electronic copies. Thank you.
</body>
</html>