MCPcopy Create free account
hub / github.com/OpenTSDB/asynchbase / helloRpc

Method helloRpc

src/RegionClient.java:2218–2233  ·  view source on GitHub ↗

Sends the "hello" message needed when opening a new connection. This message is immediately followed by a GetProtocolVersionRequest so we can learn what version the server is running to be able to talk to it the way it expects. @param chan The channel connected to the server we need to hands

(final Channel chan, final ChannelBuffer header)

Source from the content-addressed store, hash-verified

2216 * @param header The header to use for the handshake.
2217 */
2218 private void helloRpc(final Channel chan, final ChannelBuffer header) {
2219 LOG.debug("helloRpc for the channel: {}", chan);
2220 Callback<Object, Exception> errorback = new Callback<Object, Exception>() {
2221
2222 @Override
2223 public Object call(final Exception e) throws Exception {
2224 LOG.info("helloRpc failed. Closing the channel:" + chan, e);
2225 Channels.close(chan);
2226 return e;
2227 }
2228 };
2229 final GetProtocolVersionRequest rpc = new GetProtocolVersionRequest();
2230 rpc.getDeferred().addBoth(new ProtocolVersionCB(chan))
2231 .addErrback(errorback);
2232 Channels.write(chan, ChannelBuffers.wrappedBuffer(header, encode(rpc)));
2233 }
2234
2235 /**
2236 * Fetch the protocol version from the region server

Callers 2

channelConnectedMethod · 0.95
callMethod · 0.80

Calls 2

encodeMethod · 0.95
getDeferredMethod · 0.45

Tested by

no test coverage detected