logging & formatting to reduce gc churn

This commit is contained in:
jrandom
2004-04-27 08:41:38 +00:00
committed by zzz
parent 70faecb8b5
commit 34e8db0fe3
5 changed files with 213 additions and 182 deletions

View File

@ -77,7 +77,8 @@ public abstract class I2NPMessageImpl extends DataStructureImpl implements I2NPM
} catch (DataFormatException dfe) {
throw new I2NPMessageException("Error reading the message header", dfe);
}
_log.debug("Reading bytes: type = " + type + " / uniqueId : " + _uniqueId + " / expiration : " + _expiration);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Reading bytes: type = " + type + " / uniqueId : " + _uniqueId + " / expiration : " + _expiration);
readMessage(in, type);
}
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
@ -85,7 +86,8 @@ public abstract class I2NPMessageImpl extends DataStructureImpl implements I2NPM
DataHelper.writeLong(out, 1, getType());
DataHelper.writeLong(out, 4, _uniqueId);
DataHelper.writeDate(out, _expiration);
_log.debug("Writing bytes: type = " + getType() + " / uniqueId : " + _uniqueId + " / expiration : " + _expiration);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Writing bytes: type = " + getType() + " / uniqueId : " + _uniqueId + " / expiration : " + _expiration);
byte[] data = writeMessage();
out.write(data);
} catch (I2NPMessageException ime) {