<?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: Java desktop links of the week, July 27</title>
	<atom:link href="http://JonathanGiles.net/blog/?feed=rss2&#038;p=551" rel="self" type="application/rss+xml" />
	<link>http://JonathanGiles.net/blog/?p=551</link>
	<description></description>
	<lastBuildDate>Mon, 06 Sep 2010 10:29:59 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
	<item>
		<title>By: Toni Epple</title>
		<link>http://JonathanGiles.net/blog/?p=551&#038;cpage=1#comment-31714</link>
		<dc:creator>Toni Epple</dc:creator>
		<pubDate>Mon, 27 Jul 2009 20:38:27 +0000</pubDate>
		<guid isPermaLink="false">http://JonathanGiles.net/blog/?p=551#comment-31714</guid>
		<description>&gt;I answered the way I did because I wanted things to be very clear regarding how to use the EDT. Blog posts like the one being discussed here can sometimes lead to confusion, so I felt like I should offer a clarification.

I don&#039;t know if in the meantime you have read the post, but my only intention was to clarify this exact question in order to stop the confusion in this topic.

&gt;This weekly post takes a lot of time, and I appreciate hearing from people when I have helped. 

Right, so after we had a lively and enjoyable discussion: thanks for getting Josh to answer this question here!

By the way: It seems we&#039;ve got something in common, I&#039;m also happy when people appreciate my postings ;-)

--Toni</description>
		<content:encoded><![CDATA[<p>&gt;I answered the way I did because I wanted things to be very clear regarding how to use the EDT. Blog posts like the one being discussed here can sometimes lead to confusion, so I felt like I should offer a clarification.</p>
<p>I don&#8217;t know if in the meantime you have read the post, but my only intention was to clarify this exact question in order to stop the confusion in this topic.</p>
<p>&gt;This weekly post takes a lot of time, and I appreciate hearing from people when I have helped. </p>
<p>Right, so after we had a lively and enjoyable discussion: thanks for getting Josh to answer this question here!</p>
<p>By the way: It seems we&#8217;ve got something in common, I&#8217;m also happy when people appreciate my postings <img src='http://JonathanGiles.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>&#8211;Toni</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Toni Epple</title>
		<link>http://JonathanGiles.net/blog/?p=551&#038;cpage=1#comment-31711</link>
		<dc:creator>Toni Epple</dc:creator>
		<pubDate>Mon, 27 Jul 2009 20:09:30 +0000</pubDate>
		<guid isPermaLink="false">http://JonathanGiles.net/blog/?p=551#comment-31711</guid>
		<description>@Patrick: Thanks for your hints. 
--Toni</description>
		<content:encoded><![CDATA[<p>@Patrick: Thanks for your hints.<br />
&#8211;Toni</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan</title>
		<link>http://JonathanGiles.net/blog/?p=551&#038;cpage=1#comment-31710</link>
		<dc:creator>Jonathan</dc:creator>
		<pubDate>Mon, 27 Jul 2009 20:08:02 +0000</pubDate>
		<guid isPermaLink="false">http://JonathanGiles.net/blog/?p=551#comment-31710</guid>
		<description>Ryan,

I answered the way I did because I wanted things to be very clear regarding how to use the EDT. Blog posts like the one being discussed here can sometimes lead to confusion, so I felt like I should offer a clarification. 

I knew the Swing team would come in and leave official comments, but until that time I wanted to fill the gap with what I was certain would be the general EDT rules. Like I said, I have no official relationship with the people at Sun, although I count a number of them as friends. Josh has left a semi-official Swing team response, and I&#039;m waiting for Alexander Potochkin (head of the Swing team) to come in as well.

Regarding Kirill&#039;s blog: I can only do what I can do. I feel that I am helping to fill a gap, which thousands of people a month visit and seem to appreciate. This weekly post takes a lot of time, and I appreciate hearing from people when I have helped. Conversely, if you do not like this blog, please by all means leave - it really does not affect me. I don&#039;t get any financial gain from taking time out of my day to (dis)please people, and do it because I am passionate about Java client technologies.

Thanks,
Jonathan</description>
		<content:encoded><![CDATA[<p>Ryan,</p>
<p>I answered the way I did because I wanted things to be very clear regarding how to use the EDT. Blog posts like the one being discussed here can sometimes lead to confusion, so I felt like I should offer a clarification. </p>
<p>I knew the Swing team would come in and leave official comments, but until that time I wanted to fill the gap with what I was certain would be the general EDT rules. Like I said, I have no official relationship with the people at Sun, although I count a number of them as friends. Josh has left a semi-official Swing team response, and I&#8217;m waiting for Alexander Potochkin (head of the Swing team) to come in as well.</p>
<p>Regarding Kirill&#8217;s blog: I can only do what I can do. I feel that I am helping to fill a gap, which thousands of people a month visit and seem to appreciate. This weekly post takes a lot of time, and I appreciate hearing from people when I have helped. Conversely, if you do not like this blog, please by all means leave &#8211; it really does not affect me. I don&#8217;t get any financial gain from taking time out of my day to (dis)please people, and do it because I am passionate about Java client technologies.</p>
<p>Thanks,<br />
Jonathan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Toni Epple</title>
		<link>http://JonathanGiles.net/blog/?p=551&#038;cpage=1#comment-31709</link>
		<dc:creator>Toni Epple</dc:creator>
		<pubDate>Mon, 27 Jul 2009 19:37:34 +0000</pubDate>
		<guid isPermaLink="false">http://JonathanGiles.net/blog/?p=551#comment-31709</guid>
		<description>Hi Josh, 

thanks very much for your reply. I really appreciate this.

--Toni</description>
		<content:encoded><![CDATA[<p>Hi Josh, </p>
<p>thanks very much for your reply. I really appreciate this.</p>
<p>&#8211;Toni</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh Marinacci</title>
		<link>http://JonathanGiles.net/blog/?p=551&#038;cpage=1#comment-31706</link>
		<dc:creator>Josh Marinacci</dc:creator>
		<pubDate>Mon, 27 Jul 2009 15:49:05 +0000</pubDate>
		<guid isPermaLink="false">http://JonathanGiles.net/blog/?p=551#comment-31706</guid>
		<description>As a former member of the Swing Team I&#039;m going to go ahead and say that creating UI objects (not just components) off of the EDT is a bug in your program.

Until the 1.4/1.5 timeframe we said it was okay to create your UI objects off of the EDT in certain cases (main frame not initalized). This was our mistake. We should have said this because it depends on particular implementation details of Swing (the order in which things are initialized internally), and it turns out we were wrong in some cases. Therefore we now say that creating or manipulating any UI object off of the EDT is a bug.  Doing so will probably work fine in 99% of the cases, but you have now introduced potential race conditions in your app that may give you strange behavior later on.

One more detail, and this is important. As we work to further improve startup time of the VM and the Swing infrastructure, we will likely change the internals of Swing. This may increase the likely hood that code which used to work fine off of the GUI thread will now break. Therefore it is *very* important that you stay on the GUI thread; and that&#039;s why I say: yes, it&#039;s a bug!</description>
		<content:encoded><![CDATA[<p>As a former member of the Swing Team I&#8217;m going to go ahead and say that creating UI objects (not just components) off of the EDT is a bug in your program.</p>
<p>Until the 1.4/1.5 timeframe we said it was okay to create your UI objects off of the EDT in certain cases (main frame not initalized). This was our mistake. We should have said this because it depends on particular implementation details of Swing (the order in which things are initialized internally), and it turns out we were wrong in some cases. Therefore we now say that creating or manipulating any UI object off of the EDT is a bug.  Doing so will probably work fine in 99% of the cases, but you have now introduced potential race conditions in your app that may give you strange behavior later on.</p>
<p>One more detail, and this is important. As we work to further improve startup time of the VM and the Swing infrastructure, we will likely change the internals of Swing. This may increase the likely hood that code which used to work fine off of the GUI thread will now break. Therefore it is *very* important that you stay on the GUI thread; and that&#8217;s why I say: yes, it&#8217;s a bug!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://JonathanGiles.net/blog/?p=551&#038;cpage=1#comment-31705</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Mon, 27 Jul 2009 15:10:02 +0000</pubDate>
		<guid isPermaLink="false">http://JonathanGiles.net/blog/?p=551#comment-31705</guid>
		<description>Jonathan, your blog comment/responses are arrogant and rude. Esp if you didn&#039;t even bother to read it! And if you have no affiliation with the Swing team what are you doing answering for them? 

Dude, Kirill&#039;s blog was much better written, you sound like an arrogant twat. Bookmark deleted. 

Look at Patricks response, now that was worth reading.....</description>
		<content:encoded><![CDATA[<p>Jonathan, your blog comment/responses are arrogant and rude. Esp if you didn&#8217;t even bother to read it! And if you have no affiliation with the Swing team what are you doing answering for them? </p>
<p>Dude, Kirill&#8217;s blog was much better written, you sound like an arrogant twat. Bookmark deleted. </p>
<p>Look at Patricks response, now that was worth reading&#8230;..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick Wright</title>
		<link>http://JonathanGiles.net/blog/?p=551&#038;cpage=1#comment-31703</link>
		<dc:creator>Patrick Wright</dc:creator>
		<pubDate>Mon, 27 Jul 2009 14:24:33 +0000</pubDate>
		<guid isPermaLink="false">http://JonathanGiles.net/blog/?p=551#comment-31703</guid>
		<description>There was a discussion about this on the Swing App Framework mailing list a couple of years back. Hans Muller (ex of Swing team), responded
http://markmail.org/message/gjhgs4mw732d64ux

Quoting Hans: &quot;Generally speaking, you should not create Swing objects or access them off the EDT thread. We used to claim that it was safe to create/access components off the EDT if they hadn&#039;t been &quot;realized&quot; yet, i.e. if they didn&#039;t have a heavyweight ancestor. This was a weak rationalization of what was already happening on the main thread of most applications anyway, and we were doing some testing to verify that it was safe. We no longer make that claim and have tried to advise developers about using an idiom, as the application framework does, that moves all the work of creating and showing an application to the EDT. That&#039;s because, if you don&#039;t, there&#039;s always the possibility of re-entering code that&#039;s designed to be single-threaded.

In this particular case, we&#039;re familiar enough with the internal code paths (Scott Violet wrote the original waitForEmptyEventQ code), to safely create an &quot;unrealized&quot; component off the EDT. The implementation of waitForEmptyEventQ isn&#039;t intended to be exemplary, and if I could have hung a dark curtain in front of it I would have :-).

- Hans &quot;

HTH
Patrick</description>
		<content:encoded><![CDATA[<p>There was a discussion about this on the Swing App Framework mailing list a couple of years back. Hans Muller (ex of Swing team), responded<br />
<a href="http://markmail.org/message/gjhgs4mw732d64ux" rel="nofollow">http://markmail.org/message/gjhgs4mw732d64ux</a></p>
<p>Quoting Hans: &#8220;Generally speaking, you should not create Swing objects or access them off the EDT thread. We used to claim that it was safe to create/access components off the EDT if they hadn&#8217;t been &#8220;realized&#8221; yet, i.e. if they didn&#8217;t have a heavyweight ancestor. This was a weak rationalization of what was already happening on the main thread of most applications anyway, and we were doing some testing to verify that it was safe. We no longer make that claim and have tried to advise developers about using an idiom, as the application framework does, that moves all the work of creating and showing an application to the EDT. That&#8217;s because, if you don&#8217;t, there&#8217;s always the possibility of re-entering code that&#8217;s designed to be single-threaded.</p>
<p>In this particular case, we&#8217;re familiar enough with the internal code paths (Scott Violet wrote the original waitForEmptyEventQ code), to safely create an &#8220;unrealized&#8221; component off the EDT. The implementation of waitForEmptyEventQ isn&#8217;t intended to be exemplary, and if I could have hung a dark curtain in front of it I would have <img src='http://JonathanGiles.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .</p>
<p>- Hans &#8221;</p>
<p>HTH<br />
Patrick</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Toni Epple</title>
		<link>http://JonathanGiles.net/blog/?p=551&#038;cpage=1#comment-31702</link>
		<dc:creator>Toni Epple</dc:creator>
		<pubDate>Mon, 27 Jul 2009 11:30:39 +0000</pubDate>
		<guid isPermaLink="false">http://JonathanGiles.net/blog/?p=551#comment-31702</guid>
		<description>If, as you say, the component creation off the EDT is not a bug, then any errors that the &#039;edt-violators&#039; are receiving are a function of bugs in their code. When it&#039;s working, it&#039;s not a function of good luck, but of good coding.

Sorry to be such a bean counter, but I think there&#039;s an important difference between a bad practice and a bug. And this is a topic where the borderline is specifically hard to see. 

A lot of developers base their code on the assumption that this is a bug. E.g. FEST testing tools has a RepaintManager that looks for EDT Violations that tries to enforce a rule that we can&#039;t be sure exists. Substance Look And Feel throws exceptions when components are created off the EDT. So it can&#039;t be used if the applications when they do something that, in your opinion isn&#039;t a bug at all.

So there are a lot of practical implications and we all would benefit from an official answer, or even a discussion with the Swing team about this. It&#039;s not odd to ask for this, and I don&#039;t think we agree on the whole topic, we only agree that it&#039;s better not to use component creation off EDT.

I personally am not so sure if it&#039;s a bug or not. Many people think it is, but I guess final words can only come from the Swing team.

So if you can arrange for the Swing team to give an official answer that would be great. Especially if the answer reveals the rationale and technical details behind their decision.</description>
		<content:encoded><![CDATA[<p>If, as you say, the component creation off the EDT is not a bug, then any errors that the &#8216;edt-violators&#8217; are receiving are a function of bugs in their code. When it&#8217;s working, it&#8217;s not a function of good luck, but of good coding.</p>
<p>Sorry to be such a bean counter, but I think there&#8217;s an important difference between a bad practice and a bug. And this is a topic where the borderline is specifically hard to see. </p>
<p>A lot of developers base their code on the assumption that this is a bug. E.g. FEST testing tools has a RepaintManager that looks for EDT Violations that tries to enforce a rule that we can&#8217;t be sure exists. Substance Look And Feel throws exceptions when components are created off the EDT. So it can&#8217;t be used if the applications when they do something that, in your opinion isn&#8217;t a bug at all.</p>
<p>So there are a lot of practical implications and we all would benefit from an official answer, or even a discussion with the Swing team about this. It&#8217;s not odd to ask for this, and I don&#8217;t think we agree on the whole topic, we only agree that it&#8217;s better not to use component creation off EDT.</p>
<p>I personally am not so sure if it&#8217;s a bug or not. Many people think it is, but I guess final words can only come from the Swing team.</p>
<p>So if you can arrange for the Swing team to give an official answer that would be great. Especially if the answer reveals the rationale and technical details behind their decision.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan</title>
		<link>http://JonathanGiles.net/blog/?p=551&#038;cpage=1#comment-31701</link>
		<dc:creator>Jonathan</dc:creator>
		<pubDate>Mon, 27 Jul 2009 09:47:43 +0000</pubDate>
		<guid isPermaLink="false">http://JonathanGiles.net/blog/?p=551#comment-31701</guid>
		<description>No, both in my original post and in your subsequent reply I didn&#039;t argue against what you were saying. I was stating the EDT rules as they currently stand, in my opinion. I think it is important that when the question is being raised that someone try to answer it, lest it lead to further confusion.

I&#039;m not trying to convince you one way or the other, I am merely posting an answer to your question, based on my understanding of the Swing EDT. I never even &#039;convinced my readers that (you think) component creation off EDT is totally OK&#039; - all I said was that I didn&#039;t bother to read it as I know what the rules are, and that reading your discussion can only lead to confusion.

Regarding your statement that current &#039;EDT-violators&#039; are getting away without any adverse consequences, that is purely a function of luck. Of course, as with many threading issues, 99999 times out of 100000 you&#039;re likely to get away with it, but it&#039;s that last time, that odd, unreproducible bug, that is going to cause you to pull your hair out.

I&#039;m sure I can arrange the Swing team to give an official answer, but as you and I both seem to agree about how to interact with the EDT, it seems like an odd request?

As for my comment that it is not a bug, well, it isn&#039;t. Violating the EDT isn&#039;t going to cause your program to come grinding to a halt, but it will lead to less certainty in the consistency and usability of the UI. Perhaps it&#039;s semantics. Regardless, violate the EDT rules (as stated above) at your own peril should be the final word on the matter.</description>
		<content:encoded><![CDATA[<p>No, both in my original post and in your subsequent reply I didn&#8217;t argue against what you were saying. I was stating the EDT rules as they currently stand, in my opinion. I think it is important that when the question is being raised that someone try to answer it, lest it lead to further confusion.</p>
<p>I&#8217;m not trying to convince you one way or the other, I am merely posting an answer to your question, based on my understanding of the Swing EDT. I never even &#8216;convinced my readers that (you think) component creation off EDT is totally OK&#8217; &#8211; all I said was that I didn&#8217;t bother to read it as I know what the rules are, and that reading your discussion can only lead to confusion.</p>
<p>Regarding your statement that current &#8216;EDT-violators&#8217; are getting away without any adverse consequences, that is purely a function of luck. Of course, as with many threading issues, 99999 times out of 100000 you&#8217;re likely to get away with it, but it&#8217;s that last time, that odd, unreproducible bug, that is going to cause you to pull your hair out.</p>
<p>I&#8217;m sure I can arrange the Swing team to give an official answer, but as you and I both seem to agree about how to interact with the EDT, it seems like an odd request?</p>
<p>As for my comment that it is not a bug, well, it isn&#8217;t. Violating the EDT isn&#8217;t going to cause your program to come grinding to a halt, but it will lead to less certainty in the consistency and usability of the UI. Perhaps it&#8217;s semantics. Regardless, violate the EDT rules (as stated above) at your own peril should be the final word on the matter.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Toni Epple</title>
		<link>http://JonathanGiles.net/blog/?p=551&#038;cpage=1#comment-31700</link>
		<dc:creator>Toni Epple</dc:creator>
		<pubDate>Mon, 27 Jul 2009 09:32:23 +0000</pubDate>
		<guid isPermaLink="false">http://JonathanGiles.net/blog/?p=551#comment-31700</guid>
		<description>Let me sum this up: First you argued against my article without bothering to read it, giving your readers the wrong impression that I think component creation off EDT is totally OK, now you make an even stronger statement than I ever did saying component creation off the EDT is not a bug at all. :-)

And again you try to convince me of something I never disagreed with: I totally agree that it&#039;s better not to create components off the EDT in order to avoid problems.

Still, there are tons of very large applications out there that for many years have been using component creation off the EDT without obvious problems.  

I still think that an official statement by the Swing team is needed in the Swing Docs, ( which is the main point of my article ).</description>
		<content:encoded><![CDATA[<p>Let me sum this up: First you argued against my article without bothering to read it, giving your readers the wrong impression that I think component creation off EDT is totally OK, now you make an even stronger statement than I ever did saying component creation off the EDT is not a bug at all. <img src='http://JonathanGiles.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>And again you try to convince me of something I never disagreed with: I totally agree that it&#8217;s better not to create components off the EDT in order to avoid problems.</p>
<p>Still, there are tons of very large applications out there that for many years have been using component creation off the EDT without obvious problems.  </p>
<p>I still think that an official statement by the Swing team is needed in the Swing Docs, ( which is the main point of my article ).</p>
]]></content:encoded>
	</item>
</channel>
</rss>
