@Deprecated @InterfaceAudience.Private class HbaseObjectWritableFor96Migration extends Object implements org.apache.hadoop.io.Writable, WritableWithSize, org.apache.hadoop.conf.Configurable
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).
Modifier and Type | Class and Description |
---|---|
private static class |
HbaseObjectWritableFor96Migration.NullInstance
Deprecated.
|
Modifier and Type | Field and Description |
---|---|
(package private) static Map<Class<?>,Integer> |
CLASS_TO_CODE
Deprecated.
|
(package private) static Map<Integer,Class<?>> |
CODE_TO_CLASS
Deprecated.
|
private org.apache.hadoop.conf.Configuration |
conf
Deprecated.
|
private Class<?> |
declaredClass
Deprecated.
|
private static int |
GENERIC_ARRAY_CODE
Deprecated.
|
private Object |
instance
Deprecated.
|
private static org.apache.commons.logging.Log |
LOG
Deprecated.
|
private static int |
NEXT_CLASS_CODE
Deprecated.
|
private static byte |
NOT_ENCODED
Deprecated.
|
Constructor and Description |
---|
HbaseObjectWritableFor96Migration()
Deprecated.
default constructor for writable
|
HbaseObjectWritableFor96Migration(Class<?> declaredClass,
Object instance)
Deprecated.
|
HbaseObjectWritableFor96Migration(Object instance)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
private static void |
addToMap(Class<?> clazz,
int code)
Deprecated.
|
(package private) Object |
get()
Deprecated.
|
private static Class |
getClassByName(org.apache.hadoop.conf.Configuration conf,
String className)
Deprecated.
|
(package private) static Integer |
getClassCode(Class<?> c)
Deprecated.
|
org.apache.hadoop.conf.Configuration |
getConf()
Deprecated.
|
(package private) Class<?> |
getDeclaredClass()
Deprecated.
|
(package private) static int |
getNextClassCode()
Deprecated.
|
(package private) static Method |
getStaticProtobufMethod(Class<?> declaredClass,
String method,
Class<?>... args)
Deprecated.
|
long |
getWritableSize()
Deprecated.
Provide a size hint to the caller.
|
(package private) static long |
getWritableSize(Object instance,
Class declaredClass,
org.apache.hadoop.conf.Configuration conf)
Deprecated.
|
(package private) static Class<?> |
readClass(org.apache.hadoop.conf.Configuration conf,
DataInput in)
Deprecated.
Reads and returns the class as written by
writeClass(DataOutput, Class) |
void |
readFields(DataInput in)
Deprecated.
|
(package private) static Object |
readObject(DataInput in,
org.apache.hadoop.conf.Configuration conf)
Deprecated.
Read a
Writable , String , primitive type, or an array of
the preceding. |
(package private) static Object |
readObject(DataInput in,
HbaseObjectWritableFor96Migration objectWritable,
org.apache.hadoop.conf.Configuration conf)
Deprecated.
Read a
Writable , String , primitive type, or an array of
the preceding. |
(package private) void |
set(Object instance)
Deprecated.
Reset the instance.
|
void |
setConf(org.apache.hadoop.conf.Configuration conf)
Deprecated.
|
String |
toString()
Deprecated.
|
(package private) static com.google.protobuf.Message |
tryInstantiateProtobuf(Class<?> protoClass,
DataInput dataIn)
Deprecated.
Try to instantiate a protocol buffer of the given message class
from the given input stream.
|
void |
write(DataOutput out)
Deprecated.
|
(package private) static void |
writeClass(DataOutput out,
Class<?> c)
Deprecated.
Writes the encoded class code as defined in CLASS_TO_CODE, or
the whole class name if not defined in the mapping.
|
(package private) static void |
writeClassCode(DataOutput out,
Class<?> c)
Deprecated.
Write out the code for passed Class.
|
(package private) static void |
writeObject(DataOutput out,
Object instance,
Class declaredClass,
org.apache.hadoop.conf.Configuration conf)
Deprecated.
Write a
Writable , String , primitive type, or an array of
the preceding. |
private static final org.apache.commons.logging.Log LOG
private static final byte NOT_ENCODED
private static final int GENERIC_ARRAY_CODE
private static final int NEXT_CLASS_CODE
private Class<?> declaredClass
private Object instance
private org.apache.hadoop.conf.Configuration conf
HbaseObjectWritableFor96Migration()
HbaseObjectWritableFor96Migration(Object instance)
instance
- Object get()
Class<?> getDeclaredClass()
void set(Object instance)
instance
- public String toString()
toString
in class Object
Object.toString()
public void readFields(DataInput in) throws IOException
readFields
in interface org.apache.hadoop.io.Writable
IOException
public void write(DataOutput out) throws IOException
write
in interface org.apache.hadoop.io.Writable
IOException
public long getWritableSize()
WritableWithSize
getWritableSize
in interface WritableWithSize
static Integer getClassCode(Class<?> c) throws IOException
IOException
static int getNextClassCode()
static void writeClassCode(DataOutput out, Class<?> c) throws IOException
out
- c
- IOException
static long getWritableSize(Object instance, Class declaredClass, org.apache.hadoop.conf.Configuration conf)
static void writeObject(DataOutput out, Object instance, Class declaredClass, org.apache.hadoop.conf.Configuration conf) throws IOException
Writable
, String
, primitive type, or an array of
the preceding.out
- instance
- declaredClass
- conf
- IOException
static void writeClass(DataOutput out, Class<?> c) throws IOException
IOException
static Class<?> readClass(org.apache.hadoop.conf.Configuration conf, DataInput in) throws IOException
writeClass(DataOutput, Class)
IOException
static Object readObject(DataInput in, org.apache.hadoop.conf.Configuration conf) throws IOException
Writable
, String
, primitive type, or an array of
the preceding.in
- conf
- IOException
static Object readObject(DataInput in, HbaseObjectWritableFor96Migration objectWritable, org.apache.hadoop.conf.Configuration conf) throws IOException
Writable
, String
, primitive type, or an array of
the preceding.in
- objectWritable
- conf
- IOException
static com.google.protobuf.Message tryInstantiateProtobuf(Class<?> protoClass, DataInput dataIn) throws IOException
protoClass
- the class of the generated protocol bufferdataIn
- the input stream to read fromIOException
- if an IO problem occursstatic Method getStaticProtobufMethod(Class<?> declaredClass, String method, Class<?>... args)
private static Class getClassByName(org.apache.hadoop.conf.Configuration conf, String className) throws ClassNotFoundException
ClassNotFoundException
private static void addToMap(Class<?> clazz, int code)
public void setConf(org.apache.hadoop.conf.Configuration conf)
setConf
in interface org.apache.hadoop.conf.Configurable
public org.apache.hadoop.conf.Configuration getConf()
getConf
in interface org.apache.hadoop.conf.Configurable
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.