Skip to content

Commit

Permalink
fixed bug JPPF-603
Browse files Browse the repository at this point in the history
  • Loading branch information
lolocohen committed Sep 9, 2019
1 parent 3ef940f commit c527787
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
7 changes: 4 additions & 3 deletions node/src/java/org/jppf/node/NodeRunner.java
Expand Up @@ -171,7 +171,6 @@ public void start(final String...args) {
try {
if (debugEnabled) log.debug("node startup main loop");
ConnectionContext context = new ConnectionContext("Initial connection", null, ConnectionReason.INITIAL_CONNECTION_REQUEST);
//boolean reconnect = true;
while (true) {
node = null;
try {
Expand All @@ -191,8 +190,10 @@ public void start(final String...args) {
context = new ConnectionContext(e.getMessage(), e.getCause(), e.getReason());
if (classLoader != null) classLoader.close();
classLoader = null;
if (node != null) node.stopNode();
//reconnect = true;
if (node != null) {
node.stopNode();
if (node.isSlaveNode()) System.exit(0);
}
} finally {
if ((node != null) && (node.getShuttingDown().get() || embeddedShutdown.get())) {
if (debugEnabled) log.debug("exiting: node={}, shuttingDown={}, embeddedShutdown", node, (node == null) ? "n/a" :node.getShuttingDown().get(), embeddedShutdown.get());
Expand Down
Expand Up @@ -141,6 +141,13 @@ void submitProvisioningRequest(final int requestedSlaves, final boolean interrup
executor.execute(() -> shrinkOrGrowSlaves(requestedSlaves, interruptIfRunning, configOverrides));
}

/**
* Stop all the slave nodes still running.
*/
public void stopAllSlaves() {
shrinkOrGrowSlaves(0, true, null);
}

/**
* Start or stop the required number of slaves to reach the specified number,
* using the specified config overrides. If {@code configOverrides} is null, then previous overrides are applied.
Expand Down
1 change: 1 addition & 0 deletions node/src/java/org/jppf/server/node/JPPFNode.java
Expand Up @@ -408,6 +408,7 @@ public synchronized void stopNode() {
if (getJobWriter() != null) getJobWriter().close();
throttlingHandler.stop();
super.stopNode();
slaveManager.stopAllSlaves();
}

/**
Expand Down

0 comments on commit c527787

Please sign in to comment.