Logger improvment
-----------------

         Key: DIRMINA-193
         URL: http://issues.apache.org/jira/browse/DIRMINA-193
     Project: Directory MINA
        Type: Improvement
    Reporter: Emmanuel Lecharny
    Priority: Minor


The way SessionLog are used could be improved a little bit. The code looks like 
:

    public void messageReceived( NextFilter nextFilter, IoSession session, 
Object message )
    {
        SessionLog.info( session, "RECEIVED: " + message );
        ...

and in SessionLog.info we have :

    public static void info( IoSession session, String message )
    {
        Logger log = getLogger( session );
        if( log.isInfoEnabled() )
        {
        ...

The fact is that a String is created and appended with a other String for each 
invocation, and usually this is a waste of time, because we are not in info 
mode.

A better solution could be to change two little things :
- use a static logger instead of calling getLogger(session). It seems that we 
only have one single logger for all the sessions
- check if we are in info mode before creating the message.

I evaluate the gain to something around 2% speed improvment for the whole ADS, 
which is not neglictable (info deducted from a YourKit session)


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to