From 0d8fdd93782d3cd75271a4c99528bedc3abf8c0e Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Tue, 12 May 2009 01:45:12 +0000 Subject: [PATCH] HBASE-1407 Changing internal structure of ImmutableBytesWritable contructor. git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@773756 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 + .../hbase/io/ImmutableBytesWritable.java | 51 +++++++++++-------- 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index ff4c7fde035..ac63a6f9552 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -224,6 +224,8 @@ Release 0.20.0 - Unreleased HBASE-1393 Narrow synchronization in HLog HBASE-1404 minor edit of regionserver logging messages HBASE-1405 Threads.shutdown has unnecessary branch + HBASE-1407 Changing internal structure of ImmutableBytesWritable + contructor (Erik Holstad via Stack) OPTIMIZATIONS diff --git a/src/java/org/apache/hadoop/hbase/io/ImmutableBytesWritable.java b/src/java/org/apache/hadoop/hbase/io/ImmutableBytesWritable.java index 49a0e209779..d9c2ae69347 100644 --- a/src/java/org/apache/hadoop/hbase/io/ImmutableBytesWritable.java +++ b/src/java/org/apache/hadoop/hbase/io/ImmutableBytesWritable.java @@ -1,5 +1,5 @@ /** - * Copyright 2007 The Apache Software Foundation + * Copyright 2009 The Apache Software Foundation * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -34,10 +34,15 @@ import org.apache.hadoop.io.WritableComparator; * {@link org.apache.hadoop.io.BytesWritable} only this class is NOT resizable * and DOES NOT distinguish between the size of the seqeunce and the current * capacity as {@link org.apache.hadoop.io.BytesWritable} does. Hence its - * comparatively 'immutable'. + * comparatively 'immutable'. When creating a new instance of this class, + * the underlying byte [] is not copied, just referenced. The backing + * buffer is accessed when we go to serialize. */ -public class ImmutableBytesWritable implements WritableComparable { +public class ImmutableBytesWritable +implements WritableComparable { private byte[] bytes; + private int offset; + private int length; /** * Create a zero-size sequence. @@ -51,11 +56,11 @@ public class ImmutableBytesWritable implements WritableComparableibw. * @param ibw the value to set this ImmutableBytesWritable to. */ @@ -64,15 +69,16 @@ public class ImmutableBytesWritable implements WritableComparable