<?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: Defining a background Job to run periodically</title>
	<atom:link href="http://urbas.tk/index.php/2009/03/01/defining-a-background-job-to-run-periodically/feed/" rel="self" type="application/rss+xml" />
	<link>http://urbas.tk/index.php/2009/03/01/defining-a-background-job-to-run-periodically/</link>
	<description>Radoslaw H. Urbas homepage / blog</description>
	<lastBuildDate>Mon, 28 Nov 2011 15:23:40 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Robert Konigsberg</title>
		<link>http://urbas.tk/index.php/2009/03/01/defining-a-background-job-to-run-periodically/comment-page-1/#comment-1453</link>
		<dc:creator>Robert Konigsberg</dc:creator>
		<pubDate>Tue, 03 Mar 2009 15:10:08 +0000</pubDate>
		<guid isPermaLink="false">http://urbas.tk/?p=81#comment-1453</guid>
		<description>I sent Min&#039;s comment about IStartup to some colleagues and here was a reply:
---
The point is that enabling your module to run it early during startup
will also enable all its dependencies and it does not scale well. The
push is to make everything turned on on demand. A couple of (3rd
party) plugins with their IStartups may effectively ruin the effort to
make the product lazily initialized.

This comment does not bring any convincing argument. If UI is displayed but there is a couple of threads running on background it is likely that the application will be unresponsive (thread priorities do
not help much).</description>
		<content:encoded><![CDATA[<p>I sent Min&#8217;s comment about IStartup to some colleagues and here was a reply:<br />
&#8212;<br />
The point is that enabling your module to run it early during startup<br />
will also enable all its dependencies and it does not scale well. The<br />
push is to make everything turned on on demand. A couple of (3rd<br />
party) plugins with their IStartups may effectively ruin the effort to<br />
make the product lazily initialized.</p>
<p>This comment does not bring any convincing argument. If UI is displayed but there is a couple of threads running on background it is likely that the application will be unresponsive (thread priorities do<br />
not help much).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matthias</title>
		<link>http://urbas.tk/index.php/2009/03/01/defining-a-background-job-to-run-periodically/comment-page-1/#comment-1434</link>
		<dc:creator>Matthias</dc:creator>
		<pubDate>Mon, 02 Mar 2009 11:37:01 +0000</pubDate>
		<guid isPermaLink="false">http://urbas.tk/?p=81#comment-1434</guid>
		<description>Hi!

I like the idea of using a bundle&#039;s lifecycle methods start() and stop() for starting and stopping a &quot;job&quot; controlled by some other bundle. 
But a bundle can only be started once in a time. So if I have the use case that a job can be run any number of times this solution won&#039;t work, because a bundle can only be started once until it is stopped, right?!

Which possibilities would I have for such an use-case?!?</description>
		<content:encoded><![CDATA[<p>Hi!</p>
<p>I like the idea of using a bundle&#8217;s lifecycle methods start() and stop() for starting and stopping a &#8220;job&#8221; controlled by some other bundle.<br />
But a bundle can only be started once in a time. So if I have the use case that a job can be run any number of times this solution won&#8217;t work, because a bundle can only be started once until it is stopped, right?!</p>
<p>Which possibilities would I have for such an use-case?!?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Min Idzelis</title>
		<link>http://urbas.tk/index.php/2009/03/01/defining-a-background-job-to-run-periodically/comment-page-1/#comment-1413</link>
		<dc:creator>Min Idzelis</dc:creator>
		<pubDate>Sun, 01 Mar 2009 19:18:22 +0000</pubDate>
		<guid isPermaLink="false">http://urbas.tk/?p=81#comment-1413</guid>
		<description>Implementing IStartup no longer slows down IDE startup. In fact, the workbench is visible before the IStartups begin to run. In fact, the IStartups are actually run within a Job. (Jobs do not run until after the workbench has been restored. The JobManager is suspended until that time) 

If you scheduled your job within your Plugin.start() method, it will only run when your plugin is activated. This can be far too late in some cases (depending on what your background job does.) That is why the IStartup extension point exists. One caveat on IStartup. Your IStartup extension is *not* guaranteed to run, because the user could have disabled it in the preferences. So you should take care that proper functioning of your plugin is not dependent on that IStartup extension. 

Last note. You do not need a IJobChangedListener for periodic rescheduling. You can just call &quot;schedule()&quot; from within your job. This will cause your job to automatically reschedule itself after it runs. 

However, if a user &quot;cancels&quot; the sleeping job, you will not get a chance to run (or to reschedule) yourself. In that case, you would still need a IJobChangedListener.</description>
		<content:encoded><![CDATA[<p>Implementing IStartup no longer slows down IDE startup. In fact, the workbench is visible before the IStartups begin to run. In fact, the IStartups are actually run within a Job. (Jobs do not run until after the workbench has been restored. The JobManager is suspended until that time) </p>
<p>If you scheduled your job within your Plugin.start() method, it will only run when your plugin is activated. This can be far too late in some cases (depending on what your background job does.) That is why the IStartup extension point exists. One caveat on IStartup. Your IStartup extension is *not* guaranteed to run, because the user could have disabled it in the preferences. So you should take care that proper functioning of your plugin is not dependent on that IStartup extension. </p>
<p>Last note. You do not need a IJobChangedListener for periodic rescheduling. You can just call &#8220;schedule()&#8221; from within your job. This will cause your job to automatically reschedule itself after it runs. </p>
<p>However, if a user &#8220;cancels&#8221; the sleeping job, you will not get a chance to run (or to reschedule) yourself. In that case, you would still need a IJobChangedListener.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jens Goldhammer</title>
		<link>http://urbas.tk/index.php/2009/03/01/defining-a-background-job-to-run-periodically/comment-page-1/#comment-1412</link>
		<dc:creator>Jens Goldhammer</dc:creator>
		<pubDate>Sun, 01 Mar 2009 19:12:51 +0000</pubDate>
		<guid isPermaLink="false">http://urbas.tk/?p=81#comment-1412</guid>
		<description>To reschedule the job, it is possible to do that in the run-method.

@Override
    protected IStatus run(IProgressMonitor monitor) {
        try{
               // Work to do in the background
        }
finally{
           this.schedule(delay);
}

        return Status.OK_STATUS;
    }

So in my eyes, you don´t need the jobchangelistener...</description>
		<content:encoded><![CDATA[<p>To reschedule the job, it is possible to do that in the run-method.</p>
<p>@Override<br />
    protected IStatus run(IProgressMonitor monitor) {<br />
        try{<br />
               // Work to do in the background<br />
        }<br />
finally{<br />
           this.schedule(delay);<br />
}</p>
<p>        return Status.OK_STATUS;<br />
    }</p>
<p>So in my eyes, you don´t need the jobchangelistener&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Radoslaw Urbas</title>
		<link>http://urbas.tk/index.php/2009/03/01/defining-a-background-job-to-run-periodically/comment-page-1/#comment-1411</link>
		<dc:creator>Radoslaw Urbas</dc:creator>
		<pubDate>Sun, 01 Mar 2009 18:56:47 +0000</pubDate>
		<guid isPermaLink="false">http://urbas.tk/?p=81#comment-1411</guid>
		<description>@Robert - basically I was looking for Eclipse way of running some background task periodically. 
All concerns regarding startup time are extremely important, but if the requirement is to do something at startup (or pretty close to startup) I don&#039;t see the obvious effective solution for this. The suggestion regarding making the plug-in defining the job as tiny (including declared dependencies - direct ones and transitive) as possible to minimize the delay is good one. There is still one open question for me: what&#039;s the advantage or disadvantage of using org.eclipse.ui.startup extension comparing to defining non-lazy bundle?</description>
		<content:encoded><![CDATA[<p>@Robert &#8211; basically I was looking for Eclipse way of running some background task periodically.<br />
All concerns regarding startup time are extremely important, but if the requirement is to do something at startup (or pretty close to startup) I don&#8217;t see the obvious effective solution for this. The suggestion regarding making the plug-in defining the job as tiny (including declared dependencies &#8211; direct ones and transitive) as possible to minimize the delay is good one. There is still one open question for me: what&#8217;s the advantage or disadvantage of using org.eclipse.ui.startup extension comparing to defining non-lazy bundle?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Konigsberg</title>
		<link>http://urbas.tk/index.php/2009/03/01/defining-a-background-job-to-run-periodically/comment-page-1/#comment-1410</link>
		<dc:creator>Robert Konigsberg</dc:creator>
		<pubDate>Sun, 01 Mar 2009 18:30:14 +0000</pubDate>
		<guid isPermaLink="false">http://urbas.tk/?p=81#comment-1410</guid>
		<description>@Radoslaw, @Antoine&#039;s suggestion is a good one. One wrinkle to consider: if starting your plug-in incurs a long time cost either because it has to start other bundles (that take a long time to start) or because it loads a lot of information, consider splitting your job&#039;s plug-in from the rest of your plug-in.

My concern is that making your plug-in non-lazy per @Antoine&#039;s suggestion also suffers from being not scalable. If you plan to publish your plug-in for other people to use, while you may think your plug-in is important enough to start early, your user may disagree.</description>
		<content:encoded><![CDATA[<p>@Radoslaw, @Antoine&#8217;s suggestion is a good one. One wrinkle to consider: if starting your plug-in incurs a long time cost either because it has to start other bundles (that take a long time to start) or because it loads a lot of information, consider splitting your job&#8217;s plug-in from the rest of your plug-in.</p>
<p>My concern is that making your plug-in non-lazy per @Antoine&#8217;s suggestion also suffers from being not scalable. If you plan to publish your plug-in for other people to use, while you may think your plug-in is important enough to start early, your user may disagree.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Antoine Toulme</title>
		<link>http://urbas.tk/index.php/2009/03/01/defining-a-background-job-to-run-periodically/comment-page-1/#comment-1409</link>
		<dc:creator>Antoine Toulme</dc:creator>
		<pubDate>Sun, 01 Mar 2009 15:46:58 +0000</pubDate>
		<guid isPermaLink="false">http://urbas.tk/?p=81#comment-1409</guid>
		<description>I second what Robert said, and you should just make the bundle non-lazy, so it will start without being required by another bundle.</description>
		<content:encoded><![CDATA[<p>I second what Robert said, and you should just make the bundle non-lazy, so it will start without being required by another bundle.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Radoslaw Urbas</title>
		<link>http://urbas.tk/index.php/2009/03/01/defining-a-background-job-to-run-periodically/comment-page-1/#comment-1408</link>
		<dc:creator>Radoslaw Urbas</dc:creator>
		<pubDate>Sun, 01 Mar 2009 15:23:50 +0000</pubDate>
		<guid isPermaLink="false">http://urbas.tk/?p=81#comment-1408</guid>
		<description>Robert - that&#039;s very good suggestion, thanks! The job lifecycle should be mantained by start()/stop() methods of plug-in&#039;s Activator. But I still want this bundle to activate automatically (it is supposed to be independent, no one other bundle is supposed to reference it) - is there any better option than org.eclipse.ui.startup extension-point for this?</description>
		<content:encoded><![CDATA[<p>Robert &#8211; that&#8217;s very good suggestion, thanks! The job lifecycle should be mantained by start()/stop() methods of plug-in&#8217;s Activator. But I still want this bundle to activate automatically (it is supposed to be independent, no one other bundle is supposed to reference it) &#8211; is there any better option than org.eclipse.ui.startup extension-point for this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Konigsberg</title>
		<link>http://urbas.tk/index.php/2009/03/01/defining-a-background-job-to-run-periodically/comment-page-1/#comment-1407</link>
		<dc:creator>Robert Konigsberg</dc:creator>
		<pubDate>Sun, 01 Mar 2009 15:09:48 +0000</pubDate>
		<guid isPermaLink="false">http://urbas.tk/?p=81#comment-1407</guid>
		<description>I would strongly discourage using (and at work, be discouraged to use) early startup for this purpose for four reasons: one, because it delays the IDE startup, a solution that does not scale when implemented by a large number if plug-ins; two, because you can&#039;t stop the job when the IDE shuts down; and three, you can&#039;t reference your plug-in or any other plug-in until it too has started

Instead I would use the plug-in&#039;s lifecycle methods start() and stop() to control when the job starts and stops. Make the job a private member of the plug-in and everything plays well together.</description>
		<content:encoded><![CDATA[<p>I would strongly discourage using (and at work, be discouraged to use) early startup for this purpose for four reasons: one, because it delays the IDE startup, a solution that does not scale when implemented by a large number if plug-ins; two, because you can&#8217;t stop the job when the IDE shuts down; and three, you can&#8217;t reference your plug-in or any other plug-in until it too has started</p>
<p>Instead I would use the plug-in&#8217;s lifecycle methods start() and stop() to control when the job starts and stops. Make the job a private member of the plug-in and everything plays well together.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frederic</title>
		<link>http://urbas.tk/index.php/2009/03/01/defining-a-background-job-to-run-periodically/comment-page-1/#comment-1405</link>
		<dc:creator>Frederic</dc:creator>
		<pubDate>Sun, 01 Mar 2009 13:49:53 +0000</pubDate>
		<guid isPermaLink="false">http://urbas.tk/?p=81#comment-1405</guid>
		<description>Could be an option for simple task scheduling. For more complex job schedules, use http://www.opensymphony.com/quartz/</description>
		<content:encoded><![CDATA[<p>Could be an option for simple task scheduling. For more complex job schedules, use <a href="http://www.opensymphony.com/quartz/" rel="nofollow">http://www.opensymphony.com/quartz/</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

