Hi Gerhard,

I'm posting this separately under the same heading because it's probably 
less relevant.

While analysing the store-janitor code I found some strange things in 
the way Store-janitorImpl.freeMemory() increments the store index.

I assume that each successive call to freeMemory() is intended to free 
an item from the next store, starting again when the last store is 
reached. If there are 3 stores then the sequence for index should be: 
0,1,2,0,1,2,0,1,2,0,1,2,... Is this correct? (three different indexes)

When there are 3 stores my debug log reports the following sequence:

Index before:  -1,0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,....(four different 
indexes repeat)
Freeing at:    -1,0,1,2,*,0,1,2,*,0,1,2,*,0,1,2,....
(corrected):    0,0,1,2,0,0,1,2,0,0,1,2,0,0,1,2,....(store 0 is more 
frequent)
Index after:    0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3,....

'*' is where debug message says "Starting from the beginning" and from 
the code you can see that it actually does a freeing at 0.

                 if (this.getLogger().isDebugEnabled() == true) {
                     this.getLogger().debug("Starting from the beginning");
                 }
                 this.resetIndex();
                 ((Store)this.getStoreList().get(0)).free();
                 this.setIndex(0);

(corrected) is what actually gets freed, taking into account the above 
and the following false debug message on the first attempt.

                 if(this.getIndex() == -1) {
                     if (this.getLogger().isDebugEnabled() == true) {
                         this.getLogger().debug("Freeing at index=" + 
this.getIndex());
                     }
                     ((Store)this.getStoreList().get(0)).free();
                     this.setIndex(0);
                 } else {

It says it is "Freeing at index=-1" but then actually frees at index 0.

Conclusion 1: Debug printout is a bit misleading.
Conclusion 2: Items are removed from store 0 twice as often as from 
stores 1 and 2.

Have I got this right? Is it intentional or a mistake?

Regards,
Peter.

P.S. The debug printout is on my initial posting under this heading.


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

Reply via email to