You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Victor_Trapiello <vi...@trapiello.net> on 2010/05/28 00:46:50 UTC

Very interesting question... my boss complain about one of my implementations...

Hello guys!

I had a terrible day because one of my bosses complain about how I have done
one task of a project, we had to implement "something" that updates a field
in the database, my brilliant idea was to create a thread inside the wicket
init method that makes a query to the database every 3 hours and updates the
fields.

My boss said that it is not a good practice and he recomended  to use
something like in Struts called "Timers", do we have something like that in
wickets¿?

how can I implement this behaviour without  a thread¿? I mean something that
is executing since my application is deployed and executing a method every N
time!!

thank you very much guys, I go to sleep in Spain it is 1.00 AM and tomorrow
I have to go to work!!

Waiting some feedback

Cheers!!
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Very-interesting-question-my-boss-complain-about-one-of-my-implementations-tp2233874p2233874.html
Sent from the Wicket - User mailing list archive at Nabble.com.

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


Re: SV: Very interesting question... my boss complain about one of my implementations...

Posted by "M. Hammer" <na...@hammer-tour.com>.
I can also recommend Quartz, especially with the Spring integration.  
(http://static.springsource.org/spring/docs/1.2.9/reference/scheduling.html)  
Very stable, and quite easy to set up.

> Try looking into Quartz, a library for such things. The lack of a  
> standard scheduling framework outside of JMX is a problem in JEE in  
> general...



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


SV: Very interesting question... my boss complain about one of my implementations...

Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> My boss said that it is not a good practice and he recomended  to use
> something like in Struts called "Timers", do we have something like
> that in
> wickets¿?

Try looking into Quartz, a library for such things. The lack of a standard scheduling framework outside of JMX is a problem in JEE in general...

However, the Struts "Timer" seems to measure rendering time, so I am not sure why your boss thought that would help.

http://struts.apache.org/2.0.11.1/struts2-core/apidocs/org/apache/struts2/util/Timer.html

- Tor Iver

Re: Very interesting question... my boss complain about one of my implementations...

Posted by Jeremy Thomerson <je...@wickettraining.com>.
On Sat, May 29, 2010 at 11:27 AM, Victor_Trapiello <vi...@trapiello.net>wrote:

>
> Hi guys, thank you very much for your comments,
>
> let me explain a little bit deeper my solution, I have a method that create
> and execute a thread when I iniciate the aplication, inside if the init
> wicket metod, inside of the thread I call another method that updates a
> state in the database, I mean if the system time is 48 hours more than the
> time saved in that row of the database it updates a field to TRUE, simple
>
> this thread is executed every 30 minutes,
>
> pseudocode:
> Thread runing for ever{
>   -Execute method to update the state
>   -Sleep thread for 30 minutes
> }
>
> Now he told me that I can do something like that with Spring... I´m
> absolutly lost, I do not know if he knows what he is saying or just making
> me crazy....
>

Your boss is right on this one.  You typically shouldn't be doing this kind
of thing on your own.  You should use TimerTasks, or Quartz, et cetera, as
several have mentioned.

-- 
Jeremy Thomerson
http://www.wickettraining.com

Re: Very interesting question... my boss complain about one of my implementations...

Posted by Cristi Manole <cr...@gmail.com>.
read it here

http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/scheduling.html

(with spring, and you can integrate it with quartz also).

On Sat, May 29, 2010 at 12:36 PM, Victor_Trapiello <vi...@trapiello.net>wrote:

>
> Sorry guys I have missed some of your commets I was having a look to
> "Scheduling jobs using Quartz or Timer" and it seems to be a good solution
> and easy to implement/integrate with spring, at lists I will have some
> arguments to discuss with him on monday!!
>
> Cheerss!
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Very-interesting-question-my-boss-complain-about-one-of-my-implementations-tp2233874p2235766.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Cristi Manole

Nova Creator Software
www.novacreator.com

Re: Very interesting question... my boss complain about one of my implementations...

Posted by Victor_Trapiello <vi...@trapiello.net>.
Sorry guys I have missed some of your commets I was having a look to
"Scheduling jobs using Quartz or Timer" and it seems to be a good solution
and easy to implement/integrate with spring, at lists I will have some
arguments to discuss with him on monday!!

Cheerss!
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Very-interesting-question-my-boss-complain-about-one-of-my-implementations-tp2233874p2235766.html
Sent from the Wicket - User mailing list archive at Nabble.com.

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


Re: Very interesting question... my boss complain about one of my implementations...

Posted by Victor_Trapiello <vi...@trapiello.net>.
Hi guys, thank you very much for your comments, 

let me explain a little bit deeper my solution, I have a method that create
and execute a thread when I iniciate the aplication, inside if the init
wicket metod, inside of the thread I call another method that updates a
state in the database, I mean if the system time is 48 hours more than the
time saved in that row of the database it updates a field to TRUE, simple

this thread is executed every 30 minutes, 

pseudocode:
Thread runing for ever{
   -Execute method to update the state
   -Sleep thread for 30 minutes
}

Now he told me that I can do something like that with Spring... I´m
absolutly lost, I do not know if he knows what he is saying or just making
me crazy....

thanks guyss!!
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Very-interesting-question-my-boss-complain-about-one-of-my-implementations-tp2233874p2235762.html
Sent from the Wicket - User mailing list archive at Nabble.com.

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


Re: Very interesting question... my boss complain about one of my implementations...

Posted by nino martinez wael <ni...@gmail.com>.
Hmm Eelco, im puzling with a guice quartz integration as well. it's
here and not at all complete (along with an ehcache integration) :
http://code.google.com/p/slurry/

2010/5/28 Eelco Hillenius <ee...@gmail.com>:
>>>> I had a terrible day because one of my bosses complain about how I have
>>>> done
>>>> one task of a project, we had to implement "something" that updates a field
>>>> in the database, my brilliant idea was to create a thread inside the wicket
>>>> init method that makes a query to the database every 3 hours and updates
>>>> the
>>>> fields.
>
> I don't think it is horrible, though it sounds a bit like a quick fix.
> It doesn't have to do with your web application of course, though
> Wicket's application object is a natural place to do bootstrapping.
>
>>> Struts timers (at least the ones I know of) are for timing how long a
>>> webpage takes to render.  Perhaps he's confused with TimerTasks, which are
>>> in Java, not Struts.
>
> I think that in general using TimerTask is better than just spawning
> of a thread.
>
>> If you are using some logic to update the database "every N time",
>> then I suggest using Quartz:
>>  https://quartz.dev.java.net/
>>  http://www.quartz-scheduler.org/overview/index.html
>
> And using Quartz is even better.
>
>> The only tricky part of Quartz has been deploying it properly on an
>> application cluster -- to avoid having the same scheduled tasks run
>> simultaneously.  If you have a "backend" app server you can purpose
>> running scheduled tasks on, then it is simple.
>
> Quartz does the job, and for my work I created a nice Guice
> abstraction for it, but I've never been crazy about the API and
> implementation (though it's stable and reasonably efficient). I wonder
> if anyone has any real life experience with
> http://sna-projects.com/azkaban they want to share?
>
> Eelco
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


RE: Very interesting question... my boss complain about one of my implementations...

Posted by Stefan Lindner <li...@visionet.de>.
And the simplest solution, if it is a simple database action, would be
to use a cron job if your database runsund some **ux operating system.

Stefan

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


Re: Very interesting question... my boss complain about one of my implementations...

Posted by Eelco Hillenius <ee...@gmail.com>.
>>> I had a terrible day because one of my bosses complain about how I have
>>> done
>>> one task of a project, we had to implement "something" that updates a field
>>> in the database, my brilliant idea was to create a thread inside the wicket
>>> init method that makes a query to the database every 3 hours and updates
>>> the
>>> fields.

I don't think it is horrible, though it sounds a bit like a quick fix.
It doesn't have to do with your web application of course, though
Wicket's application object is a natural place to do bootstrapping.

>> Struts timers (at least the ones I know of) are for timing how long a
>> webpage takes to render.  Perhaps he's confused with TimerTasks, which are
>> in Java, not Struts.

I think that in general using TimerTask is better than just spawning
of a thread.

> If you are using some logic to update the database "every N time",
> then I suggest using Quartz:
>  https://quartz.dev.java.net/
>  http://www.quartz-scheduler.org/overview/index.html

And using Quartz is even better.

> The only tricky part of Quartz has been deploying it properly on an
> application cluster -- to avoid having the same scheduled tasks run
> simultaneously.  If you have a "backend" app server you can purpose
> running scheduled tasks on, then it is simple.

Quartz does the job, and for my work I created a nice Guice
abstraction for it, but I've never been crazy about the API and
implementation (though it's stable and reasonably efficient). I wonder
if anyone has any real life experience with
http://sna-projects.com/azkaban they want to share?

Eelco

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


Re: Very interesting question... my boss complain about one of my implementations...

Posted by gnul <nu...@gmail.com>.
On Thu, May 27, 2010 at 5:16 PM, Jeremy Thomerson
<je...@wickettraining.com> wrote:
> On Thu, May 27, 2010 at 5:46 PM, Victor_Trapiello <vi...@trapiello.net>wrote:
>
>>
>> Hello guys!
>>
>> I had a terrible day because one of my bosses complain about how I have
>> done
>> one task of a project, we had to implement "something" that updates a field
>> in the database, my brilliant idea was to create a thread inside the wicket
>> init method that makes a query to the database every 3 hours and updates
>> the
>> fields.
>>
>> My boss said that it is not a good practice and he recomended  to use
>> something like in Struts called "Timers", do we have something like that in
>> wickets¿?
>>
>> how can I implement this behaviour without  a thread¿? I mean something
>> that
>> is executing since my application is deployed and executing a method every
>> N
>> time!!
>>
>> thank you very much guys, I go to sleep in Spain it is 1.00 AM and tomorrow
>> I have to go to work!!
>>
>> Waiting some feedback
>>
>> Cheers!!
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/Very-interesting-question-my-boss-complain-about-one-of-my-implementations-tp2233874p2233874.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> Does the "update" to the database have anything to do with the webapp?  Or
> is it something totally unrelated?  You don't really give us enough
> information to go on.
>
> Struts timers (at least the ones I know of) are for timing how long a
> webpage takes to render.  Perhaps he's confused with TimerTasks, which are
> in Java, not Struts.
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>

I also do not understand how the "timer" is related to the web application.

If you are using some logic to update the database "every N time",
then I suggest using Quartz:
  https://quartz.dev.java.net/
  http://www.quartz-scheduler.org/overview/index.html

We implement a quartz task that runs every 15 minutes to pull data
over a third party API and update our database.  Wicket, like any web
application, displays the updated information on the next
[LoadableDetachableModel] data refresh which satisfies our
requirements. (If you use an ApplicationContext (e.g. Spring) you
could even update a local cache / cache cluster (e.g ehcache).)

The only tricky part of Quartz has been deploying it properly on an
application cluster -- to avoid having the same scheduled tasks run
simultaneously.  If you have a "backend" app server you can purpose
running scheduled tasks on, then it is simple.

 -gnul

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


Re: Very interesting question... my boss complain about one of my implementations...

Posted by Jeremy Thomerson <je...@wickettraining.com>.
On Thu, May 27, 2010 at 5:46 PM, Victor_Trapiello <vi...@trapiello.net>wrote:

>
> Hello guys!
>
> I had a terrible day because one of my bosses complain about how I have
> done
> one task of a project, we had to implement "something" that updates a field
> in the database, my brilliant idea was to create a thread inside the wicket
> init method that makes a query to the database every 3 hours and updates
> the
> fields.
>
> My boss said that it is not a good practice and he recomended  to use
> something like in Struts called "Timers", do we have something like that in
> wickets¿?
>
> how can I implement this behaviour without  a thread¿? I mean something
> that
> is executing since my application is deployed and executing a method every
> N
> time!!
>
> thank you very much guys, I go to sleep in Spain it is 1.00 AM and tomorrow
> I have to go to work!!
>
> Waiting some feedback
>
> Cheers!!
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Very-interesting-question-my-boss-complain-about-one-of-my-implementations-tp2233874p2233874.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Does the "update" to the database have anything to do with the webapp?  Or
is it something totally unrelated?  You don't really give us enough
information to go on.

Struts timers (at least the ones I know of) are for timing how long a
webpage takes to render.  Perhaps he's confused with TimerTasks, which are
in Java, not Struts.

-- 
Jeremy Thomerson
http://www.wickettraining.com