You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Rural Hunter <ru...@gmail.com> on 2013/06/19 08:42:48 UTC

Best way to implement continuously background jobs

Hi,

Is there a "best practice" to implement continuously/long-run background 
jobs in Tapestry? I know there is PeriodicExecutor but my requirement is 
to have the job run continuously in the background. It should start when 
the application starts and end when the application ends.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Best way to implement continuously background jobs

Posted by Ilya Obshadko <il...@gmail.com>.
This is it, thanks!


On Tue, Nov 12, 2013 at 11:25 AM, Dmitry Gusev <dm...@gmail.com>wrote:

>
> http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/ReloadAware.html
>
>
> On Tue, Nov 12, 2013 at 4:16 AM, Ilya Obshadko <ilya.obshadko@gmail.com
> >wrote:
>
> > I have implemented ParallelExecutor for background mail sending.
> >
> > However, there is a problem with live class reloading, because I have to
> > stop the old instance of ParallelExecutor and start the new one. How do I
> > hook to class reload event? finalize() doesn't seem to work.
> >
> >
> > On Wed, Jun 19, 2013 at 6:26 PM, Lance Java <lance.java@googlemail.com
> > >wrote:
> >
> > > There is the ParallelExecutor which is backed by a thread pool. Be
> > warned,
> > > the pool size is 3 by default (configurable via a symbol). The
> > > ParallelExecutor will invoke PerThreadManager.cleanup() once your
> > Runnable
> > > completes to clean up the hibernate session and any PerThreadValue
> > > instances.
> > >
> >
> >
> >
> > --
> > Ilya Obshadko
> >
>
>
>
> --
> Dmitry Gusev
>
> AnjLab Team
> http://anjlab.com
>



-- 
Ilya Obshadko

Re: Best way to implement continuously background jobs

Posted by Dmitry Gusev <dm...@gmail.com>.
http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/ReloadAware.html


On Tue, Nov 12, 2013 at 4:16 AM, Ilya Obshadko <il...@gmail.com>wrote:

> I have implemented ParallelExecutor for background mail sending.
>
> However, there is a problem with live class reloading, because I have to
> stop the old instance of ParallelExecutor and start the new one. How do I
> hook to class reload event? finalize() doesn't seem to work.
>
>
> On Wed, Jun 19, 2013 at 6:26 PM, Lance Java <lance.java@googlemail.com
> >wrote:
>
> > There is the ParallelExecutor which is backed by a thread pool. Be
> warned,
> > the pool size is 3 by default (configurable via a symbol). The
> > ParallelExecutor will invoke PerThreadManager.cleanup() once your
> Runnable
> > completes to clean up the hibernate session and any PerThreadValue
> > instances.
> >
>
>
>
> --
> Ilya Obshadko
>



-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com

Re: Best way to implement continuously background jobs

Posted by Ilya Obshadko <il...@gmail.com>.
I have implemented ParallelExecutor for background mail sending.

However, there is a problem with live class reloading, because I have to
stop the old instance of ParallelExecutor and start the new one. How do I
hook to class reload event? finalize() doesn't seem to work.


On Wed, Jun 19, 2013 at 6:26 PM, Lance Java <la...@googlemail.com>wrote:

> There is the ParallelExecutor which is backed by a thread pool. Be warned,
> the pool size is 3 by default (configurable via a symbol). The
> ParallelExecutor will invoke PerThreadManager.cleanup() once your Runnable
> completes to clean up the hibernate session and any PerThreadValue
> instances.
>



-- 
Ilya Obshadko

Re: Best way to implement continuously background jobs

Posted by Lance Java <la...@googlemail.com>.
There is the ParallelExecutor which is backed by a thread pool. Be warned,
the pool size is 3 by default (configurable via a symbol). The
ParallelExecutor will invoke PerThreadManager.cleanup() once your Runnable
completes to clean up the hibernate session and any PerThreadValue
instances.

Re: Best way to implement continuously background jobs

Posted by Kalle Korhonen <ka...@gmail.com>.
On Wed, Jun 19, 2013 at 12:04 AM, Rural Hunter <ru...@gmail.com>wrote:

> yes, that's what I thought of. But I would like to see if there is any
> other option in Tapestry.
>

There's a tool for each use case. I can not imagine a much better tool for
this case than a simple thread if the thread's lifetime is the same as the
JVM's lifetime. What other options, features are you looking for?

Kalle


>
> 于 2013/6/19 14:53, Kalle Korhonen 写道:
>
>> Create a thread?
>>
>> Kalle
>>
>>
>> On Tue, Jun 18, 2013 at 11:42 PM, Rural Hunter <ruralhunter@gmail.com
>> >wrote:
>>
>>  Hi,
>>>
>>> Is there a "best practice" to implement continuously/long-run background
>>> jobs in Tapestry? I know there is PeriodicExecutor but my requirement is
>>> to
>>> have the job run continuously in the background. It should start when the
>>> application starts and end when the application ends.
>>>
>>> ------------------------------****----------------------------**
>>> --**---------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.**a**pache.org<http://apache.org>
>>> <us...@tapestry.apache.org>
>>> >
>>>
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<us...@tapestry.apache.org>
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Best way to implement continuously background jobs

Posted by Rural Hunter <ru...@gmail.com>.
yes, that's what I thought of. But I would like to see if there is any 
other option in Tapestry.

于 2013/6/19 14:53, Kalle Korhonen 写道:
> Create a thread?
>
> Kalle
>
>
> On Tue, Jun 18, 2013 at 11:42 PM, Rural Hunter <ru...@gmail.com>wrote:
>
>> Hi,
>>
>> Is there a "best practice" to implement continuously/long-run background
>> jobs in Tapestry? I know there is PeriodicExecutor but my requirement is to
>> have the job run continuously in the background. It should start when the
>> application starts and end when the application ends.
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<us...@tapestry.apache.org>
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Best way to implement continuously background jobs

Posted by Kalle Korhonen <ka...@gmail.com>.
Create a thread?

Kalle


On Tue, Jun 18, 2013 at 11:42 PM, Rural Hunter <ru...@gmail.com>wrote:

> Hi,
>
> Is there a "best practice" to implement continuously/long-run background
> jobs in Tapestry? I know there is PeriodicExecutor but my requirement is to
> have the job run continuously in the background. It should start when the
> application starts and end when the application ends.
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<us...@tapestry.apache.org>
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>