[jboss-jira] [JBoss JIRA] (LOGMGR-54) org.jboss.logmanager.handlers.AsyncHandler.AsyncTask should call flush when queue runs empty

Rico Neubauer (JIRA) jira-events at lists.jboss.org
Tue Nov 20 10:39:26 EST 2012


    [ https://issues.jboss.org/browse/LOGMGR-54?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12735813#comment-12735813 ] 

Rico Neubauer edited comment on LOGMGR-54 at 11/20/12 10:39 AM:
----------------------------------------------------------------

proposed patch
Idea is to poll() the queue and therefore recognize when it is empty and invoke a flush.
Then call take() to wait for the next record

{code:java}
} else {
    rec = recordQueue.poll();
    if (rec == null) {
        // queue ran empty, so let's do a flush on the handlers
        // this way ExtHandlers usually do not need autoflush=true
        flush();
        // wait for next entry in queue
        rec = recordQueue.take();
    }
}
{code}
                
      was (Author: MrEasy):
    proposed patch
Idea is to poll() the queue and therefore recognize when it is empty and invoke a flush.
Then call take() to wait for the next record

} else {
    rec = recordQueue.poll();
    if (rec == null) {
        // queue ran empty, so let's do a flush on the handlers
        // this way ExtHandlers usually do not need autoflush=true
        flush();
        // wait for next entry in queue
        rec = recordQueue.take();
    }
}
                  
> org.jboss.logmanager.handlers.AsyncHandler.AsyncTask should call flush when queue runs empty
> --------------------------------------------------------------------------------------------
>
>                 Key: LOGMGR-54
>                 URL: https://issues.jboss.org/browse/LOGMGR-54
>             Project: JBoss Log Manager
>          Issue Type: Enhancement
>      Security Level: Public(Everyone can see) 
>          Components: core
>    Affects Versions: 1.3.2.Final, 1.4.0.Beta1
>            Reporter: Rico Neubauer
>            Assignee: David Lloyd
>         Attachments: jboss-logmanager_master.patch
>
>
> When using the org.jboss.logmanager.handlers.AsyncHandler in combination with handlers that use autoFlush=false it happens that output stalls when queue runs empty.
> A workaround is to set autoflush=true, however this introduces a flush always, even if there are more records in the queue, which render the flush useless.
> An optimization is to invoke flush() on the handlers if the AsyncTask's queue ran empty - since then there is nothing else to do anyhow.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list