https://issues.apache.org/jira/browse/AMQ-5578
Remove unnecessary buffer initialization after confirmation that it is not needed. Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/5e0f4933 Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/5e0f4933 Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/5e0f4933 Branch: refs/heads/master Commit: 5e0f49332be2a0b30cb40dc9e735a794fe7b78f6 Parents: edfc23e Author: Timothy Bish <[email protected]> Authored: Thu Mar 3 17:35:21 2016 -0500 Committer: Timothy Bish <[email protected]> Committed: Thu Mar 3 17:35:21 2016 -0500 ---------------------------------------------------------------------- .../apache/activemq/store/kahadb/disk/journal/Journal.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq/blob/5e0f4933/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/journal/Journal.java ---------------------------------------------------------------------- diff --git a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/journal/Journal.java b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/journal/Journal.java index ed2cba3..a89f2a1 100644 --- a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/journal/Journal.java +++ b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/journal/Journal.java @@ -279,12 +279,7 @@ public class Journal { private void doPreallocationZeros(RecoverableRandomAccessFile file) { ByteBuffer buffer = ByteBuffer.allocate(maxFileLength); - // intentional double initialization due to interaction with the OS level - // file allocation mechanics. - for (int i = 0; i < maxFileLength; i++) { - buffer.put((byte) 0x00); - } - buffer.flip(); + buffer.limit(maxFileLength); try { FileChannel channel = file.getChannel();
