private void createReplicaFeederChannel()
throws IOException, ConnectRetryException {
SocketChannel channel = SocketChannel.open();
final DbConfigManager configManager = repNode.getConfigManager();
final int timeoutMs = repNode.getConfigManager().
getDuration(RepParams.PRE_HEARTBEAT_TIMEOUT);
replicaFeederChannel =
new NamedChannelWithTimeout(repNode, channel, timeoutMs);
Socket socket = channel.socket();
/*
* Note that soTimeout is not set since it's a blocking channel and
* setSoTimeout has no effect on a blocking nio channel.
*/
channel.configureBlocking(true);
/*
* Push responses out rapidly, they are small (heart beat or commit
* response) and need timely delivery to the master.
*/
socket.setTcpNoDelay(true);
try {
final int openTimeout = configManager.
getDuration(RepParams.REPSTREAM_OPEN_TIMEOUT);
socket.connect(repNode.getMasterStatus().getNodeMaster(),
openTimeout);
ServiceDispatcher.doServiceHandshake
(channel, FeederManager.FEEDER_SERVICE);