Skip to content

Commit

Permalink
Schema cleanup: Removing JMX
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Oct 5, 2021
1 parent 09d35cd commit e630061
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 422 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4513,6 +4513,11 @@
<a:version>4.4</a:version>
<a:operation>removed</a:operation>
</a:schemaMigration>
<a:schemaMigration>
<a:element>tns:jmxPort</a:element>
<a:version>4.4</a:version>
<a:operation>removed</a:operation>
</a:schemaMigration>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexContent>
Expand Down Expand Up @@ -4565,18 +4570,6 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="jmxPort" type="xsd:int" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Port at which this node can be contacted via JMX.
</xsd:documentation>
<xsd:appinfo>
<a:deprecated>true</a:deprecated>
<a:deprecatedSince>4.0</a:deprecatedSince>
<a:plannedRemoval>4.4</a:plannedRemoval>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="lastCheckInTime" type="xsd:dateTime" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ public class TaskManagerConfiguration {
private static final String NODE_STARTUP_DELAY_CONFIG_ENTRY = "nodeStartupDelay";

private static final String CHECK_FOR_TASK_CONCURRENT_EXECUTION_CONFIG_ENTRY = "checkForTaskConcurrentExecution";
private static final String USE_JMX_CONFIG_ENTRY = "useJmx";
@Deprecated private static final String JMX_USERNAME_CONFIG_ENTRY = "jmxUsername";
@Deprecated private static final String JMX_PASSWORD_CONFIG_ENTRY = "jmxPassword";
private static final String TEST_MODE_CONFIG_ENTRY = "testMode";
private static final String WAITING_TASKS_CHECK_INTERVAL_CONFIG_ENTRY = "waitingTasksCheckInterval";
private static final String STALLED_TASKS_CHECK_INTERVAL_CONFIG_ENTRY = "stalledTasksCheckInterval";
Expand Down Expand Up @@ -129,10 +126,6 @@ public class TaskManagerConfiguration {
private String hostName;
private Integer httpPort;

@Deprecated private String jmxHostName;
@Deprecated private int jmxPort;
@Deprecated private int jmxConnectTimeout;

/**
* How often should node register itself in repository. In seconds.
*/
Expand Down Expand Up @@ -211,11 +204,6 @@ public class TaskManagerConfiguration {

private TaskExecutionLimitationsType taskExecutionLimitations;

private boolean useJmx;
// JMX credentials for connecting to remote nodes
@Deprecated private String jmxUsername;
@Deprecated private String jmxPassword;

// quartz jdbc job store specific information
private String sqlSchemaFile;
private String jdbcDriverDelegateClass;
Expand Down Expand Up @@ -268,9 +256,6 @@ public class TaskManagerConfiguration {
QUARTZ_CLUSTER_CHECKIN_INTERVAL_CONFIG_ENTRY, QUARTZ_CLUSTER_CHECKIN_GRACE_PERIOD_CONFIG_ENTRY,
NODE_REGISTRATION_INTERVAL_CONFIG_ENTRY,
NODE_TIMEOUT_CONFIG_ENTRY,
USE_JMX_CONFIG_ENTRY,
JMX_USERNAME_CONFIG_ENTRY,
JMX_PASSWORD_CONFIG_ENTRY,
TEST_MODE_CONFIG_ENTRY,
WAITING_TASKS_CHECK_INTERVAL_CONFIG_ENTRY,
STALLED_TASKS_CHECK_INTERVAL_CONFIG_ENTRY,
Expand Down Expand Up @@ -341,23 +326,10 @@ void setBasicInformation(MidpointConfiguration masterConfig, OperationResult res
nodeId = new NodeIdComputer(prismContext, repositoryService).determineNodeId(root, clustered, result);

hostName = root.getString(MidpointConfiguration.MIDPOINT_HOST_NAME_PROPERTY, null);
jmxHostName = root.getString(MidpointConfiguration.MIDPOINT_JMX_HOST_NAME_PROPERTY, null);

String jmxPortString = System.getProperty(JMX_PORT_PROPERTY);
if (StringUtils.isEmpty(jmxPortString)) {
jmxPort = JMX_PORT_DEFAULT;
} else {
try {
jmxPort = Integer.parseInt(jmxPortString);
} catch (NumberFormatException e) {
throw new TaskManagerConfigurationException("Cannot get JMX management port - invalid integer value of " + jmxPortString, e);
}
}
httpPort = root.getInteger(MidpointConfiguration.MIDPOINT_HTTP_PORT_PROPERTY, null);
url = root.getString(MidpointConfiguration.MIDPOINT_URL_PROPERTY, null);

jmxConnectTimeout = c.getInt(JMX_CONNECT_TIMEOUT_CONFIG_ENTRY, JMX_CONNECT_TIMEOUT_DEFAULT);

if (c.containsKey(TEST_MODE_CONFIG_ENTRY)) {
midPointTestMode = c.getBoolean(TEST_MODE_CONFIG_ENTRY);
LOGGER.trace(TEST_MODE_CONFIG_ENTRY + " present, its value = " + midPointTestMode);
Expand Down Expand Up @@ -392,10 +364,6 @@ void setBasicInformation(MidpointConfiguration masterConfig, OperationResult res

checkForTaskConcurrentExecution = c.getBoolean(CHECK_FOR_TASK_CONCURRENT_EXECUTION_CONFIG_ENTRY, CHECK_FOR_TASK_CONCURRENT_EXECUTION_DEFAULT);

useJmx = c.getBoolean(USE_JMX_CONFIG_ENTRY, USE_JMX_DEFAULT);
jmxUsername = c.getString(JMX_USERNAME_CONFIG_ENTRY, JMX_USERNAME_DEFAULT);
jmxPassword = c.getString(JMX_PASSWORD_CONFIG_ENTRY, JMX_PASSWORD_DEFAULT);

waitingTasksCheckInterval = c.getInt(WAITING_TASKS_CHECK_INTERVAL_CONFIG_ENTRY, WAITING_TASKS_CHECK_INTERVAL_DEFAULT);
stalledTasksCheckInterval = c.getInt(STALLED_TASKS_CHECK_INTERVAL_CONFIG_ENTRY, STALLED_TASKS_CHECK_INTERVAL_DEFAULT);
stalledTasksThreshold = c.getInt(STALLED_TASKS_THRESHOLD_CONFIG_ENTRY, STALLED_TASKS_THRESHOLD_DEFAULT);
Expand Down Expand Up @@ -594,10 +562,6 @@ public boolean isClustered() {
return Objects.requireNonNull(nodeId, "No node ID");
}

public int getJmxPort() {
return jmxPort;
}

public String getSqlSchemaFile() {
return sqlSchemaFile;
}
Expand Down Expand Up @@ -630,10 +594,6 @@ public UseThreadInterrupt getUseThreadInterrupt() {
return useThreadInterrupt;
}

public int getJmxConnectTimeout() {
return jmxConnectTimeout;
}

@SuppressWarnings("unused")
public boolean isStopOnInitializationFailure() {
return stopOnInitializationFailure;
Expand Down Expand Up @@ -692,22 +652,6 @@ public String getHostName() {
return hostName;
}

public boolean isUseJmx() {
return useJmx;
}

public String getJmxUsername() {
return jmxUsername;
}

public String getJmxPassword() {
return jmxPassword;
}

public String getJmxHostName() {
return jmxHostName;
}

public int getWaitingTasksCheckInterval() {
return waitingTasksCheckInterval;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.evolveum.midpoint.schema.result.OperationResultStatus;
import com.evolveum.midpoint.task.quartzimpl.TaskManagerConfiguration;
import com.evolveum.midpoint.task.quartzimpl.execution.LocalExecutionManager;
import com.evolveum.midpoint.task.quartzimpl.execution.remote.JmxConnector;
import com.evolveum.midpoint.task.quartzimpl.execution.remote.RestConnector;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.logging.LoggingUtils;
Expand All @@ -49,7 +48,6 @@ public class ClusterStatusInformationRetriever {
@Autowired private TaskManagerConfiguration configuration;
@Autowired private LocalExecutionManager localExecutionManager;
@Autowired private ClusterManager clusterManager;
@Autowired private JmxConnector jmxConnector;
@Autowired private RestConnector restConnector;

public ClusterStatusInformation getClusterStatusInformation(boolean clusterwide, boolean allowCached,
Expand Down Expand Up @@ -144,11 +142,7 @@ private void addNodeStatusFromRemoteNode(ClusterStatusInformation clusterInfo, P
clusterInfo.addNodeInfo(nodeBean);
result.recordStatus(OperationResultStatus.SUCCESS, "Node is not checking in");
} else {
if (configuration.isUseJmx()) {
jmxConnector.addNodeStatusUsingJmx(clusterInfo, nodeBean, result);
} else {
restConnector.addNodeStatus(clusterInfo, nodeBean, result);
}
restConnector.addNodeStatus(clusterInfo, nodeBean, result);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ private NodeType createLocalNodeObject(TaskManagerConfiguration configuration) {
node.setHostname(getMyHostname());
node.getIpAddress().addAll(getMyIpAddresses());
node.setUrlOverride(configuration.getUrl()); // overridden later (if already exists in repo)
node.setJmxPort(configuration.getJmxPort());
node.setClustered(configuration.isClustered());
node.setOperationalState(operationalStatus);
node.setLastCheckInTime(currentTime);
Expand Down Expand Up @@ -560,8 +559,6 @@ private void registerNodeError(NodeErrorStateType status, OperationResult result
private String getMyHostname() {
if (configuration.getHostName() != null) {
return configuration.getHostName();
} else if (configuration.getJmxHostName() != null) {
return configuration.getJmxHostName();
} else {
try {
String hostName = NetworkUtil.getLocalHostNameFromOperatingSystem();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.task.quartzimpl.TaskManagerConfiguration;
import com.evolveum.midpoint.task.quartzimpl.cluster.ClusterManager;
import com.evolveum.midpoint.task.quartzimpl.execution.remote.JmxConnector;
import com.evolveum.midpoint.task.quartzimpl.execution.remote.RestConnector;
import com.evolveum.midpoint.util.exception.ObjectNotFoundException;
import com.evolveum.midpoint.util.exception.SchemaException;
Expand Down Expand Up @@ -39,7 +38,6 @@ public class RemoteSchedulers {
public static final String CLASS_DOT = RemoteSchedulers.class.getName();

@Autowired private ClusterManager clusterManager;
@Autowired private JmxConnector jmxConnector;
@Autowired private RestConnector restConnector;
@Autowired private TaskManagerConfiguration configuration;

Expand All @@ -49,11 +47,7 @@ public void stopRemoteScheduler(String nodeIdentifier, OperationResult result) t
return; // result is already updated
}

if (configuration.isUseJmx()) {
jmxConnector.stopRemoteScheduler(node, result);
} else {
restConnector.stopRemoteScheduler(node, result);
}
restConnector.stopRemoteScheduler(node, result);
}

private NodeType getNode(String nodeIdentifier, OperationResult result) {
Expand All @@ -74,11 +68,7 @@ public void startRemoteScheduler(String nodeIdentifier, OperationResult parentRe
return; // result is already updated
}

if (configuration.isUseJmx()) {
jmxConnector.startRemoteScheduler(node, result);
} else {
restConnector.startRemoteScheduler(node, result);
}
restConnector.startRemoteScheduler(node, result);
} catch (Throwable t) {
result.recordFatalError("Couldn't start scheduler on remote node", t);
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't start scheduler on remote node: {}", t, nodeIdentifier);
Expand All @@ -95,11 +85,7 @@ void stopRemoteTaskRun(String oid, NodeType node, OperationResult parentResult)
result.addParam("node", node.toString());
try {
LOGGER.debug("Interrupting task {} running at {}", oid, clusterManager.dumpNodeInfo(node));
if (configuration.isUseJmx()) {
jmxConnector.stopRemoteTaskRun(oid, node, result);
} else {
restConnector.stopRemoteTaskRun(oid, node, result);
}
restConnector.stopRemoteTaskRun(oid, node, result);
} catch (Throwable t) {
result.recordFatalError("Couldn't stop task running on remote node", t);
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't stop task running on remote node: {}", t, oid);
Expand Down

0 comments on commit e630061

Please sign in to comment.