use of org.apache.ignite.internal.processors.hadoop.message.HadoopMessage in project ignite by apache.
the class HadoopExternalCommunication method resetNioServer.
/**
* Recreates tpcSrvr socket instance.
*
* @return Server instance.
* @throws IgniteCheckedException Thrown if it's not possible to create server.
*/
private GridNioServer<HadoopMessage> resetNioServer() throws IgniteCheckedException {
if (boundTcpPort >= 0)
throw new IgniteCheckedException("Tcp NIO server was already created on port " + boundTcpPort);
IgniteCheckedException lastEx = null;
// If configured TCP port is busy, find first available in range.
for (int port = locPort; port < locPort + locPortRange; port++) {
try {
GridNioServer<HadoopMessage> srvr = GridNioServer.<HadoopMessage>builder().address(locHost).port(port).listener(srvLsnr).logger(log.getLogger(GridNioServer.class)).selectorCount(selectorsCnt).igniteInstanceName(igniteInstanceName).serverName("hadoop").tcpNoDelay(tcpNoDelay).directBuffer(directBuf).byteOrder(ByteOrder.nativeOrder()).socketSendBufferSize(sockSndBuf).socketReceiveBufferSize(sockRcvBuf).sendQueueLimit(msgQueueLimit).directMode(false).filters(filters()).build();
boundTcpPort = port;
// Ack Port the TCP server was bound to.
if (log.isInfoEnabled())
log.info("Successfully bound to TCP port [port=" + boundTcpPort + ", locHost=" + locHost + ']');
return srvr;
} catch (IgniteCheckedException e) {
lastEx = e;
if (log.isDebugEnabled())
log.debug("Failed to bind to local port (will try next port within range) [port=" + port + ", locHost=" + locHost + ']');
}
}
// If free port wasn't found.
throw new IgniteCheckedException("Failed to bind to any port within range [startPort=" + locPort + ", portRange=" + locPortRange + ", locHost=" + locHost + ']', lastEx);
}
use of org.apache.ignite.internal.processors.hadoop.message.HadoopMessage in project ignite by apache.
the class HadoopShuffle method start.
/** {@inheritDoc} */
@Override
public void start(HadoopContext ctx) throws IgniteCheckedException {
super.start(ctx);
ctx.kernalContext().io().addMessageListener(GridTopic.TOPIC_HADOOP_MSG, new GridMessageListener() {
@Override
public void onMessage(UUID nodeId, Object msg) {
onMessageReceived(nodeId, (HadoopMessage) msg);
}
});
ctx.kernalContext().io().addUserMessageListener(GridTopic.TOPIC_HADOOP, new IgniteBiPredicate<UUID, Object>() {
@Override
public boolean apply(UUID nodeId, Object msg) {
return onMessageReceived(nodeId, (HadoopMessage) msg);
}
});
}
Aggregations