Hey everyone,
 
It seems that BaseIoSession#getScheduledWriteRequests() is returning an
incorrect value. The value is always negative and the write queue is empty
(in my example). IIRC, the idea of using a counter instead of asking the
size of the collection was a recent optimization. I checked the code I
found something like this that could be the reason for this problem:
 
In SocketFilterChain#doWrite(IoSession session, WriteRequest
writeRequest):
 
        int remaining = buffer.remaining();
        if (remaining == 0) {
            s.increaseScheduledWriteRequests();            
        } else {
            s.increaseScheduledWriteBytes(buffer.remaining());
        }
 
        writeRequestQueue.add(writeRequest);

As you see the counter is not always incremented and at the same time the
queue is getting a new element added. I don't know if the problem is only
here or also when taking things out of the queue. May be encapsulating in
a single method the "add to queue" and "increment counter" could be a way
to avoid this problem.
 
BTW, I'm using MINA 1.1.3.
 
Thanks,
 
   -- Gato

Reply via email to