Hello header for HBase 0.95 and later.
()
| 2111 | |
| 2112 | /** Hello header for HBase 0.95 and later. */ |
| 2113 | private ChannelBuffer header095() { |
| 2114 | final RPCPB.UserInformation user = RPCPB.UserInformation.newBuilder() |
| 2115 | .setEffectiveUser(System.getProperty("user.name", "asynchbase")) |
| 2116 | .build(); |
| 2117 | final RPCPB.ConnectionHeader pb = RPCPB.ConnectionHeader.newBuilder() |
| 2118 | .setUserInfo(user) |
| 2119 | .setServiceName("ClientService") |
| 2120 | .setCellBlockCodecClass("org.apache.hadoop.hbase.codec.KeyValueCodec") |
| 2121 | .build(); |
| 2122 | final int pblen = pb.getSerializedSize(); |
| 2123 | final byte[] buf = new byte[HBASE.length + 4 + pblen]; |
| 2124 | final ChannelBuffer header = commonHeader(buf, HBASE); |
| 2125 | header.writeInt(pblen); // 4 bytes |
| 2126 | try { |
| 2127 | final CodedOutputStream output = |
| 2128 | CodedOutputStream.newInstance(buf, HBASE.length + 4, pblen); |
| 2129 | pb.writeTo(output); |
| 2130 | output.checkNoSpaceLeft(); |
| 2131 | } catch (IOException e) { |
| 2132 | throw new RuntimeException("Should never happen", e); |
| 2133 | } |
| 2134 | // We wrote to the underlying buffer but Netty didn't see the writes, |
| 2135 | // so move the write index forward. |
| 2136 | header.writerIndex(buf.length); |
| 2137 | return header; |
| 2138 | } |
| 2139 | |
| 2140 | /** Hello header for HBase 0.92 to 0.94. */ |
| 2141 | private ChannelBuffer header092() { |
no test coverage detected