|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.io.HbaseObjectWritable
public class HbaseObjectWritable
This is a customized version of the polymorphic hadoop
ObjectWritable
. It removes UTF8 (HADOOP-414).
Using Text
intead of UTF-8 saves ~2% CPU between reading and writing
objects running a short sequentialWrite Performance Evaluation test just in
ObjectWritable alone; more when we're doing randomRead-ing. Other
optimizations include our passing codes for classes instead of the
actual class names themselves. This makes it so this class needs amendment
if non-Writable classes are introduced -- if passed a Writable for which we
have no code, we just do the old-school passing of the class name, etc. --
but passing codes the savings are large particularly when cell
data is small (If < a couple of kilobytes, the encoding/decoding of class
name and reflection to instantiate class was costing in excess of the cell
handling).
Field Summary | |
---|---|
protected static org.apache.commons.logging.Log |
LOG
|
Constructor Summary | |
---|---|
HbaseObjectWritable()
|
|
HbaseObjectWritable(Class<?> declaredClass,
Object instance)
|
|
HbaseObjectWritable(Object instance)
|
Method Summary | |
---|---|
Object |
get()
Return the instance, or null if none. |
Configuration |
getConf()
Return the configuration used by this object. |
Class<?> |
getDeclaredClass()
Return the class this is meant to be. |
void |
readFields(DataInput in)
Deserialize the fields of this object from in . |
static Object |
readObject(DataInput in,
Configuration conf)
Read a Writable , String , primitive type, or an array of
the preceding. |
static Object |
readObject(DataInput in,
HbaseObjectWritable objectWritable,
Configuration conf)
Read a Writable , String , primitive type, or an array of
the preceding. |
void |
set(Object instance)
Reset the instance. |
void |
setConf(Configuration conf)
Set the configuration to be used by this object. |
String |
toString()
|
void |
write(DataOutput out)
Serialize the fields of this object to out . |
static void |
writeObject(DataOutput out,
Object instance,
Class declaredClass,
Configuration conf)
Write a Writable , String , primitive type, or an array of
the preceding. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final org.apache.commons.logging.Log LOG
Constructor Detail |
---|
public HbaseObjectWritable()
public HbaseObjectWritable(Object instance)
public HbaseObjectWritable(Class<?> declaredClass, Object instance)
Method Detail |
---|
public Object get()
public Class<?> getDeclaredClass()
public void set(Object instance)
public String toString()
toString
in class Object
public void readFields(DataInput in) throws IOException
Writable
in
.
For efficiency, implementations should attempt to re-use storage in the existing object where possible.
readFields
in interface Writable
in
- DataInput
to deseriablize this object from.
IOException
public void write(DataOutput out) throws IOException
Writable
out
.
write
in interface Writable
out
- DataOuput
to serialize this object into.
IOException
public static void writeObject(DataOutput out, Object instance, Class declaredClass, Configuration conf) throws IOException
Writable
, String
, primitive type, or an array of
the preceding.
IOException
public static Object readObject(DataInput in, Configuration conf) throws IOException
Writable
, String
, primitive type, or an array of
the preceding.
IOException
public static Object readObject(DataInput in, HbaseObjectWritable objectWritable, Configuration conf) throws IOException
Writable
, String
, primitive type, or an array of
the preceding.
IOException
public void setConf(Configuration conf)
Configurable
setConf
in interface Configurable
public Configuration getConf()
Configurable
getConf
in interface Configurable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |