![JAR search and dependency download from the Maven repository](/logo.png)
com.github.ltsopensource.jobtracker.processor.JobPullProcessor Maven / Gradle / Ivy
package com.github.ltsopensource.jobtracker.processor;
import com.github.ltsopensource.core.logger.Logger;
import com.github.ltsopensource.core.logger.LoggerFactory;
import com.github.ltsopensource.core.protocol.JobProtos;
import com.github.ltsopensource.core.protocol.command.JobPullRequest;
import com.github.ltsopensource.jobtracker.domain.JobTrackerAppContext;
import com.github.ltsopensource.jobtracker.support.JobPusher;
import com.github.ltsopensource.remoting.Channel;
import com.github.ltsopensource.remoting.exception.RemotingCommandException;
import com.github.ltsopensource.remoting.protocol.RemotingCommand;
/**
* @author Robert HG ([email protected]) on 7/24/14.
* 处理 TaskTracker的 Job pull 请求
*/
public class JobPullProcessor extends AbstractRemotingProcessor {
private JobPusher jobPusher;
private static final Logger LOGGER = LoggerFactory.getLogger(JobPullProcessor.class);
public JobPullProcessor(JobTrackerAppContext appContext) {
super(appContext);
jobPusher = new JobPusher(appContext);
}
@Override
public RemotingCommand processRequest(final Channel ctx, final RemotingCommand request) throws RemotingCommandException {
JobPullRequest requestBody = request.getBody();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("taskTrackerNodeGroup:{}, taskTrackerIdentity:{} , availableThreads:{}", requestBody.getNodeGroup(), requestBody.getIdentity(), requestBody.getAvailableThreads());
}
jobPusher.push(requestBody);
return RemotingCommand.createResponseCommand(JobProtos.ResponseCode.JOB_PULL_SUCCESS.code(), "");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy