On Mon, Jul 02, 2001 at 05:43:18PM -0400, Yong Jiao wrote:
> I found that problme too. I changed one line in JobEntry.java, and maybe
> everything is working.
>
> Change compareTo to equals() in the equals() method in JobEntry.java
And remove the then-superfluous > 0 ? I had to make a similar
modification to JobEntry.java at line 594. I merely changed the
equality operator to == instead of > the reason being that I wasn't sure
what it meant for two JobEntries to be "equal". Usually the application
means that only the IDs (primary keys) should be compared, not the
actual contents. But I thought in case equals() might come to do a
literal comparison, compareTo() was more likely to compare only IDs. But
that's beside the point and not on-topic for this list.
FYI I had to make other patches, too, to avoid NullPointerExceptions.
Basically, to do with using getPrimaryKey. getPrimaryKey is used in
JobEntry.java as though it always returns a valid object which can have
its methods called. However, in my setup getPrimaryKey will return null
if the JobEntry has not been saved into the database yet (my JobEntries
are saved to a database). So I changed occurrences of getPrimaryKey to
getPrimaryKeyAsLong (which will return NEW_ID if the JobEntry has not
yet been saved to the database). I suppose it would be more robust to
stick with getPrimaryKey, not getPrimaryKeyAsLong, since primary keys
may be represented differently in different setups. But nevertheless,
for my particular system this was the most expedient patch for minimal
modification of the source.
So I am interested in that at least three of us starting trying to use
JobEntries at the same time and encountered the problem. Have you also
had trouble with NullPointerExceptions (ie. the getPrimaryKey problem)?
I am using IDBroker for the JobEntries. I'm just curious that these
problems haven't been observed before. Anyway, I only got scheduled jobs
working in the last couple of days, though it seems to be stable.
Except, for some reason, when a ScheduledJob removes its own JobEntry
though the SchedulerService, the JobEntry gets deleted from the queue
but not from the database, so that it gets requeued when the webapp is
reloaded. Eek! In my application that causes the wrong things to happen
if the job has already been run before (but is correct if the job has
not been run or if it terminated abruptly). If I remove the JobEntry
from an Action using the same code then there is no problem!
Jason I hope you are able to obtain a working copy of JobEntry.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]