<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-4262232281084864898.post813030695794898196..comments</id><updated>2008-08-18T04:26:19.698-07:00</updated><title type='text'>Comments on Java Thoughts: Spawning a thread for a lengthy operation in Wicke...</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://javathoughts.capesugarbird.com/feeds/813030695794898196/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4262232281084864898/813030695794898196/comments/default'/><link rel='alternate' type='text/html' href='http://javathoughts.capesugarbird.com/2008/04/spawning-thread-for-lengthy-operation.html'/><author><name>Julian Sinai</name><uri>http://www.blogger.com/profile/06209296951442764412</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>6</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4262232281084864898.post-8740565149415943115</id><published>2008-08-18T04:26:00.000-07:00</published><updated>2008-08-18T04:26:00.000-07:00</updated><title type='text'>I've tried this, but if I try to write out the fil...</title><content type='html'>I've tried this, but if I try to write out the file (uploadFile.writeTo) in the thread it sometimes fails with a "read error". if I move the writeTo into the main submit button processing it works fine. Do you know of any potential  problems in doing this?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4262232281084864898/813030695794898196/comments/default/8740565149415943115'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4262232281084864898/813030695794898196/comments/default/8740565149415943115'/><link rel='alternate' type='text/html' href='http://javathoughts.capesugarbird.com/2008/04/spawning-thread-for-lengthy-operation.html?showComment=1219058760000#c8740565149415943115' title=''/><author><name>andy</name><uri>http://www.blogger.com/profile/04596625083661116739</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://javathoughts.capesugarbird.com/2008/04/spawning-thread-for-lengthy-operation.html' ref='tag:blogger.com,1999:blog-4262232281084864898.post-813030695794898196' source='http://www.blogger.com/feeds/4262232281084864898/posts/default/813030695794898196' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-4262232281084864898.post-1229959649992736148</id><published>2008-05-06T17:09:00.000-07:00</published><updated>2008-05-06T17:09:00.000-07:00</updated><title type='text'>andy, you can reenable the buttons using the same ...</title><content type='html'>andy, you can reenable the buttons using the same technique as for the spinner:&lt;BR/&gt;&lt;BR/&gt;  final Button cancel = new Button("cancel")&lt;BR/&gt;  {&lt;BR/&gt;   private static final long serialVersionUID = 691332069442892669L;&lt;BR/&gt;&lt;BR/&gt;   @Override&lt;BR/&gt;   public void onSubmit()&lt;BR/&gt;   {&lt;BR/&gt;    setResponsePage(HomePage.class);&lt;BR/&gt;   }&lt;BR/&gt;   @Override&lt;BR/&gt;   public boolean isEnabled()&lt;BR/&gt;   {&lt;BR/&gt;    return !getMySession().isUploading();&lt;BR/&gt;   }&lt;BR/&gt;  };&lt;BR/&gt;  cancel.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(5)));&lt;BR/&gt;  myform.add(cancel);&lt;BR/&gt;&lt;BR/&gt;However, this doesn't work for the Browse button, at least on IE. The file upload control is a different beast.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4262232281084864898/813030695794898196/comments/default/1229959649992736148'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4262232281084864898/813030695794898196/comments/default/1229959649992736148'/><link rel='alternate' type='text/html' href='http://javathoughts.capesugarbird.com/2008/04/spawning-thread-for-lengthy-operation.html?showComment=1210118940000#c1229959649992736148' title=''/><author><name>Julian Sinai</name><uri>http://www.blogger.com/profile/06209296951442764412</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07518040812032340810'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://javathoughts.capesugarbird.com/2008/04/spawning-thread-for-lengthy-operation.html' ref='tag:blogger.com,1999:blog-4262232281084864898.post-813030695794898196' source='http://www.blogger.com/feeds/4262232281084864898/posts/default/813030695794898196' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-4262232281084864898.post-6423510774155442428</id><published>2008-05-04T04:35:00.000-07:00</published><updated>2008-05-04T04:35:00.000-07:00</updated><title type='text'>This is great and just what I've been looking for....</title><content type='html'>This is great and just what I've been looking for.&lt;BR/&gt;&lt;BR/&gt;My only thing now is that if somebody uploads a file, when it's complete I get the 'upload complete' message. But all the fields are still disabled until I exit the page and re-enter it.&lt;BR/&gt;&lt;BR/&gt;Is there any way to re-enable the buttons once the upload is complete automatically?&lt;BR/&gt;&lt;BR/&gt;Thanks&lt;BR/&gt;Andrew</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4262232281084864898/813030695794898196/comments/default/6423510774155442428'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4262232281084864898/813030695794898196/comments/default/6423510774155442428'/><link rel='alternate' type='text/html' href='http://javathoughts.capesugarbird.com/2008/04/spawning-thread-for-lengthy-operation.html?showComment=1209900900000#c6423510774155442428' title=''/><author><name>andy</name><uri>http://www.blogger.com/profile/04596625083661116739</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://javathoughts.capesugarbird.com/2008/04/spawning-thread-for-lengthy-operation.html' ref='tag:blogger.com,1999:blog-4262232281084864898.post-813030695794898196' source='http://www.blogger.com/feeds/4262232281084864898/posts/default/813030695794898196' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-4262232281084864898.post-2677717127537918458</id><published>2008-04-24T09:41:00.000-07:00</published><updated>2008-04-24T09:41:00.000-07:00</updated><title type='text'>Philip, I'm glad I could help you.Lars, thanks for...</title><content type='html'>Philip, I'm glad I could help you.&lt;BR/&gt;&lt;BR/&gt;Lars, thanks for pointing out this potential problem. It did not turn out to be an issue in my testing, I believe because I only allow one Wicket Thread and the ImportThread per user session. The issue might occur if I allowed multiple ImportThreads per user session. However, since what you suggest is a better practice, I've made the change.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4262232281084864898/813030695794898196/comments/default/2677717127537918458'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4262232281084864898/813030695794898196/comments/default/2677717127537918458'/><link rel='alternate' type='text/html' href='http://javathoughts.capesugarbird.com/2008/04/spawning-thread-for-lengthy-operation.html?showComment=1209055260000#c2677717127537918458' title=''/><author><name>Julian Sinai</name><uri>http://www.blogger.com/profile/06209296951442764412</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='07518040812032340810'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://javathoughts.capesugarbird.com/2008/04/spawning-thread-for-lengthy-operation.html' ref='tag:blogger.com,1999:blog-4262232281084864898.post-813030695794898196' source='http://www.blogger.com/feeds/4262232281084864898/posts/default/813030695794898196' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-4262232281084864898.post-1108292217418828887</id><published>2008-04-23T23:39:00.000-07:00</published><updated>2008-04-23T23:39:00.000-07:00</updated><title type='text'>Hi,There is a visibility issue in your example. Th...</title><content type='html'>Hi,&lt;BR/&gt;&lt;BR/&gt;There is a visibility issue in your example. The uploading and uploadComplete flag are accessed by two different Threads (Wicket's Thread and the ImportThread). If you don't do proper locking or declare those properties as volatile it might happen that a change to one of those properties is never seen by the other Thread. The JVM allows this behavior for optimization reasons.&lt;BR/&gt;Too prevent the visibility problem I suggest you declare the uploading and uploadComplete flags as volatile. This forces the JVM to write the changes made to those properties to main memory and is therefor seen by all Threads.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4262232281084864898/813030695794898196/comments/default/1108292217418828887'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4262232281084864898/813030695794898196/comments/default/1108292217418828887'/><link rel='alternate' type='text/html' href='http://javathoughts.capesugarbird.com/2008/04/spawning-thread-for-lengthy-operation.html?showComment=1209019140000#c1108292217418828887' title=''/><author><name>lars</name><uri>http://www.blogger.com/profile/02486549631451836263</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://javathoughts.capesugarbird.com/2008/04/spawning-thread-for-lengthy-operation.html' ref='tag:blogger.com,1999:blog-4262232281084864898.post-813030695794898196' source='http://www.blogger.com/feeds/4262232281084864898/posts/default/813030695794898196' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-4262232281084864898.post-8126624124738733690</id><published>2008-04-23T19:54:00.000-07:00</published><updated>2008-04-23T19:54:00.000-07:00</updated><title type='text'>Wow!  This is _exactly_ the code sample I have bee...</title><content type='html'>Wow!  This is _exactly_ the code sample I have been looking for.  Thanks so much for taking the time to post it!&lt;BR/&gt;&lt;BR/&gt;Cheers,&lt;BR/&gt;Philip</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4262232281084864898/813030695794898196/comments/default/8126624124738733690'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4262232281084864898/813030695794898196/comments/default/8126624124738733690'/><link rel='alternate' type='text/html' href='http://javathoughts.capesugarbird.com/2008/04/spawning-thread-for-lengthy-operation.html?showComment=1209005640000#c8126624124738733690' title=''/><author><name>Philip Johnson</name><uri>http://www.blogger.com/profile/12095636274313170271</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://javathoughts.capesugarbird.com/2008/04/spawning-thread-for-lengthy-operation.html' ref='tag:blogger.com,1999:blog-4262232281084864898.post-813030695794898196' source='http://www.blogger.com/feeds/4262232281084864898/posts/default/813030695794898196' type='text/html'/></entry></feed>