}
@Override
protected void callTimeout() throws Exception
{
CalendarTimer calendarTimer = this.getTimer();
// if we have any more schedules remaining, then schedule a new task
if (calendarTimer.getNextExpiration() != null && calendarTimer.isInRetry() == false)
{
calendarTimer.scheduleTimeout();
}
// finally invoke the timeout method through the invoker
if (calendarTimer.isAutoTimer())
{
TimedObjectInvoker invoker = this.timerService.getInvoker();
if (invoker instanceof MultiTimeoutMethodTimedObjectInvoker == false)
{
String msg = "Cannot invoke timeout method because timer: " + calendarTimer
+ " is an auto timer, but invoker is not of type" + MultiTimeoutMethodTimedObjectInvoker.class;
logger.error(msg);
throw new RuntimeException(msg);
}
// call the timeout method
((MultiTimeoutMethodTimedObjectInvoker) invoker).callTimeout(calendarTimer, calendarTimer.getTimeoutMethod());
}
else
{
this.timerService.getInvoker().callTimeout(calendarTimer);
}