Guarded calls to LOG.debug() with if (LOG.isDebugEnabled()) to reduce allocation of varargs Object[].

This commit is contained in:
Simone Bordet 2014-06-25 12:37:05 +02:00
parent 66f3913527
commit 4c2c7e8352
3 changed files with 10 additions and 5 deletions

View File

@ -226,7 +226,8 @@ public abstract class HTTP2Session implements ISession, Parser.Listener
if (LOG.isDebugEnabled())
{
String reason = tryConvertPayload(frame.getPayload());
LOG.debug("Received {}: {}/'{}'", frame.getType(), frame.getError(), reason);
if (LOG.isDebugEnabled())
LOG.debug("Received {}: {}/'{}'", frame.getType(), frame.getError(), reason);
}
flusher.close();

View File

@ -87,7 +87,8 @@ public class HpackDecoder
_context.get(index).removeFromRefSet();
else if (entry.isStatic())
{
LOG.debug("decode IdxStatic {}",entry);
if (LOG.isDebugEnabled())
LOG.debug("decode IdxStatic {}",entry);
// emit field
_builder.emit(entry.getHttpField());
@ -98,7 +99,8 @@ public class HpackDecoder
}
else
{
LOG.debug("decode Idx {}",entry);
if (LOG.isDebugEnabled())
LOG.debug("decode Idx {}",entry);
// emit
_builder.emit(entry.getHttpField());
// add to reference set
@ -227,7 +229,8 @@ public class HpackDecoder
else if (f==3)
{
// clear reference set
LOG.debug("decode clear");
if (LOG.isDebugEnabled())
LOG.debug("decode clear");
_context.clearReferenceSet();
}
}

View File

@ -345,7 +345,8 @@ public class HpackEncoder
if (p>=0)
{
int e=buffer.position();
LOG.debug("encoded '{}' by {} to '{}'",field,encoding,TypeUtil.toHexString(buffer.array(),buffer.arrayOffset()+p,e-p));
if (LOG.isDebugEnabled())
LOG.debug("encoded '{}' by {} to '{}'",field,encoding,TypeUtil.toHexString(buffer.array(),buffer.arrayOffset()+p,e-p));
}
}
}