[ 
https://issues.apache.org/jira/browse/DIRMINA-1057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16195758#comment-16195758
 ] 

David Gibbs edited comment on DIRMINA-1057 at 10/7/17 3:46 PM:
---------------------------------------------------------------

In {{AbstractIoSession}} - the method {{decreaseScheduledBytesAndMessages}} 
decrements the message count when the buffer is empty. This is  called from 
{{clearWriteRequestQueue(S session)}} in {{AbstractPollinIoProcessor}}. I think 
that in cases where the message is {{IoBuffer}} the message count is only 
decremented. I don't know how to write a unit test for this but if I write 
messages with a delay {{session.write(news).await(10);}} or wait 
uninterruptedly I can see the result of {{getScheduledWriteMessages()}} 
decrementing constantly while {{getScheduledWriteBytes()}} remains 0.

If I don't wait the {{sceduledMsgBytes}} increases due to the buffer and 
{{getScheduledWriteMessages}} remains 0, presumably as a result of the code 
below. line 1012 in {{AbstractIoSession}} .

I was thinking that the "WriteMessages" does not make sense when the message is 
an IoBuffer but I doubt that I understand the intent of this code.

bq. Oct 07, 2017 4:33:06 PM org.apache.mina.filter.logging.LoggingFilter log
bq. INFO: SENT: 8=FIX.4.49=2535=B148=Headline : 778410=048
bq. scheduled write messages -7785
bq. scheduled write bytes 0

{code:java}
/**
     * Decrease the counters of written messages and written bytes when a 
message has been written
     * 
     * @param request The written message
     */
    public final void decreaseScheduledBytesAndMessages(WriteRequest request) {
        Object message = request.getMessage();
        
        if (message instanceof IoBuffer) {
            IoBuffer b = (IoBuffer) message;
            
            if (b.hasRemaining()) {
                increaseScheduledWriteBytes(-((IoBuffer) message).remaining());
            } else {
                decreaseScheduledWriteMessages();
            }
        } else {
            decreaseScheduledWriteMessages();
        }
    }
{code}


was (Author: david-gibbs-ig):
In {{AbstractIoSession}} - the method {{decreaseScheduledBytesAndMessages}} 
decrements the message count when the buffer is empty. This is  called from 
{{clearWriteRequestQueue(S session)}} in {{AbstractPollinIoProcessor}}. I think 
that in cases where the message is {{IoBuffer}} the message count is only 
decremented. I don't know how to write a unit test for this but if I write 
messages with a delay {{session.write(news).await(10);}} or wait 
uninterruptedly I can see the result of {{getScheduledWriteMessages()}} 
decrementing constantly while {{getScheduledWriteBytes()}} remains 0.

If I don't wait the {{sceduledMsgBytes}} increases due to the buffer and 
{{getScheduledWriteMessages}} remains 0, presumably as a result of the code 
below. line 1012 in {{AbstractIoSession}} .

I was thinking that the "WriteMessages" does not make sense when the message is 
an IoBuffer but I doubt that I understand the intent of this code.

Oct 07, 2017 4:33:06 PM org.apache.mina.filter.logging.LoggingFilter log
INFO: SENT: 8=FIX.4.49=2535=B148=Headline : 778410=048
scheduled write messages -7785
scheduled write bytes 0
{code:java}
/**
     * Decrease the counters of written messages and written bytes when a 
message has been written
     * 
     * @param request The written message
     */
    public final void decreaseScheduledBytesAndMessages(WriteRequest request) {
        Object message = request.getMessage();
        
        if (message instanceof IoBuffer) {
            IoBuffer b = (IoBuffer) message;
            
            if (b.hasRemaining()) {
                increaseScheduledWriteBytes(-((IoBuffer) message).remaining());
            } else {
                decreaseScheduledWriteMessages();
            }
        } else {
            decreaseScheduledWriteMessages();
        }
    }
{code}

> AbstractIoSession getScheduledWriteMessages always -negative?
> -------------------------------------------------------------
>
>                 Key: DIRMINA-1057
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-1057
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.16
>         Environment: I'm testing slow consumer backlog detection and while 
> getScheduledWriteBytes() correctly grows, getScheduledWriteMessages is always 
> negative and does not increase. looking into code to see why but putting bug 
> report here as well for tracking
>            Reporter: Andre Mermegas
>




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to