Skip to content

Commit

Permalink
Fix an NPE seen twice in one day to log some info
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Sep 14, 2018
1 parent 254a8db commit 7665e88
Showing 1 changed file with 18 additions and 11 deletions.
Expand Up @@ -539,7 +539,7 @@ public List<OutgoingBatch> extract(ProcessInfo extractInfo, Node targetNode, Str

OutgoingBatches batches = loadPendingBatches(extractInfo, targetNode, queue, transport);

if (batches.containsBatches()) {
if (batches != null && batches.containsBatches()) {

ChannelMap channelMap = transport.getSuspendIgnoreChannelLists(configurationService, queue,
targetNode);
Expand Down Expand Up @@ -567,17 +567,24 @@ protected OutgoingBatches loadPendingBatches(ProcessInfo extractInfo, Node targe
Callable<OutgoingBatches> getOutgoingBatches = () -> {
OutgoingBatches batches = null;
if (queue != null) {
NodeGroupLinkAction defaultAction = configurationService.getNodeGroupLinkFor(nodeService.findIdentity().getNodeGroupId(),
targetNode.getNodeGroupId(), false).getDataEventAction();
ProcessType processType = extractInfo.getKey().getProcessType();
NodeGroupLinkAction action = null;

if (processType.equals(ProcessType.PUSH_JOB_EXTRACT)) {
action = NodeGroupLinkAction.P;
} else if (processType.equals(ProcessType.PULL_HANDLER_EXTRACT)) {
action = NodeGroupLinkAction.W;
NodeGroupLink link = configurationService.getNodeGroupLinkFor(nodeService.findIdentity().getNodeGroupId(),
targetNode.getNodeGroupId(), false);
if (link != null) {
NodeGroupLinkAction defaultAction = configurationService.getNodeGroupLinkFor(nodeService.findIdentity().getNodeGroupId(),
targetNode.getNodeGroupId(), false).getDataEventAction();
ProcessType processType = extractInfo.getKey().getProcessType();
NodeGroupLinkAction action = null;

if (processType.equals(ProcessType.PUSH_JOB_EXTRACT)) {
action = NodeGroupLinkAction.P;
} else if (processType.equals(ProcessType.PULL_HANDLER_EXTRACT)) {
action = NodeGroupLinkAction.W;
}
batches = outgoingBatchService.getOutgoingBatches(targetNode.getNodeId(), queue, action, defaultAction, false);
} else {
log.error("Group link not found for " + nodeService.findIdentity().getNodeGroupId() +
" to " + targetNode.getNodeGroupId() + ". Check that configuration matches on both nodes.");
}
batches = outgoingBatchService.getOutgoingBatches(targetNode.getNodeId(), queue, action, defaultAction, false);
} else {
batches = outgoingBatchService.getOutgoingBatches(targetNode.getNodeId(), false);
}
Expand Down

0 comments on commit 7665e88

Please sign in to comment.