Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
Bug 833547 - make agent shutdown timeout configurable
Browse files Browse the repository at this point in the history
Takes the configuration from AgentConfiguration.
Created the defaults in AgentConfigurationConstants.
The configuration is taken from the entry: "rhq.agent.agent-update.exit-timeout-msecs".
  • Loading branch information
Josejulio Martínez Magaña authored and josejulio committed Jan 18, 2016
1 parent 86bbcd5 commit cb99af6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
Expand Up @@ -27,8 +27,6 @@
import java.util.prefs.BackingStoreException;
import java.util.prefs.Preferences;

import mazz.i18n.Logger;

import org.rhq.core.pc.PluginContainerConfiguration;
import org.rhq.core.util.obfuscation.ObfuscatedPreferences;
import org.rhq.enterprise.agent.i18n.AgentI18NFactory;
Expand All @@ -38,6 +36,8 @@
import org.rhq.enterprise.communications.command.client.PersistentFifo;
import org.rhq.enterprise.communications.util.SecurityUtil;

import mazz.i18n.Logger;

/**
* Just provides some convienence methods to extract agent configuration properties.
*
Expand Down Expand Up @@ -374,6 +374,11 @@ public String getAgentUpdateVersionUrlIfDefined() {
return str;
}

public long getAgentUpdateExitTimeout() {
return m_preferences.getLong(AgentConfigurationConstants.AGENT_UPDATE_EXIT_TIMEOUT_MSECS,
AgentConfigurationConstants.DEFAULT_AGENT_UPDATE_EXIT_TIMEOUT_MSECS);
}

/**
* This will return the URL that the agent should use when it needs to find out
* the version information of the latest agent update binary.
Expand Down
Expand Up @@ -161,6 +161,16 @@ public interface AgentConfigurationConstants {
*/
String AGENT_UPDATE_DOWNLOAD_URL = PROPERTY_NAME_PREFIX + "agent-update.download-url";

/**
* The amount of milliseconds the agent will wait before force closing after an update.
*/
String AGENT_UPDATE_EXIT_TIMEOUT_MSECS = PROPERTY_NAME_PREFIX + "agent-update.exit-timeout-msecs";

/**
* If the update-exit timeout is not defined, this is the default.
*/
long DEFAULT_AGENT_UPDATE_EXIT_TIMEOUT_MSECS = 1000L * 60 * 1;

/**
* The amount of milliseconds the agent will wait at startup for the server to be detected.
*/
Expand Down Expand Up @@ -818,4 +828,4 @@ public interface AgentConfigurationConstants {
*/
@Restricted
String COMMUNICATIONS_CONNECTOR_SECURITY_TRUSTSTORE_PASSWORD = "rhq.communications.connector.security.truststore.password";
}
}
Expand Up @@ -216,7 +216,7 @@ public void run() {

// We should only ever get here if everything was successful.
// We now need to exit the thread; and if everything goes according to plan, the VM will now exit
shutdownHook.spawnKillThread(1000L * 60 * 1); // pull the pin - FIRE IN THE HOLE!
shutdownHook.spawnKillThread(this.agent.getConfiguration().getAgentUpdateExitTimeout()); // pull the pin - FIRE IN THE HOLE!
return;
}

Expand Down

0 comments on commit cb99af6

Please sign in to comment.