What about using Quartz for such a task?http://www.opensymphony.com/quartz/

On Thu, Jan 22, 2009 at 4:43 PM, Tomas Kolda <ko...@web2net.cz> wrote:

> Hi,
>
> I need to do something in background (import data once a day). I'm using
> Tapestry-Hibernate package. User should be able to run import from web page
> also. What is the right way to get Hibernate session in background thread? I
> found nice howto on wiki.
>
> http://wiki.apache.org/tapestry/Tapestry5HowToRunTaskInThread
>
> There is simple service wrapper ThreadSource. I can write:
>
> _threadSource.runInThread(new Runnable(){
>   public void run(){
>       //do something
>   }
> });
>
> But I need something like:
>
> _threadSource.runInThread(new Runnable(){
>   @Inject
>   Session session;
>   public void run(){
>       //do something
>   }
> });
>
> As I know, AOP search for constructors using reflection that will get what
> it needs. So no way to get it working in this way.
>
> What should I do? I can modify ThreadSource and put there Session that will
> be provided to thread. Is it right approach? Or is there something that will
> provide me service object to satisfy my needs? Something like
> registry.getService(Session.class); ?
>
> Second question:
> Is there something like "cron" in Tapestry? I know that it looks ugly, to
> run something in servlet container, but is it possible?
>
> Thank you
> Tomas
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to