Try to use this:
What it will do is, basically, take into consideration only the time you told JBoss the scheduler to start (SchedulePeriod). If you put this attribute to false, FixedDelay will be taken into account and then, not only the time you've sated the scheduler to start will be used but also it will have added the time that the scheduler took to process (SchedulePeriod=SchedulePeriod + AmountOfTimeOfLastProcessing).
For more detail you can check this: http://community.jboss.org/message/168351
Grateful for your attention.
Sorry for long time to wait for my answer, but i'l need time to test, because at the beginning the result was not clear.
First of all, I discovered that failure occurs at high load of our JBoss server. When the load decreases, the service starts right on schedule.
The first day after the addition of
FixedRateparameter, I thought that the problem is solved. But the next day failures reappeared on high server load. Initially, shift reached few minutes, but one day service starts late by 3 hours.
Finally, after week of testing, I came to the conclusion:
- Problem arises when a high load on the server
- The adding
FixedRateparam not solve the problem
Also add that the main burden falls on the server when processing hundreds of thousands of requests per day, passed through Web services. These requests are handled promptly at any time, which suggests that the overall workload of the server is not overloaded.
Also add that the time of service running (complete perform method) is maximum few (less than 2) minutes at any load.
These are my suggestions:
- If you can, try to get another server and a load balancer because, as you said, that's a overload of the server and not a JBoss error;
- Other suggestion is, instead of you processing your hundreds of thousands of request all in once, try to create several instances of your scheduler, that are triggered every "X" time, and that process your requests separately.
- Last but not least, you can also use JBoss ESB schedulers (http://docs.redhat.com/docs/en-US/JBoss_Enterprise_SOA_Platform/4.3/html/Programmers_Guide/sect-SOA_ESB_Programmers_Guide-Advanced_Topics-Scheduling_of_Services.html)
Hope that I gave you some enlightenment over your doubts. Any question just ask.
Grateful for your attention.
First of all, the sheduled task is small and absolutely independed from main payload processes. The only shared resource, that i see on the my application level, is database source. But I doubt that the <depends>jboss.har:service=HibernateNAT</depends> is checked before call perform method, though perhaps I'm wrong.
Anyway, i decide to change shedule engine for this task, and applied standart Java sheduler - Executors.newSingleThreadScheduledExecutor().scheduleAtFixedRate( this, timeout, timeout, TimeUnit.MILLISECONDS);
I load Java sheduler from JBoss ServiceMBean. In my opinion, this is not the right approach, but now task sheduled right in time at any server load.
I still do not know why the org.jboss.varia.scheduler.Scheduler is not properly working for me...