Hi Ralf,

sorry for late reply, I had problems with my account and don't get your
post.

Hi,
we discovered in a performance Testcenter that the Method org.apache.ojb.broker.accesslayer.RsIterator#addListener() was called very very often.

Which lead to a bad performance behaviour.
After uncommenting this part we could improve that.
Is this a bug?
Or is there a Need for this Method in another context? We are using PB-API and could uncomment this Method without any negative results. We discovered this behaviour in ojb1.0.0 and it seems is still in 1.0.3 present. My question: is this a bug?

Yep!

Will it be fixed in the next release?

There is a similar thread on the dev-list
http://www.mail-archive.com/ojb-dev%40db.apache.org/msg01558.html

I checked in a fix (try latest version from CVS, use OJB_1_0_RELEASE branch) which remove the wrapped RsIterator instance as PB state listener when the resources will be closed by the RsIterator. In this case the listener is no longer needed, because the listener wait to close open resources on PB close (or when a PB-tx ended).

I run a test which invokes the same query in a loop (100 iterations):

for(int i = 0; i<100; i++)
{
    Criteria crit = new Criteria();
    crit.addLike("name", name + "%");
    Query q = QueryFactory.newQuery(A.class, crit);
    Collection result = broker.getCollectionByQuery(q);
}

The test print the number of the state listener after each iteration. Before the fix I got:

temp-listener: 1
temp-listener: 2
temp-listener: 3
...
temp-listener: 304
temp-listener: 305
temp-listener: 306

after the fix

temp-listener: 1
temp-listener: 2
temp-listener: 3
...
temp-listener: 1
temp-listener: 2
temp-listener: 3

Hope this will fix your problem.
But keep in mind, if you query for Iterator and never do a full iteration on the result and you don't close the used PB instance, the problem will still happen, because the resources are still open and OJB will close the resources on PB close or tx end (using the state listener).

for(int i = 0; i<100; i++)
{
    Criteria crit = new Criteria();
    crit.addLike("name", name + "%");
    Query q = QueryFactory.newQuery(A.class, crit);
    Iterator it = broker.getIteratorByQuery(q);
// returns 8 result objects
// start iteration, but never do a "full iteration"
    it.next();
}

this code still result in many listener, because neither the PB instance will be closed nor a PB-tx is used:
...
temp-listener: 193
temp-listener: 194
temp-listener: 195


regards,
Armin


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to