<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Bringing &#8216;yield return&#8217; from C# to Java</title>
	<atom:link href="http://jimblackler.net/blog/?feed=rss2&#038;p=61" rel="self" type="application/rss+xml" />
	<link>http://jimblackler.net/blog/?p=61</link>
	<description>planet of the apps</description>
	<lastBuildDate>Tue, 09 Apr 2013 08:08:41 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: jimblackler</title>
		<link>http://jimblackler.net/blog/?p=61&#038;cpage=1#comment-79654</link>
		<dc:creator>jimblackler</dc:creator>
		<pubDate>Fri, 01 Jun 2012 12:10:11 +0000</pubDate>
		<guid isPermaLink="false">http://jimblackler.net/blog/?p=61#comment-79654</guid>
		<description>Thanks Olivier, consider it public domain.</description>
		<content:encoded><![CDATA[<p>Thanks Olivier, consider it public domain.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Olivier Mélois</title>
		<link>http://jimblackler.net/blog/?p=61&#038;cpage=1#comment-79610</link>
		<dc:creator>Olivier Mélois</dc:creator>
		<pubDate>Fri, 01 Jun 2012 09:51:39 +0000</pubDate>
		<guid isPermaLink="false">http://jimblackler.net/blog/?p=61#comment-79610</guid>
		<description>This is absolutely interesting. 

Have your code been published under an open-source license ? I&#039;m working on a project to allow the creation of easily customizable model iterators. The project has not really started yet, but it will in a few days. I&#039;m thinking about re-using some of your code, would you allow it.

Great article :D</description>
		<content:encoded><![CDATA[<p>This is absolutely interesting. </p>
<p>Have your code been published under an open-source license ? I&#8217;m working on a project to allow the creation of easily customizable model iterators. The project has not really started yet, but it will in a few days. I&#8217;m thinking about re-using some of your code, would you allow it.</p>
<p>Great article :D</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://jimblackler.net/blog/?p=61&#038;cpage=1#comment-48031</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Tue, 12 Apr 2011 17:56:09 +0000</pubDate>
		<guid isPermaLink="false">http://jimblackler.net/blog/?p=61#comment-48031</guid>
		<description>I don&#039;t know if you&#039;re interested, but I made a quick change to allow runtime exceptions thrown in a collect method to be re-thrown by the threaded yield adapter.

diff -r 0107610716ee src/net/jimblackler/Utils/ThreadedYieldAdapter.java
--- a/src/net/jimblackler/Utils/ThreadedYieldAdapter.java	Tue Apr 12 13:42:43 2011 -0400
+++ b/src/net/jimblackler/Utils/ThreadedYieldAdapter.java	Tue Apr 12 13:51:27 2011 -0400
@@ -27,6 +27,16 @@
     private class AbortedMessage extends StopMessage {
 
     }
+    
+    private class ExceptionMessage extends StopMessage {
+    	RuntimeException cause;
+    	ExceptionMessage(RuntimeException cause) {
+    		this.cause = cause;
+    	}
+    	RuntimeException getCause() {
+    		return cause;
+    	}
+    }
 
     /**
      * The vehicle to pass the actual values.
@@ -103,6 +113,8 @@
                                     // to receive it, and the thread will block.
                                     synchronousQueue.put(new AbortedMessage());
                                 }
+                            } catch (RuntimeException e) {
+                                    synchronousQueue.put(new ExceptionMessage(e));
                             }
 
                         } catch (InterruptedException e) {
@@ -140,6 +152,9 @@
                             try {
                               returnQueue.put(new Object()); // allow other thread to gather result
                               messageWaiting = synchronousQueue.take();
+                              if (ExceptionMessage.class.isAssignableFrom(messageWaiting.getClass())) {
+                            	  throw ((ExceptionMessage)messageWaiting).getCause();
+                              }
 
                             } catch (InterruptedException e) {
                                 messageWaiting = new EndMessage();</description>
		<content:encoded><![CDATA[<p>I don&#8217;t know if you&#8217;re interested, but I made a quick change to allow runtime exceptions thrown in a collect method to be re-thrown by the threaded yield adapter.</p>
<p>diff -r 0107610716ee src/net/jimblackler/Utils/ThreadedYieldAdapter.java<br />
&#8212; a/src/net/jimblackler/Utils/ThreadedYieldAdapter.java	Tue Apr 12 13:42:43 2011 -0400<br />
+++ b/src/net/jimblackler/Utils/ThreadedYieldAdapter.java	Tue Apr 12 13:51:27 2011 -0400<br />
@@ -27,6 +27,16 @@<br />
     private class AbortedMessage extends StopMessage {</p>
<p>     }<br />
+<br />
+    private class ExceptionMessage extends StopMessage {<br />
+    	RuntimeException cause;<br />
+    	ExceptionMessage(RuntimeException cause) {<br />
+    		this.cause = cause;<br />
+    	}<br />
+    	RuntimeException getCause() {<br />
+    		return cause;<br />
+    	}<br />
+    }</p>
<p>     /**<br />
      * The vehicle to pass the actual values.<br />
@@ -103,6 +113,8 @@<br />
                                     // to receive it, and the thread will block.<br />
                                     synchronousQueue.put(new AbortedMessage());<br />
                                 }<br />
+                            } catch (RuntimeException e) {<br />
+                                    synchronousQueue.put(new ExceptionMessage(e));<br />
                             }</p>
<p>                         } catch (InterruptedException e) {<br />
@@ -140,6 +152,9 @@<br />
                             try {<br />
                               returnQueue.put(new Object()); // allow other thread to gather result<br />
                               messageWaiting = synchronousQueue.take();<br />
+                              if (ExceptionMessage.class.isAssignableFrom(messageWaiting.getClass())) {<br />
+                            	  throw ((ExceptionMessage)messageWaiting).getCause();<br />
+                              }</p>
<p>                             } catch (InterruptedException e) {<br />
                                 messageWaiting = new EndMessage();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neal Gafter</title>
		<link>http://jimblackler.net/blog/?p=61&#038;cpage=1#comment-5197</link>
		<dc:creator>Neal Gafter</dc:creator>
		<pubDate>Wed, 05 Nov 2008 05:30:01 +0000</pubDate>
		<guid isPermaLink="false">http://jimblackler.net/blog/?p=61#comment-5197</guid>
		<description>See http://gafter.blogspot.com/2007/07/internal-versus-external-iterators.html for another take at this problem.</description>
		<content:encoded><![CDATA[<p>See <a href="http://gafter.blogspot.com/2007/07/internal-versus-external-iterators.html" rel="nofollow">http://gafter.blogspot.com/2007/07/internal-versus-external-iterators.html</a> for another take at this problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Howard Lovatt</title>
		<link>http://jimblackler.net/blog/?p=61&#038;cpage=1#comment-4596</link>
		<dc:creator>Howard Lovatt</dc:creator>
		<pubDate>Wed, 15 Oct 2008 09:23:49 +0000</pubDate>
		<guid isPermaLink="false">http://jimblackler.net/blog/?p=61#comment-4596</guid>
		<description>I think that Phasers (http://www.cs.rice.edu/~vs3/PDF/SPSS08-phasers.pdf) are going to be part of Java 7 and I think these can achieve the same aim of generating a list lazily, but via a slightly different paradigm.</description>
		<content:encoded><![CDATA[<p>I think that Phasers (<a href="http://www.cs.rice.edu/~vs3/PDF/SPSS08-phasers.pdf" rel="nofollow">http://www.cs.rice.edu/~vs3/PDF/SPSS08-phasers.pdf</a>) are going to be part of Java 7 and I think these can achieve the same aim of generating a list lazily, but via a slightly different paradigm.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jimblackler</title>
		<link>http://jimblackler.net/blog/?p=61&#038;cpage=1#comment-4519</link>
		<dc:creator>jimblackler</dc:creator>
		<pubDate>Sun, 12 Oct 2008 18:56:44 +0000</pubDate>
		<guid isPermaLink="false">http://jimblackler.net/blog/?p=61#comment-4519</guid>
		<description>Thanks a lot for your comments Aviad. And also for your original article which I found very interesting. I confess I haven&#039;t profiled my implementation for performance, and it does seem likely this may make this technique unsuitable for some applications.</description>
		<content:encoded><![CDATA[<p>Thanks a lot for your comments Aviad. And also for your original article which I found very interesting. I confess I haven&#8217;t profiled my implementation for performance, and it does seem likely this may make this technique unsuitable for some applications.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aviad Ben Dov</title>
		<link>http://jimblackler.net/blog/?p=61&#038;cpage=1#comment-4516</link>
		<dc:creator>Aviad Ben Dov</dc:creator>
		<pubDate>Sun, 12 Oct 2008 18:12:27 +0000</pubDate>
		<guid isPermaLink="false">http://jimblackler.net/blog/?p=61#comment-4516</guid>
		<description>This is great. My first idea was to use a threading system like yours, and I eventually reasoned to create the yielder the way I did for two reasons:
1. It was more efficient, resource-wise. When dealing with tree-searching model, for example (see my collections example), you can find yourself in a canonical-yielder situation. With a threading model, you could quickly use the computer&#039;s resources. You end up with a lot of locks (due to the SynchronousQueue) and a lot of events running around your application.
2. It opens the path to adding a mechanism to a pre-process compiler (like APT), or even to OpenJDK, to be done in the C# way: in compile-time. The threading method works but its a workaround for a missing feature.

Don&#039;t get me wrong: effectively, the threading solution works (as mine is broken) and it probably takes less time to develop and understand, so kudos! :)</description>
		<content:encoded><![CDATA[<p>This is great. My first idea was to use a threading system like yours, and I eventually reasoned to create the yielder the way I did for two reasons:<br />
1. It was more efficient, resource-wise. When dealing with tree-searching model, for example (see my collections example), you can find yourself in a canonical-yielder situation. With a threading model, you could quickly use the computer&#8217;s resources. You end up with a lot of locks (due to the SynchronousQueue) and a lot of events running around your application.<br />
2. It opens the path to adding a mechanism to a pre-process compiler (like APT), or even to OpenJDK, to be done in the C# way: in compile-time. The threading method works but its a workaround for a missing feature.</p>
<p>Don&#8217;t get me wrong: effectively, the threading solution works (as mine is broken) and it probably takes less time to develop and understand, so kudos! :)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
