Jan Zyka
Jan Zyka

Reputation: 17898

Spring task fixed-delay within specific timeframe

I want to have spring configured task which will be running with fixed-delay but only within specific timeframe, lets say 6am - 6pm.

I understand I can have fixed delay like:

<task:scheduled ref="myBean" method="myMethod" fixed-delay="60000" />

or run every lets say hour within a timeframe with:

<task:scheduled ref="myBean" method="myMethod" cron="0 * 6-18 * * MON-FRI" />

How can I combine these? Sure I can do the check for the timeframe from within my bean but I was looking for some pure Spring way of doing it.

Thanks

Upvotes: 1

Views: 562

Answers (1)

G-Man
G-Man

Reputation: 1331

You will have to make your own custom Trigger. Check out this page for more information on how to create your own trigger

Upvotes: 1

Related Questions