<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://www.developerdotstar.com/community" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>developer.* Blogs - Open Comments Thread for &amp;quot;The Task Pattern: A Design Pattern for Processing and Monitoring Long-Running Tasks&amp;quot; by Hugo Troche - Comments</title>
 <link>http://www.developerdotstar.com/community/node/100</link>
 <description>Comments for &quot;Open Comments Thread for &quot;The Task Pattern: A Design Pattern for Processing and Monitoring Long-Running Tasks&quot; by Hugo Troche&quot;</description>
 <language>en</language>
<item>
 <title>Task Pattern Code Example</title>
 <link>http://www.developerdotstar.com/community/node/100#comment-293</link>
 <description>&lt;p&gt;This is a little late in coming, but I&#039;m doing housekeeping today and found the comments below (and attached code) that was sent to me some time back by &quot;Task Pattern&quot; author Hugo Troche. A reader sent the following question to Hugo:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;I have some questions about your article in &lt;b&gt;developer.*&lt;/b&gt;, &quot;&lt;a href=&quot;/mag/articles/troche_taskpattern.html&quot;&gt;The Task Pattern: A Design Pattern for Procession and Monitoring Long-Running Tasks&lt;/a&gt;&quot;:&lt;/p&gt;
&lt;p&gt;Question 1: Do you have a minimal working Java example of the UML classes you describe in &lt;a href=&quot;http://www.developerdotstar.com/mag/images/troche/PaperFigure3.gif&quot; target=&quot;_blank&quot;&gt;Figure 3&lt;/a&gt;? I couldn&#039;t get it working.&lt;/p&gt;
&lt;p&gt;Question 2: What is not clear to me is the following: You wrote, &quot;Of course, this implementation is inefficient because the client of the task has to constantly monitor the task. It is much better if the task tells its clients when it has changed.&quot;&lt;/p&gt;
&lt;p&gt;I fully agree, but how does the clients gets informed if the status of the task changed? Do you have an working example for me where it is demonstrated?&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Hugo&#039;s response:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;I don&#039;t have a simple example of the task pattern. On the other hand I have a few real examples I am attaching to this email (Editor&#039;s note: &lt;a href=&quot;http://www.developerdotstar.com/mag/articles/files/TaskPatternExamples.zip&quot;&gt;click here&lt;/a&gt; to download a zip file of Hugo&#039;s code).&lt;/p&gt;
&lt;p&gt;I attached the source code for an application I did. Check out the method saveWorkspace in SadlMediator. In it I am using the task SaveWSTask to save the workspace of that particular application. Note how the task uses 3 commands (as in the GOF command pattern) to inform the listener (in this case the mediator) of what is going on. Also see how this example uses a worker to run the task in another thread. This will be an example of the UML diagram in figure 6 of the article. You will find that both mediators in the example use heavily the task pattern.&lt;/p&gt;
&lt;p&gt;As you can see from the example the task is in charge of informing the mediator when changes happen, not the mediator constantly checking the task for changes.&lt;/p&gt;
&lt;p&gt;In the zip file you will find the entire source code for this application (Sadl). This application was part of my Master&#039;s project so it is in the public domain.&lt;/p&gt;
&lt;p&gt;I hope these examples help. Let me know if you need more info. Thank you for reading the article and your questions.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;You can download a zip file of Hugo&#039;s code &lt;a href=&quot;http://www.developerdotstar.com/mag/articles/files/TaskPatternExamples.zip&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;--Dan&lt;/p&gt;
</description>
 <pubDate>Sun, 27 Mar 2005 15:24:45 -0800</pubDate>
 <dc:creator>Daniel Read</dc:creator>
 <guid isPermaLink="false">comment 293 at http://www.developerdotstar.com/community</guid>
</item>
<item>
 <title>Open Comments Thread for &quot;The Task Pattern: A Design Pattern for Processing and Monitoring Long-Running Tasks&quot; by Hugo Troche</title>
 <link>http://www.developerdotstar.com/community/node/100</link>
 <description>&lt;p&gt;This an open comments thread for the developer.* Magazine article &quot;&lt;a href=&quot;/mag/articles/troche_taskpattern.html&quot;&gt;The Task Pattern: A Design Pattern for Processing and Monitoring Long-Running Tasks&lt;/a&gt;,&quot; by Hugo Troche. If you haven&#039;t already, you &lt;a href=&quot;/mag/articles/troche_taskpattern.html&quot;&gt;can read it here&lt;/a&gt;, then add your comments below.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.developerdotstar.com/community/node/100&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://www.developerdotstar.com/community/node/100#comment</comments>
 <category domain="http://www.developerdotstar.com/community/taxonomy/term/34">Software Development Articles</category>
 <pubDate>Wed, 02 Feb 2005 19:35:51 -0800</pubDate>
 <dc:creator>Daniel Read</dc:creator>
 <guid isPermaLink="false">100 at http://www.developerdotstar.com/community</guid>
</item>
</channel>
</rss>
