Skip to content

Commit

Permalink
fixed NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
lolocohen committed Dec 17, 2019
1 parent 799796b commit 38dbbe3
Showing 1 changed file with 15 additions and 7 deletions.
Expand Up @@ -90,12 +90,20 @@ public void sendHandshakeBundle(final AsyncNodeContext context, final ServerTask
* @throws Exception if any error occurs.
*/
void bundleSent(final AsyncNodeContext context, final ServerTaskBundleNode nodeBundle) throws Exception {
final JPPFSchedule schedule = nodeBundle.getJob().getSLA().getDispatchExpirationSchedule();
final AsyncNodeNioServer server = context.getServer();
if (schedule != null) {
final NodeDispatchTimeoutAction action = new NodeDispatchTimeoutAction(server.getOfflineNodeHandler(), nodeBundle, context.isOffline() ? null : context);
server.getDispatchExpirationHandler().scheduleAction(ServerTaskBundleNode.makeKey(nodeBundle), schedule, action);
}
if (nodeBundle != null) {
final TaskBundle job = nodeBundle.getJob();
if (job != null) {
final JobSLA sla = job.getSLA();
if (sla != null) {
final JPPFSchedule schedule = sla.getDispatchExpirationSchedule();
final AsyncNodeNioServer server = context.getServer();
if (schedule != null) {
final NodeDispatchTimeoutAction action = new NodeDispatchTimeoutAction(server.getOfflineNodeHandler(), nodeBundle, context.isOffline() ? null : context);
server.getDispatchExpirationHandler().scheduleAction(ServerTaskBundleNode.makeKey(nodeBundle), schedule, action);
}
} else log.warn("null sla for {} of {} with {}", job, nodeBundle, context);
} else log.warn("null job for {} with {}", nodeBundle, context);
} else log.warn("null bundle for {}", context);
context.setWriteMessage(null);
if (context.isOffline()) processOfflineRequest(context, nodeBundle);
}
Expand All @@ -120,9 +128,9 @@ public void handshakeReceived(final AsyncNodeContext context, final AbstractTask
if (acceptsNewJobs != null) context.setAcceptingNewJobs(acceptsNewJobs);
if (!bundle.isHandshake()) throw new IllegalStateException("handshake bundle expected.");
}
if (debugEnabled) log.debug("read bundle for {}, bundle={}", context, bundle);
final String uuid = bundle.getParameter(NODE_UUID_PARAM);
context.setUuid(uuid);
if (debugEnabled) log.debug("read bundle for {}, bundle={}", context, bundle);
final JPPFSystemInformation systemInfo = bundle.getParameter(SYSTEM_INFO_PARAM);
context.setNodeIdentifier(getNodeIdentifier(context.getServer().getBundlerFactory(), context, systemInfo));
if (debugEnabled) log.debug("nodeID = {} for node = {}", context.getNodeIdentifier(), context);
Expand Down

0 comments on commit 38dbbe3

Please sign in to comment.