queue predicate should have acceptMany(qe[]) ?

Quartz <[email protected]> Wed, 17 Sep 2003 09:41:43 -0700 (PDT)
Newsgroups gmane.comp.java.seda.user
Message-ID <[email protected]>
Am I not seeing something important here?
If the predicate .appect is called 30 times, it does NOT AT ALL proove that the sink it controls
can accept 30 items! It only meant 30 times that you could accept one.
For example, the QueueThresholdPredicate does not (and should not) emulate a filling sink, so how
can it know that the 30th time you call accept, you meant check if there is room for 30?

Sounds like a bug to me...



public void enqueue_many(QueueElementIF[] enqueueMe) throws SinkFullException {
	synchronized (blocker) {
		int qlen = enqueueMe.length;
		synchronized (qlist) {
			if (pred != null) {
				int i = 0;
				while ((i < qlen) && (pred.accept(enqueueMe[i])))
					i++;
				if (i != qlen)
					throw new SinkFullException("FiniteQueue is full!");
			}
			queueSize += qlen;
			for (int i = 0; i < qlen; i++) {
				qlist.add_to_tail(enqueueMe[i]);
			}
		}
		blocker.notifyAll(); // wake up all sleepers
	}
}


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf