Hello header for HBase 0.90 and earlier.
()
| 2158 | |
| 2159 | /** Hello header for HBase 0.90 and earlier. */ |
| 2160 | private ChannelBuffer header090() { |
| 2161 | final byte[] buf = new byte[4 + 1 + 4 + 2 + 29 + 2 + 48 + 2 + 47]; |
| 2162 | final ChannelBuffer header = commonHeader(buf, HRPC3); |
| 2163 | |
| 2164 | // Serialized UserGroupInformation to say who we are. |
| 2165 | // We're not nice so we're not gonna say who we are and we'll just send |
| 2166 | // `null' (hadoop.io.ObjectWritable$NullInstance). |
| 2167 | // First, we need the size of the whole damn UserGroupInformation thing. |
| 2168 | // We skip 4 bytes now and will set it to the actual size at the end. |
| 2169 | header.writerIndex(header.writerIndex() + 4); // 4 |
| 2170 | // Write the class name of the object. |
| 2171 | // See hadoop.io.ObjectWritable#writeObject |
| 2172 | // See hadoop.io.UTF8#writeString |
| 2173 | // String length as a short followed by UTF-8 string. |
| 2174 | String klass = "org.apache.hadoop.io.Writable"; |
| 2175 | header.writeShort(klass.length()); // 2 |
| 2176 | header.writeBytes(Bytes.ISO88591(klass)); // 29 |
| 2177 | klass = "org.apache.hadoop.io.ObjectWritable$NullInstance"; |
| 2178 | header.writeShort(klass.length()); // 2 |
| 2179 | header.writeBytes(Bytes.ISO88591(klass)); // 48 |
| 2180 | klass = "org.apache.hadoop.security.UserGroupInformation"; |
| 2181 | header.writeShort(klass.length()); // 2 |
| 2182 | header.writeBytes(Bytes.ISO88591(klass)); // 47 |
| 2183 | |
| 2184 | // Now set the length of the whole damn thing. |
| 2185 | // -4 because the length itself isn't part of the payload. |
| 2186 | // -5 because the "hrpc" + version isn't part of the payload. |
| 2187 | header.setInt(5, header.writerIndex() - 4 - 5); |
| 2188 | return header; |
| 2189 | } |
| 2190 | |
| 2191 | /** CDH3b3-specific header for Hadoop "security". */ |
| 2192 | private ChannelBuffer headerCDH3b3() { |
no test coverage detected