You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Peter Donald <do...@apache.org> on 2001/11/02 23:39:01 UTC

Re: Cornerstone DefaultTimeScheduler patch

On Fri, 2 Nov 2001 23:09, Ken Geis wrote:
> I'm pretty sure what I propose below is how it should be.  What I can't
> figure out is why this was outstanding.  Did it truly not happen to
> anyone?  I've tested the patch and it resolves the problem I was having.

I applied it but I am not sure why you are getting the exception. In theory 
the priority queue should never be empty at this point because you have just 
inserted a value into it. 

Can you give a small test case that would cause the exception to be thrown ?

> 83,86c83,90
> <         if( entry == m_priorityQueue.peek() )
> <         {
> <             synchronized( m_monitor ) { m_monitor.notify(); }
> <         }
> ---
>
>  > 	try
>  > 	{
>  > 	    if( entry == m_priorityQueue.peek() )
>  > 	    {
>  > 		synchronized( m_monitor ) { m_monitor.notify(); }
>  > 	    }
>  > 	}
>  > 	catch( final NoSuchElementException nse ) {}

-- 
Cheers,

Pete

---------------------------------------------
 We shall not cease from exploration, and the 
  end of all our exploring will be to arrive 
 where we started and know the place for the 
        first time -- T.S. Eliot
---------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Cornerstone DefaultTimeScheduler patch

Posted by Peter Donald <do...@apache.org>.
On Sat, 3 Nov 2001 10:22, Ken Geis wrote:
> Peter Donald wrote:
> > On Fri, 2 Nov 2001 23:09, Ken Geis wrote:
> >>I'm pretty sure what I propose below is how it should be.  What I can't
> >>figure out is why this was outstanding.  Did it truly not happen to
> >>anyone?  I've tested the patch and it resolves the problem I was having.
> >
> > I applied it but I am not sure why you are getting the exception. In
> > theory the priority queue should never be empty at this point because you
> > have just inserted a value into it.
> >
> > Can you give a small test case that would cause the exception to be
> > thrown ?
>
> The exception happened because I misread the CronTimeTrigger docs and
> created a trigger for the year 2.  If you add a trigger and it's
> scheduled to fire in the past, rescheduleEntry does not add it to
> m_priorityQueue.

ahh ... okay.

> I think my change is an appropriate change.  Of course, another option
> would be to have rescheduleEntry return boolean whether the entry was
> scheduled or not (then deal with the return value.)

Actually I added both. In theory the exception should never be thrown now but 
if it is it will issue a log warning.

-- 
Cheers,

Pete

------------------------------------------------------
"If people are good only because they fear punishment,
and hope for reward, then we are a sorry lot indeed." 
                                 -Albert Einstein
------------------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Cornerstone DefaultTimeScheduler patch

Posted by Ken Geis <ke...@telocity.com>.
Peter Donald wrote:

> On Fri, 2 Nov 2001 23:09, Ken Geis wrote:
> 
>>I'm pretty sure what I propose below is how it should be.  What I can't
>>figure out is why this was outstanding.  Did it truly not happen to
>>anyone?  I've tested the patch and it resolves the problem I was having.
>>
> 
> I applied it but I am not sure why you are getting the exception. In theory 
> the priority queue should never be empty at this point because you have just 
> inserted a value into it. 
> 
> Can you give a small test case that would cause the exception to be thrown ?


The exception happened because I misread the CronTimeTrigger docs and 
created a trigger for the year 2.  If you add a trigger and it's 
scheduled to fire in the past, rescheduleEntry does not add it to 
m_priorityQueue.

I think my change is an appropriate change.  Of course, another option 
would be to have rescheduleEntry return boolean whether the entry was 
scheduled or not (then deal with the return value.)

>>83,86c83,90
>><         if( entry == m_priorityQueue.peek() )
>><         {
>><             synchronized( m_monitor ) { m_monitor.notify(); }
>><         }
>>---
>>
>> > 	try
>> > 	{
>> > 	    if( entry == m_priorityQueue.peek() )
>> > 	    {
>> > 		synchronized( m_monitor ) { m_monitor.notify(); }
>> > 	    }
>> > 	}
>> > 	catch( final NoSuchElementException nse ) {}
>>
> 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>