Skip to content

Commit

Permalink
issue JPPF-526 - deprecated or removed recovery port and reaper run i…
Browse files Browse the repository at this point in the history
…nterval where required
  • Loading branch information
lolocohen committed Jul 2, 2018
1 parent 670b8fd commit 384df36
Show file tree
Hide file tree
Showing 13 changed files with 1,027 additions and 1,043 deletions.
444 changes: 222 additions & 222 deletions common/src/java/org/jppf/comm/discovery/JPPFConnectionInformation.java

Large diffs are not rendered by default.

Expand Up @@ -127,7 +127,7 @@ private void configure() {
if (debugEnabled) log.debug("configuring connection");
final TypedProperties config = JPPFConfiguration.getProperties();
if (host == null) host = config.get(JPPFProperties.SERVER_HOST);
if (port < 0) port = config.get(JPPFProperties.RECOVERY_SERVER_PORT);
if (port < 0) port = config.get(JPPFProperties.SERVER_PORT);
maxRetries = 1;
socketReadTimeout = 0;
socketWrapper = new BootstrapSocketClient();
Expand Down
908 changes: 452 additions & 456 deletions common/src/java/org/jppf/utils/configuration/JPPFProperties.java

Large diffs are not rendered by default.

Expand Up @@ -254,10 +254,6 @@ jppf.recovery.read.timeout.doc = Maximum ping response time from the node
jppf.recovery.read.timeout.tags = driver, node
jppf.recovery.reaper.pool.size.doc = Number of threads allocated to the node connection reaper
jppf.recovery.reaper.pool.size.tags = driver
jppf.recovery.reaper.run.interval.doc = Interval between connection reaper runs
jppf.recovery.reaper.run.interval.tags = driver
jppf.recovery.server.port.doc = Port number for the detection of hardware failure
jppf.recovery.server.port.tags = driver, node
jppf.redirect.err.doc = File to redirect System.err to
jppf.redirect.err.tags = driver, node
jppf.redirect.err.append.doc = Append to existing file (true) or create a new one (false)
Expand Down
Expand Up @@ -108,18 +108,19 @@ static DriverConnectionInfo parseLine(final String csv) {
final boolean secure = "true".equalsIgnoreCase(tokens[0]);
final String host = tokens[1];
final int port;
boolean recoveryEnabled = false;
try {
port = Integer.valueOf(tokens[2]);
} catch(@SuppressWarnings("unused") final Exception e) {
return null;
}
int recoveryPort;
try {
recoveryPort = Integer.valueOf(tokens[3]);
final int recoveryPort = Integer.valueOf(tokens[3]);
recoveryEnabled = recoveryPort > 0;
} catch(@SuppressWarnings("unused") final Exception e) {
recoveryPort = -1;
recoveryEnabled = Boolean.valueOf(tokens[3]);
}
return new JPPFDriverConnectionInfo(secure, host, port, recoveryPort);
return new JPPFDriverConnectionInfo(secure, host, port, recoveryEnabled);
}
return null;
}
Expand Down
107 changes: 55 additions & 52 deletions node/src/java/org/jppf/node/connection/ConnectionReason.java
@@ -1,52 +1,55 @@
/*
* JPPF.
* Copyright (C) 2005-2017 JPPF Team.
* http://www.jppf.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.jppf.node.connection;

/**
* This enum lists the possible high-level reasons for a node reconnection request.
* @author Laurent Cohen
* @since 4.1
*/
public enum ConnectionReason
{
/**
* Indicates the first connection attempt when the node starts up.
*/
INITIAL_CONNECTION_REQUEST,
/**
* A reconnection was requested via the management APIs or admin console.
*/
MANAGEMENT_REQUEST,
/**
* An error occurred while initializing the class loader connection.
*/
CLASSLOADER_INIT_ERROR,
/**
* An error occurred while processing a class loader request.
*/
CLASSLOADER_PROCESSING_ERROR,
/**
* An error occurred during the job channel initialization.
*/
JOB_CHANNEL_INIT_ERROR,
/**
* An error occurred on the job channel while processing a job.
*/
JOB_CHANNEL_PROCESSING_ERROR
}
/*
* JPPF.
* Copyright (C) 2005-2017 JPPF Team.
* http://www.jppf.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.jppf.node.connection;

/**
* This enum lists the possible high-level reasons for a node reconnection request.
* @author Laurent Cohen
* @since 4.1
*/
public enum ConnectionReason {
/**
* Indicates the first connection attempt when the node starts up.
*/
INITIAL_CONNECTION_REQUEST,
/**
* A reconnection was requested via the management APIs or admin console.
*/
MANAGEMENT_REQUEST,
/**
* An error occurred while initializing the class loader connection.
*/
CLASSLOADER_INIT_ERROR,
/**
* An error occurred while processing a class loader request.
*/
CLASSLOADER_PROCESSING_ERROR,
/**
* An error occurred during the job channel initialization.
*/
JOB_CHANNEL_INIT_ERROR,
/**
* An error occurred on the job channel while processing a job.
*/
JOB_CHANNEL_PROCESSING_ERROR,
/**
* The heartbeat mechanism failed to receive a message from the server in a configured time frame.
*/
HEARTBEAT_FAILURE
}
108 changes: 58 additions & 50 deletions node/src/java/org/jppf/node/connection/DriverConnectionInfo.java
@@ -1,50 +1,58 @@
/*
* JPPF.
* Copyright (C) 2005-2017 JPPF Team.
* http://www.jppf.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.jppf.node.connection;

/**
* This interface provides the required information for connecting to a remote JPPF driver.
* @author Laurent Cohen
* @since 4.1
*/
public interface DriverConnectionInfo {
/**
* Determine whether secure (with SSL/TLS) connections should be established.
* @return {@code true} for secure connections, {@code false} otherwise.
*/
boolean isSecure();

/**
* Get the driver host name or IP address.
* @return the host as a string.
*/
String getHost();

/**
* Get the driver port to connect to.
* @return the driver port as an int value.
*/
int getPort();

/**
* Get the recovery port for the heartbeat mechanism.
* @return the recovery port a an int; a negative value indicates that recovery is disabled for the node.
*/
int getRecoveryPort();
}
/*
* JPPF.
* Copyright (C) 2005-2017 JPPF Team.
* http://www.jppf.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.jppf.node.connection;

/**
* This interface provides the required information for connecting to a remote JPPF driver.
* @author Laurent Cohen
* @since 4.1
*/
public interface DriverConnectionInfo {
/**
* Determine whether secure (with SSL/TLS) connections should be established.
* @return {@code true} for secure connections, {@code false} otherwise.
*/
boolean isSecure();

/**
* Get the driver host name or IP address.
* @return the host as a string.
*/
String getHost();

/**
* Get the driver port to connect to.
* @return the driver port as an int value.
*/
int getPort();

/**
* Get the recovery port for the heartbeat mechanism.
* @return the recovery port a an int; a negative value indicates that recovery is disabled for the node.
* @deprecated as of JPPF 6.0, the recovery mechanism uses the same port number as the main server port.
* This method will return {@code -1} if recovery is disabled, or the value of {@link #getPort()} if it is enabled.
*/
int getRecoveryPort();

/**
* Determine whether the recovery mechanism (exchange of heartbeat messages) is enabled.
* @return {@code true} if recovery is enabled, {@code false} otherwise.
*/
boolean isRecoveryEnabled();
}
Expand Up @@ -27,14 +27,14 @@
/**
* This implementation of {@link DriverConnectionStrategy} reads a list of drivers
* from a CSV file where each line has the following format:
* <p><code>secure, host, port, recovery_port</code>
* <p><code>secure, host, port, recovery_enabled</code>
* <p>where:
* <ul>
* <li><i>secure</i> is a boolean value (either 'true' or 'false', case-insenssitive) indicating whether a SSL/TLS connection should be established.
* any value that is not 'true' will be interpreted as 'false'.</li>
* <li><i>host</i> is the host name or ip address of the driver to connect to</li>
* <li><i>port</i> is the port to connect to on the driver host</li>
* <li><i>recovery_port</i> is a valid port number for the recovery heartbeat mechanism, or a negative value to disable recovery for the node</li>
* <li><i>recovery_enabled</i> is a boolean value (either 'true' or 'false', case-insenssitive) indicating whether the recovery (or heartbeat) mechanism is enabled for the node</li>
* </ul>
* <p>Additionally, any line starting with a '#' (after trimming) will be considered as a comment and ignored.
* <p>The file location is read from the configuration property {@code 'jppf.node.connection.strategy.file'}.
Expand Down
Expand Up @@ -25,7 +25,7 @@

/**
* This implementation of {@link DriverConnectionStrategy} reads a list of drivers from a configuration property with the following format:
* <p><code>jppf.server.connection.strategy.definitions = secure1, host1, port1, recovery_port1 | ... | secureN, hostN, portN, recovery_portN</code>
* <p><code>jppf.server.connection.strategy.definitions = secure1, host1, port1, recovery_enabled1 | ... | secureN, hostN, portN, recovery_enabledN</code>
* <p>where:
* <ul>
* <li>each connection definition is represented as a group of comma-separated values</li>
Expand All @@ -36,7 +36,7 @@
* any value that is not 'true' will be interpreted as 'false'.</li>
* <li><i>host<sub>i</sub></i> is the host name or ip address of the driver to connect to</li>
* <li><i>port<sub>i</sub></i> is the port to connect to on the driver host</li>
* <li><i>recovery_port<sub>i</sub></i> is a valid port number for the recovery heartbeat mechanism, or a negative value to disable recovery for the node</li>
* <li><i>recovery_enabled<sub>i</sub></i> is a boolean value (either 'true' or 'false', case-insenssitive) indicating whether the recovery (or heartbeat) mechanism is enabled for the node</li>
* </ul>
* </ul>
* <p>Additionally, any group of comma-separated values starting with a '#' (after trimming) will be considered a comment and ignored.
Expand Down

0 comments on commit 384df36

Please sign in to comment.