----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files. Don't make us guess your problem!!!
----------------------------------------------------------------
[Apologies for the lack of subject, btw - I c'n'p'ed the main body of the
text and completely forgot to put a subject on. I've left it blank here
to avoid confusing any thread tracking systems which don't use message
ids.]
> I cannot comment on most of your bug report as I've not experienced this
> problem, however I don't think the IndexOutOfBoundsExceptions are being
> caused by an unsynchronized flush method. Although flush() is not
> synchronized, logQueue is a SimpleQueue object who's "get()" method is
> synchronized. Since logQueue.get() returns null on an empty queue, and
> logrecord is checked for a null value bufore writing, there will be no
> attempt write a null logrecord, correct?
>
> I may be wrong - I havn't really delved into the JServ source, but it looks
> like the exception is being caused by something else.
I've just looked at SimpleQueue.java for JServ 1.0, and I can see what
the problem is: get isn't synchronized. Thecode is:
public Object get() {
Object found = peekAtHead();
if (found != null) {
theQueue.removeElementAt(0);
} else {
return found;
}
return found;
}
So if the vector only has one element and two threads both execute the first
line, get an object, then try to remove the first element,
Vector.removeElementAt will throw the exception.
I've confirmed that this is fixed in 1.1.
Jon
--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Archives and Other: <http://java.apache.org/main/mail.html>
Problems?: [EMAIL PROTECTED]