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()) if (LOG.isDebugEnabled())
{ {
String reason = tryConvertPayload(frame.getPayload()); 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(); flusher.close();

View File

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

View File

@ -345,7 +345,8 @@ public class HpackEncoder
if (p>=0) if (p>=0)
{ {
int e=buffer.position(); 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));
} }
} }
} }