[rhq] modules/enterprise
by Thomas Segismont
modules/enterprise/server/jar/intentional-api-changes-since-4.9.0.xml | 7 +++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java | 20 ++++++++--
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java | 4 --
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerRemote.java | 20 ++++++++--
4 files changed, 41 insertions(+), 10 deletions(-)
New commits:
commit 892db0b49e2c2d5a66df8e611535ea8c93939189
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Tue Nov 26 17:28:04 2013 +0100
Bug 963160 - CLI does not allow resource group plugin configuration update
diff --git a/modules/enterprise/server/jar/intentional-api-changes-since-4.9.0.xml b/modules/enterprise/server/jar/intentional-api-changes-since-4.9.0.xml
index e939753..c4a8e23 100644
--- a/modules/enterprise/server/jar/intentional-api-changes-since-4.9.0.xml
+++ b/modules/enterprise/server/jar/intentional-api-changes-since-4.9.0.xml
@@ -99,4 +99,11 @@
<justification>Adding a method to a remote API interface is safe.</justification>
</difference>
+ <difference>
+ <className>org/rhq/enterprise/server/configuration/ConfigurationManagerRemote</className>
+ <differenceType>7012</differenceType> <!-- method added to an interface -->
+ <method>int scheduleGroupPluginConfigurationUpdate(org.rhq.core.domain.auth.Subject, int, java.util.Map)</method>
+ <justification>Adding a method to a remote API interface is safe.</justification>
+ </difference>
+
</differences>
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 1e67101..a3fec04 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -16,6 +16,7 @@
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
+
package org.rhq.enterprise.server.configuration;
import java.util.ArrayList;
@@ -1782,7 +1783,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
@Override
public int scheduleGroupPluginConfigurationUpdate(Subject subject, int compatibleGroupId,
- Map<Integer, Configuration> memberPluginConfigurations) throws SchedulerException {
+ Map<Integer, Configuration> memberPluginConfigurations) {
if (memberPluginConfigurations == null) {
throw new IllegalArgumentException(
@@ -1801,7 +1802,14 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
* actually exists)
*/
GroupPluginConfigurationUpdate groupUpdate = new GroupPluginConfigurationUpdate(group, subject.getName());
- int updateId = configurationManager.createGroupConfigurationUpdate(groupUpdate);
+ int updateId = -1;
+ try {
+ updateId = configurationManager.createGroupConfigurationUpdate(groupUpdate);
+ } catch (SchedulerException sche) {
+ String message = "Error scheduling plugin configuration update for group[id=" + group.getId() + "]";
+ LOG.error(message, sche);
+ throw new ResourceGroupUpdateException(message + ": " + sche);
+ }
// Create and persist updates for each of the members.
for (Integer resourceId : memberPluginConfigurations.keySet()) {
@@ -1827,7 +1835,13 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
*/
JobDetail jobDetail = GroupPluginConfigurationUpdateJob.getJobDetail(group, subject, jobDataMap);
Trigger trigger = QuartzUtil.getFireOnceOffsetTrigger(jobDetail, 10000);
- scheduler.scheduleJob(jobDetail, trigger);
+ try {
+ scheduler.scheduleJob(jobDetail, trigger);
+ } catch (SchedulerException e) {
+ String message = "Error scheduling job named '" + jobDetail.getName() + "':";
+ LOG.error(message, e);
+ throw new ResourceGroupUpdateException(message + e.getMessage());
+ }
if (LOG.isDebugEnabled()) {
LOG.debug("Scheduled plugin configuration update against compatibleGroup[id=" + compatibleGroupId + "]");
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
index 7e8e8ef..4a2a852 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
@@ -16,6 +16,7 @@
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
+
package org.rhq.enterprise.server.configuration;
import java.util.List;
@@ -335,9 +336,6 @@ public interface ConfigurationManagerLocal extends ConfigurationManagerRemote {
int createGroupConfigurationUpdate(AbstractGroupConfigurationUpdate update) throws SchedulerException;
- int scheduleGroupPluginConfigurationUpdate(Subject subject, int compatibleGroupId,
- Map<Integer, Configuration> pluginConfigurationUpdate) throws SchedulerException;
-
PageList<GroupPluginConfigurationUpdate> findGroupPluginConfigurationUpdates(int groupId, PageControl pc);
PageList<GroupResourceConfigurationUpdate> findGroupResourceConfigurationUpdates(Subject subject, int groupId,
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerRemote.java
index 697f15c..d58b92f 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerRemote.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2013 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -13,9 +13,10 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
+
package org.rhq.enterprise.server.configuration;
import java.util.Map;
@@ -131,6 +132,17 @@ public interface ConfigurationManagerRemote {
boolean isGroupResourceConfigurationUpdateInProgress(Subject subject, int resourceGroupId);
/**
+ * Schedules jobs to update the plugin configuration of resources in a compatible group.
+ *
+ * @param subject logged in user
+ * @param compatibleGroupId the compatible group id
+ * @param pluginConfigurationUpdate {@link Configuration} objects mapped by resource id
+ * @return the {@link GroupPluginConfigurationUpdate} id
+ */
+ int scheduleGroupPluginConfigurationUpdate(Subject subject, int compatibleGroupId,
+ Map<Integer, Configuration> pluginConfigurationUpdate);
+
+ /**
* @param subject
* @param compatibleGroupId
* @param newResourceConfigurationMap
@@ -249,4 +261,4 @@ public interface ConfigurationManagerRemote {
@Deprecated
Configuration translateResourceConfiguration(Subject subject, int resourceId, Configuration configuration,
boolean fromStructured) throws ResourceNotFoundException;
-}
\ No newline at end of file
+}
10 years, 5 months
[rhq] Branch 'bug/949065' - modules/plugins
by Thomas Segismont
modules/plugins/cassandra/src/test/java/org/rhq/plugins/cassandra/itest/DiscoveryAndConfigurationTest.java | 1 +
1 file changed, 1 insertion(+)
New commits:
commit 14655514ebc3613503e94aefdd10b6a37876c8eb
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Tue Nov 26 14:52:23 2013 +0100
Re: Fixed weird problem: missing end of class bracket
diff --git a/modules/plugins/cassandra/src/test/java/org/rhq/plugins/cassandra/itest/DiscoveryAndConfigurationTest.java b/modules/plugins/cassandra/src/test/java/org/rhq/plugins/cassandra/itest/DiscoveryAndConfigurationTest.java
index ad39cb2..f0d5cb9 100644
--- a/modules/plugins/cassandra/src/test/java/org/rhq/plugins/cassandra/itest/DiscoveryAndConfigurationTest.java
+++ b/modules/plugins/cassandra/src/test/java/org/rhq/plugins/cassandra/itest/DiscoveryAndConfigurationTest.java
@@ -270,3 +270,4 @@ public class DiscoveryAndConfigurationTest {
return foundResources;
}
+}
10 years, 5 months
[rhq] Branch 'bug/949065' - modules/core
by Thomas Segismont
modules/core/plugin-container/src/main/java/org/rhq/core/pc/ContainerService.java | 4 ++--
modules/core/plugin-container/src/main/java/org/rhq/core/pc/agent/AgentService.java | 4 ++--
modules/core/plugin-container/src/main/java/org/rhq/core/pc/content/ContentContextImpl.java | 3 ++-
modules/core/plugin-container/src/main/java/org/rhq/core/pc/content/CreateContentRunner.java | 4 ++--
modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java | 1 +
modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginComponentFactory.java | 2 +-
6 files changed, 10 insertions(+), 8 deletions(-)
New commits:
commit 370d7afe8caa15b9db2bf830badea9cd23088ffa
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Tue Nov 26 14:21:25 2013 +0100
Fixed weird problem: missing end of class bracket
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/ContainerService.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/ContainerService.java
index 62bb6a0..f8de165 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/ContainerService.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/ContainerService.java
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- */ package org.rhq.core.pc;
+ */ package org.rhq.core.pc;
/**
* An interface that all plugin container services and managers will implement.
@@ -30,4 +30,4 @@ public interface ContainerService {
* Stops the container service which effectively releases all runtime resources such as running threads.
*/
void shutdown();
-
+}
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/agent/AgentService.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/agent/AgentService.java
index aa7c1c4..bfd5785 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/agent/AgentService.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/agent/AgentService.java
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- */ package org.rhq.core.pc.agent;
+ */ package org.rhq.core.pc.agent;
import java.io.InputStream;
import java.io.OutputStream;
@@ -97,4 +97,4 @@ public abstract class AgentService {
protected AgentServiceStreamRemoter getStreamRemoter() {
return streamRemoter;
}
-
+}
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/content/ContentContextImpl.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/content/ContentContextImpl.java
index f5190ab..20ad794 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/content/ContentContextImpl.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/content/ContentContextImpl.java
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- */ package org.rhq.core.pc.content;
+ */ package org.rhq.core.pc.content;
import org.rhq.core.pc.PluginContainer;
import org.rhq.core.pluginapi.content.ContentContext;
@@ -49,3 +49,4 @@ public class ContentContextImpl implements ContentContext {
public ContentServices getContentServices() {
return contentServices;
}
+}
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/content/CreateContentRunner.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/content/CreateContentRunner.java
index 7643ffb..d3870f3 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/content/CreateContentRunner.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/content/CreateContentRunner.java
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- */ package org.rhq.core.pc.content;
+ */ package org.rhq.core.pc.content;
import java.util.HashSet;
import java.util.Set;
@@ -157,4 +157,4 @@ public class CreateContentRunner implements Runnable, Callable<DeployPackagesRes
return execute;
}
-
+}
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
index 6cf03ae..770e29f 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
@@ -783,4 +783,5 @@ public class DriftManager extends AgentService implements DriftAgentService, Dri
public InventoryManager getInventoryManager() {
return inventoryManager;
}
+}
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginComponentFactory.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginComponentFactory.java
index 92b0233..cc0fb17 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginComponentFactory.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/plugin/PluginComponentFactory.java
@@ -311,4 +311,4 @@ public class PluginComponentFactory implements ContainerService {
*/
public void shutdown() {
}
-
+}
10 years, 5 months
[rhq] modules/enterprise
by Thomas Segismont
modules/enterprise/remoting/cli/src/etc/rhq-cli.bat | 11 +
modules/enterprise/remoting/cli/src/etc/rhq-cli.sh | 5
modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/ClientMain.java | 56 +++++-----
modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/commands/ScriptCommand.java | 35 +++---
4 files changed, 68 insertions(+), 39 deletions(-)
New commits:
commit 204ff60c26d8a5cb48599d10b7c8b209f6e9b0c8
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Tue Nov 26 12:09:18 2013 +0100
Bug 1033520 - CLI returns exit code 0 even when an error occurs
In non interactive mode, exit code is 1 if :
* an error occurs while executing a command or a script
* login failed
* script file does not exist
diff --git a/modules/enterprise/remoting/cli/src/etc/rhq-cli.bat b/modules/enterprise/remoting/cli/src/etc/rhq-cli.bat
index 96d59bc..8c96ed7 100644
--- a/modules/enterprise/remoting/cli/src/etc/rhq-cli.bat
+++ b/modules/enterprise/remoting/cli/src/etc/rhq-cli.bat
@@ -160,6 +160,7 @@ if defined RHQ_CLI_DEBUG (
echo %CMD%
)
cmd.exe /S /C "%CMD%"
+if ERRORLEVEL 1 goto :error
goto :done
@@ -186,3 +187,13 @@ if defined RHQ_CLI_DEBUG echo %0 done.
endlocal
exit /B 0
+
+rem ----------------------------------------------------------------------
+rem CALL subroutine that exits this script with error
+rem ----------------------------------------------------------------------
+
+:error
+if defined RHQ_CLI_DEBUG echo %0 done.
+endlocal
+
+if ERRORLEVEL 1 exit /B 1
diff --git a/modules/enterprise/remoting/cli/src/etc/rhq-cli.sh b/modules/enterprise/remoting/cli/src/etc/rhq-cli.sh
index 93cf679..9fce451 100644
--- a/modules/enterprise/remoting/cli/src/etc/rhq-cli.sh
+++ b/modules/enterprise/remoting/cli/src/etc/rhq-cli.sh
@@ -189,12 +189,17 @@ fi
# would be already expanded and we'd therefore loose the ability to pass in
# quoted args.
debug_msg "Executing the CLI with this command line:"
+exit_code=0
if [ -z "$RHQ_CLI_CMDLINE_OPTS" ]; then
debug_msg "${RHQ_CLI_JAVA_EXE_FILE_PATH} ${_JAVA_ENDORSED_DIRS_OPT} ${_JAVA_LIBRARY_PATH_OPT} ${RHQ_CLI_JAVA_OPTS} ${RHQ_CLI_ADDITIONAL_JAVA_OPTS} ${_LOG_CONFIG} -cp ${CLASSPATH} org.rhq.enterprise.client.ClientMain $@"
"${RHQ_CLI_JAVA_EXE_FILE_PATH}" ${_JAVA_ENDORSED_DIRS_OPT} ${_JAVA_LIBRARY_PATH_OPT} ${RHQ_CLI_JAVA_OPTS} ${RHQ_CLI_ADDITIONAL_JAVA_OPTS} ${_LOG_CONFIG} -cp "${CLASSPATH}" org.rhq.enterprise.client.ClientMain "$@"
+ exit_code=$?
+
else
debug_msg "${RHQ_CLI_JAVA_EXE_FILE_PATH} ${_JAVA_ENDORSED_DIRS_OPT} ${_JAVA_LIBRARY_PATH_OPT} ${RHQ_CLI_JAVA_OPTS} ${RHQ_CLI_ADDITIONAL_JAVA_OPTS} ${_LOG_CONFIG} -cp ${CLASSPATH} org.rhq.enterprise.client.ClientMain ${RHQ_CLI_CMDLINE_OPTS}"
"${RHQ_CLI_JAVA_EXE_FILE_PATH}" ${_JAVA_ENDORSED_DIRS_OPT} ${_JAVA_LIBRARY_PATH_OPT} ${RHQ_CLI_JAVA_OPTS} ${RHQ_CLI_ADDITIONAL_JAVA_OPTS} ${_LOG_CONFIG} -cp "${CLASSPATH}" org.rhq.enterprise.client.ClientMain ${RHQ_CLI_CMDLINE_OPTS}
+ exit_code=$?
fi
debug_msg "$0 done."
+exit ${exit_code}
diff --git a/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/ClientMain.java b/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/ClientMain.java
index 3194108..0bcb7d9 100644
--- a/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/ClientMain.java
+++ b/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/ClientMain.java
@@ -1,29 +1,23 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2012 Red Hat, Inc.
+ * Copyright (C) 2005-2013 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation, and/or the GNU Lesser
- * General Public License, version 2.1, also as published by the Free
- * Software Foundation.
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License and the GNU Lesser General Public License
- * for more details.
+ * GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * and the GNU Lesser General Public License along with this program;
- * if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
-package org.rhq.enterprise.client;
-import gnu.getopt.Getopt;
-import gnu.getopt.LongOpt;
+package org.rhq.enterprise.client;
import java.io.ByteArrayInputStream;
import java.io.File;
@@ -46,6 +40,8 @@ import jline.ConsoleReader;
import jline.MultiCompletor;
import jline.SimpleCompletor;
import mazz.i18n.Msg;
+import gnu.getopt.Getopt;
+import gnu.getopt.LongOpt;
import org.rhq.bindings.ScriptEngineFactory;
import org.rhq.bindings.util.PackageFinder;
@@ -149,7 +145,11 @@ public class ClientMain {
loginCmd.execute(ClientMain.this, new String[] { "login", getUser(), getPass() });
}
if (!loggedIn()) {
- return;
+ if (isInteractiveMode()) {
+ return;
+ } else {
+ System.exit(1);
+ }
}
}
@@ -158,27 +158,31 @@ public class ClientMain {
}
}
}
-
- // Entrance to main.
- public static void main(String[] args) throws Exception {
- initCommands();
- // instantiate
- ClientMain main = new ClientMain();
+ public static void main(String[] args) {
+ initCommands();
+ try {
+ new ClientMain().run(args);
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+ private void run(String[] args) throws Exception {
// capture startup arguments and setup the properties
//from them
- StartupConfiguration config = main.processArguments(args);
+ StartupConfiguration config = processArguments(args);
//initialize the CLI
- main.initialize();
-
+ initialize();
+
//process the arguments now that we are initialized
config.process();
-
- if (main.isInteractiveMode()) {
+
+ if (isInteractiveMode()) {
// begin client access loop
- main.inputLoop();
+ inputLoop();
}
}
diff --git a/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/commands/ScriptCommand.java b/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/commands/ScriptCommand.java
index 42137af..0dd1d31 100644
--- a/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/commands/ScriptCommand.java
+++ b/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/commands/ScriptCommand.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2013 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -13,9 +13,10 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
+
package org.rhq.enterprise.client.commands;
import java.io.File;
@@ -97,9 +98,13 @@ public class ScriptCommand implements ClientCommand {
}
}
} catch (FileNotFoundException e) {
- client.getPrintWriter().println(e.getMessage());
- if (log.isDebugEnabled()) {
- log.debug("Unable to locate script file: " + e.getMessage());
+ if (client.isInteractiveMode()) {
+ client.getPrintWriter().println(e.getMessage());
+ if (log.isDebugEnabled()) {
+ log.debug("Unable to locate script file: " + e.getMessage());
+ }
+ } else {
+ throw new CLIScriptException(e);
}
} catch (CommandLineParseException e) {
if (client.isInteractiveMode()) {
@@ -151,16 +156,20 @@ public class ScriptCommand implements ClientCommand {
}
} catch (ScriptException e) {
+ if (client.isInteractiveMode()) {
String message = client.getUsefulErrorMessage(e);
- client.getPrintWriter().println(message);
- client.getPrintWriter().println(script);
- for (int i = 0; i < e.getColumnNumber(); i++) {
- client.getPrintWriter().print(" ");
+ client.getPrintWriter().println(message);
+ client.getPrintWriter().println(script);
+ for (int i = 0; i < e.getColumnNumber(); i++) {
+ client.getPrintWriter().print(" ");
+ }
+ client.getPrintWriter().println("^");
+ script = new StringBuilder();
+ inMultilineScript = false;
+ } else {
+ throw new CLIScriptException(e);
}
- client.getPrintWriter().println("^");
- script = new StringBuilder();
- inMultilineScript = false;
}
client.getPrintWriter().println();
return true;
10 years, 5 months
[rhq] modules/enterprise
by Simeon Pinder
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 6ee0b027fd8d7a44da2a5d0426885af018cdc769
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Nov 26 00:36:08 2013 -0500
[BZ 1034236] fix problem with ldap ssl configuration parsing.
- this is fallout from a global property change/deprecation that happened
months back and we missed one property being chnaged from String to boolean.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java
index 2d71ae3..2fc875d 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java
@@ -641,7 +641,7 @@ SystemSetting.LDAP_GROUP_QUERY_PAGE_SIZE.name(), ""
// Setup SSL if requested
String value = properties.getProperty(SystemSetting.USE_SSL_FOR_LDAP.name());
- boolean ldapSsl = "ssl".equalsIgnoreCase(value);
+ boolean ldapSsl = "ssl".equalsIgnoreCase(value) || "true".equalsIgnoreCase(value);
if (ldapSsl) {
String ldapSocketFactory = properties.getProperty("java.naming.ldap.factory.socket");
if (ldapSocketFactory == null) {
10 years, 5 months
[rhq] Branch 'release/jon3.2.x' - modules/enterprise
by Simeon Pinder
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit e5887ddb552e80b548331bc5e02c31dfdedc0211
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Nov 26 00:36:08 2013 -0500
[BZ 1034236] fix problem with ldap ssl configuration parsing.
- this is fallout from a global property change/deprecation that happened
months back and we missed one property being chnaged from String to boolean.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java
index 2d71ae3..2fc875d 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java
@@ -641,7 +641,7 @@ SystemSetting.LDAP_GROUP_QUERY_PAGE_SIZE.name(), ""
// Setup SSL if requested
String value = properties.getProperty(SystemSetting.USE_SSL_FOR_LDAP.name());
- boolean ldapSsl = "ssl".equalsIgnoreCase(value);
+ boolean ldapSsl = "ssl".equalsIgnoreCase(value) || "true".equalsIgnoreCase(value);
if (ldapSsl) {
String ldapSocketFactory = properties.getProperty("java.naming.ldap.factory.socket");
if (ldapSocketFactory == null) {
10 years, 5 months
[rhq] Changes to 'mtho11/group-metrics'
by mike thompson
New branch 'mtho11/group-metrics' available with the following commits:
commit 5e96411d02497e2bcc20d1ea7106dec3610c0d8f
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Mon Nov 25 19:01:44 2013 -0800
[BZ 1034512] Update Group Metric Graphs to be more like new Resource Metrics Graphs.
10 years, 5 months
[rhq] Branch 'jay-avail' - modules/core modules/enterprise modules/plugins
by mazz
modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java | 2
modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainerConfiguration.java | 27 ++++++++--
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/ResourceContainer.java | 22 ++------
modules/core/plugin-container/src/test/java/org/rhq/core/pc/inventory/ResourceContainerTest.java | 2
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfiguration.java | 6 ++
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfigurationConstants.java | 19 +++++--
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentSetupInstructions.java | 9 +++
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/SetupPromptCommand.java | 7 ++
modules/enterprise/agent/src/main/resources/agent-configuration.xml | 11 ++++
modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml | 1
10 files changed, 81 insertions(+), 25 deletions(-)
New commits:
commit ac1cfd0bf919df79b64848d651f7df31cf214019
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Nov 25 17:34:07 2013 -0500
part of BZ 971556 - this adds avail scan threadpool setting to agent prefs
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
index 17b1309..a6ff34a 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
@@ -307,7 +307,7 @@ public class PluginContainer {
mbean.register();
}
- ResourceContainer.initialize();
+ ResourceContainer.initialize(configuration);
pluginManager = new PluginManager();
pluginComponentFactory = new PluginComponentFactory();
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainerConfiguration.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainerConfiguration.java
index 22f8150..36ba906 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainerConfiguration.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainerConfiguration.java
@@ -55,7 +55,7 @@ public class PluginContainerConfiguration {
public static final boolean WAIT_FOR_SHUTDOWN_SERVICE_TERMINATION_DEFAULT = true;
private static final String SHUTDOWN_SERVICE_TERMINATION_TIMEOUT = PROP_PREFIX + "shutdown-service-termination-timeout";
public static final long SHUTDOWN_SERVICE_TERMINATION_TIMEOUT_DEFAULT = 5 * 60L; // in seconds
-
+
// The following configuration settings have hardcoded default values. These defaults are publicly
// accessible so the entity that embeds the plugin container can know what its default values are.
@@ -85,6 +85,8 @@ public class PluginContainerConfiguration {
private static final String AVAILABILITY_SCAN_PERIOD_PROP = PROP_PREFIX + "availability-scan-period";
// in seconds, should be the shortest avail collection interval allowed
public static final long AVAILABILITY_SCAN_PERIOD_DEFAULT = 30L;
+ public static final String AVAILABILITY_SCAN_THREADPOOL_SIZE_PROP = "availability-scan-threadpool-size";
+ public static final int AVAILABILITY_SCAN_THREADPOOL_SIZE_DEFAULT = 100;
// Measurement ----------
@@ -347,10 +349,10 @@ public class PluginContainerConfiguration {
return ((Boolean)val).booleanValue();
}
}
-
+
/**
* Sets the flag to indicate whether to start the management bean of the plugin container or not.
- *
+ *
* @see #isStartManagementBean()
* @param value
*/
@@ -440,6 +442,25 @@ public class PluginContainerConfiguration {
}
/**
+ * Returns the number of concurrent threads that can be scanning resource availabilities.
+ *
+ * @return threadpool size used for thread pool that scans availabilities
+ */
+ public int getAvailabilityScanThreadPoolSize() {
+ Integer size = (Integer) configuration.get(AVAILABILITY_SCAN_THREADPOOL_SIZE_PROP);
+ return (size == null) ? AVAILABILITY_SCAN_THREADPOOL_SIZE_DEFAULT : size.intValue();
+ }
+
+ /**
+ * Sets the number of concurrent threads that can be scanning resource availabilities.
+ *
+ * @param size threadpool size used for thread pool that scans availabilities
+ */
+ public void setAvailabilityScanThreadPoolSize(int size) {
+ configuration.put(AVAILABILITY_SCAN_THREADPOOL_SIZE_PROP, Integer.valueOf(size));
+ }
+
+ /**
* Returns the length of time, in seconds, before measurements begin getting collected.
*
* @return number of seconds
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/ResourceContainer.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/ResourceContainer.java
index f81e7ca..aadd71d 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/ResourceContainer.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/ResourceContainer.java
@@ -53,6 +53,7 @@ import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.measurement.MeasurementSchedule;
import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.pc.PluginContainerConfiguration;
import org.rhq.core.pc.component.ComponentInvocationContextImpl;
import org.rhq.core.pc.component.ComponentInvocationContextImpl.LocalContext;
import org.rhq.core.pc.util.FacetLockType;
@@ -88,7 +89,6 @@ public class ResourceContainer implements Serializable {
private static final String AVAIL_CHECK_THREAD_POOL_NAME = "ResourceContainer.invoker.availCheck.daemon";
private static ExecutorService DAEMON_THREAD_POOL;
private static ExecutorService NON_DAEMON_THREAD_POOL;
- private static ExecutorService AVAIL_CHECK_THREAD_POOL;
/**
* This thread pool protects us from generating a potentially huge number of threads on slow running
@@ -98,18 +98,7 @@ public class ResourceContainer implements Serializable {
* where N is the number of resources managed by the agent (because that type of pool can grow unbounded).
* Instead, limit the max # of threads and fall back to synchronous checking when overloaded.
*/
- private static final int AVAIL_CHECK_THREAD_POOL_SIZE;
-
- static {
- int availCheckThreadPoolSize;
- try {
- availCheckThreadPoolSize = Integer.parseInt(System.getProperty(
- "rhq.agent.plugins.availability-scan.threadpool-size", "100"));
- } catch (Throwable t) {
- availCheckThreadPoolSize = 100;
- }
- AVAIL_CHECK_THREAD_POOL_SIZE = availCheckThreadPoolSize;
- }
+ private static ExecutorService AVAIL_CHECK_THREAD_POOL;
// non-transient fields
private final Resource resource;
@@ -134,14 +123,17 @@ public class ResourceContainer implements Serializable {
/**
* Initialize the ResourceContainer's internals, such as its thread pools.
+ *
+ * @param configuration the plugin container's configuration
*/
- public static void initialize() {
+ public static void initialize(PluginContainerConfiguration pcConfig) {
LoggingThreadFactory daemonFactory = new LoggingThreadFactory(DAEMON_THREAD_POOL_NAME, true);
LoggingThreadFactory nonDaemonFactory = new LoggingThreadFactory(NON_DAEMON_THREAD_POOL_NAME, false);
LoggingThreadFactory availCheckFactory = new LoggingThreadFactory(AVAIL_CHECK_THREAD_POOL_NAME, true);
DAEMON_THREAD_POOL = Executors.newCachedThreadPool(daemonFactory);
NON_DAEMON_THREAD_POOL = Executors.newCachedThreadPool(nonDaemonFactory);
- AVAIL_CHECK_THREAD_POOL = Executors.newFixedThreadPool(AVAIL_CHECK_THREAD_POOL_SIZE, availCheckFactory);
+ AVAIL_CHECK_THREAD_POOL = Executors.newFixedThreadPool(pcConfig.getAvailabilityScanThreadPoolSize(),
+ availCheckFactory);
}
/**
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/inventory/ResourceContainerTest.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/inventory/ResourceContainerTest.java
index 58446d0..c9cc490 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/inventory/ResourceContainerTest.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/inventory/ResourceContainerTest.java
@@ -64,12 +64,10 @@ public class ResourceContainerTest {
PluginContainer pc = PluginContainer.getInstance();
pc.setConfiguration(config);
pc.initialize();
- ResourceContainer.initialize();
}
@AfterClass
public void afterClass() {
- ResourceContainer.shutdown();
PluginContainer.getInstance().shutdown();
}
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfiguration.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfiguration.java
index 939457a..34f669b 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfiguration.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfiguration.java
@@ -1143,6 +1143,11 @@ public class AgentConfiguration {
AgentConfigurationConstants.PLUGINS_AVAILABILITY_SCAN_INITIAL_DELAY,
AgentConfigurationConstants.DEFAULT_PLUGINS_AVAILABILITY_SCAN_INITIAL_DELAY);
+ // get the avail thread pool size
+ int avail_scan_threadpool_size = m_preferences.getInt(
+ AgentConfigurationConstants.PLUGINS_AVAILABILITY_SCAN_THREADPOOL_SIZE,
+ AgentConfigurationConstants.DEFAULT_PLUGINS_AVAILABILITY_SCAN_THREADPOOL_SIZE);
+
// get the initial delay before measurement collections begin
long meas_scan_initial_delay = m_preferences.getLong(
AgentConfigurationConstants.PLUGINS_MEASUREMENT_COLLECTION_INITIAL_DELAY,
@@ -1250,6 +1255,7 @@ public class AgentConfiguration {
config.setChildResourceDiscoveryDelay(childResourceDiscoveryDelay);
config.setAvailabilityScanInitialDelay(avail_scan_initial_delay);
config.setAvailabilityScanPeriod(avail_scan_period);
+ config.setAvailabilityScanThreadPoolSize(avail_scan_threadpool_size);
config.setMeasurementCollectionThreadPoolSize(meas_threadpool_size);
config.setMeasurementCollectionInitialDelay(meas_scan_initial_delay);
config.setDriftDetectionInitialDelay(drift_initial_delay);
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfigurationConstants.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfigurationConstants.java
index 000fdc0..96a71a9 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfigurationConstants.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentConfigurationConstants.java
@@ -151,12 +151,12 @@ public interface AgentConfigurationConstants {
boolean DEFAULT_AGENT_UPDATE_ENABLED = true;
/**
- * If this preference is defined (its default is null), this will be the URL that contains the agent update version info.
+ * If this preference is defined (its default is null), this will be the URL that contains the agent update version info.
*/
String AGENT_UPDATE_VERSION_URL = PROPERTY_NAME_PREFIX + "agent-update.version-url";
/**
- * If this preference is defined (its default is null), this will be the URL the agent downloads the agent update from.
+ * If this preference is defined (its default is null), this will be the URL the agent downloads the agent update from.
*/
String AGENT_UPDATE_DOWNLOAD_URL = PROPERTY_NAME_PREFIX + "agent-update.download-url";
@@ -541,12 +541,12 @@ public interface AgentConfigurationConstants {
String DEFAULT_PLUGINS_DIRECTORY = "plugins";
/**
- * The regular expression to indicate what agent/plugin container classes the plugins cannot access.
+ * The regular expression to indicate what agent/plugin container classes the plugins cannot access.
*/
String PLUGINS_ROOT_PLUGIN_CLASSLOADER_REGEX = PROPERTY_NAME_PREFIX + "plugins.root-plugin-classloader-regex";
/**
- * The comma separated list of names of plugins that are to be disabled at startup
+ * The comma separated list of names of plugins that are to be disabled at startup
*/
String PLUGINS_DISABLED = PROPERTY_NAME_PREFIX + "plugins.disabled";
@@ -630,6 +630,17 @@ public interface AgentConfigurationConstants {
long DEFAULT_PLUGINS_AVAILABILITY_SCAN_PERIOD = PluginContainerConfiguration.AVAILABILITY_SCAN_PERIOD_DEFAULT;
/**
+ * Defines how many threads can be concurrently scanning for resource availabilities.
+ */
+ String PLUGINS_AVAILABILITY_SCAN_THREADPOOL_SIZE = PROPERTY_NAME_PREFIX
+ + "plugins.availability-scan.threadpool-size";
+
+ /**
+ * The default threadpool size for availability scanning.
+ */
+ int DEFAULT_PLUGINS_AVAILABILITY_SCAN_THREADPOOL_SIZE = PluginContainerConfiguration.AVAILABILITY_SCAN_THREADPOOL_SIZE_DEFAULT;
+
+ /**
* If defined, this is to be the size of the measurement collection thread pool. If not defined, the plugin
* container should default to something it considers appropriate.
*/
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentSetupInstructions.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentSetupInstructions.java
index ece2c4f..9044c79 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentSetupInstructions.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentSetupInstructions.java
@@ -709,6 +709,15 @@ public interface AgentSetupInstructions {
@I18NMessages( { @I18NMessage("The time in seconds before the initial availability scan is performed.") })
String SETUP_INSTRUCTION_PLUGINSAVAILSCANINITIALDELAY_HELP = "PromptCommand.setup.instruction.plugins.avail-scan-initialdelay.help";
+ // PLUGINS AVAILABILITY SCAN THREAD POOL SIZE
+ String SETUP_INSTRUCTION_PLUGINSAVAILSCANTHREADPOOLSIZE_PREF = AgentConfigurationConstants.PLUGINS_AVAILABILITY_SCAN_THREADPOOL_SIZE;
+ String SETUP_INSTRUCTION_PLUGINSAVAILSCANTHREADPOOLSIZE_DEFAULT = Integer
+ .toString(AgentConfigurationConstants.DEFAULT_PLUGINS_AVAILABILITY_SCAN_THREADPOOL_SIZE);
+ @I18NMessages({ @I18NMessage("Availability Scan ThreadPool Size") })
+ String SETUP_INSTRUCTION_PLUGINSAVAILSCANTHREADPOOLSIZE_PROMPT = "PromptCommand.setup.instruction.plugins.avail-scan-threadpoolsize.prompt";
+ @I18NMessages({ @I18NMessage("The number of threads that can concurrently scan resource availabilities.") })
+ String SETUP_INSTRUCTION_PLUGINSAVAILSCANTHREADPOOLSIZE_HELP = "PromptCommand.setup.instruction.plugins.avail-scan-threadpoolsize.help";
+
// PLUGINS MEASUREMENT COLLECTION INITIAL DELAY
String SETUP_INSTRUCTION_PLUGINSMEASUREMENTCOLLINITIALDELAY_PREF = AgentConfigurationConstants.PLUGINS_MEASUREMENT_COLLECTION_INITIAL_DELAY;
String SETUP_INSTRUCTION_PLUGINSMEASUREMENTCOLLINITIALDELAY_DEFAULT = Long
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/SetupPromptCommand.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/SetupPromptCommand.java
index d2de209..e97e0cc 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/SetupPromptCommand.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/SetupPromptCommand.java
@@ -577,6 +577,13 @@ public class SetupPromptCommand implements AgentPromptCommand {
.getMsg(AgentSetupInstructions.SETUP_INSTRUCTION_PLUGINSAVAILSCANINITIALDELAY_HELP)));
instr.add(new DefaultSetupInstruction(
+ AgentSetupInstructions.SETUP_INSTRUCTION_PLUGINSAVAILSCANTHREADPOOLSIZE_PREF,
+ AgentSetupInstructions.SETUP_INSTRUCTION_PLUGINSAVAILSCANTHREADPOOLSIZE_DEFAULT,
+ new IntegerSetupValidityChecker(1, null), SETUPMSG
+ .getMsg(AgentSetupInstructions.SETUP_INSTRUCTION_PLUGINSAVAILSCANTHREADPOOLSIZE_PROMPT), SETUPMSG
+ .getMsg(AgentSetupInstructions.SETUP_INSTRUCTION_PLUGINSAVAILSCANTHREADPOOLSIZE_HELP)));
+
+ instr.add(new DefaultSetupInstruction(
AgentSetupInstructions.SETUP_INSTRUCTION_PLUGINSMEASUREMENTCOLLINITIALDELAY_PREF,
AgentSetupInstructions.SETUP_INSTRUCTION_PLUGINSMEASUREMENTCOLLINITIALDELAY_DEFAULT,
new LongSetupValidityChecker(1L, null), SETUPMSG
diff --git a/modules/enterprise/agent/src/main/resources/agent-configuration.xml b/modules/enterprise/agent/src/main/resources/agent-configuration.xml
index 9f46f62..ce27dde 100644
--- a/modules/enterprise/agent/src/main/resources/agent-configuration.xml
+++ b/modules/enterprise/agent/src/main/resources/agent-configuration.xml
@@ -654,6 +654,17 @@ commands named "config", "setconfig" and "setup" and the command line options
<!--
_______________________________________________________________
+ rhq.agent.plugins.availability-scan.threadpool-size
+
+ The number of threads that can be concurrently scanning
+ resource availabilities.
+ -->
+ <!--
+ <entry key="rhq.agent.plugins.availability-scan.threadpool-size" value="100"/>
+ -->
+
+ <!--
+ _______________________________________________________________
rhq.agent.plugins.measurement-collection.threadpool-size
When measurement's are scheduled for collection, the collection
diff --git a/modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml
index a544775..641fbee 100644
--- a/modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/rhq-agent/src/main/resources/META-INF/rhq-plugin.xml
@@ -315,6 +315,7 @@
<c:simple-property name="rhq.agent.plugins.service-discovery.period-secs" type="integer" units="seconds" activationPolicy="restart" required="false" default="86400" displayName="Service Discovery Period" description="Time between service discoveries (in seconds)" />
<c:simple-property name="rhq.agent.plugins.availability-scan.initial-delay-secs" type="integer" units="seconds" activationPolicy="restart" required="false" default="30" displayName="Availability Scan Initial Delay" description="Startup delay before the first availability scan is run (in seconds)" />
<c:simple-property name="rhq.agent.plugins.availability-scan.period-secs" type="integer" units="seconds" activationPolicy="restart" required="false" default="300" displayName="Availability Scan Period" description="Time between availability scans (in seconds)" />
+ <c:simple-property name="rhq.agent.plugins.availability-scan.threadpool-size" type="integer" activationPolicy="restart" required="false" default="100" displayName="Availability Scan ThreadPool Size" description="Number of concurrent threads that scan for resource availabilities" />
<c:simple-property name="rhq.agent.plugins.measurement-collection.initial-delay-secs" type="integer" units="seconds" activationPolicy="restart" required="false" default="30" displayName="Measurement Collection Initial Delay" description="Startup delay before the first measurement collection is run (in seconds)" />
<c:simple-property name="rhq.agent.plugins.measurement-collection.threadpool-size" type="integer" activationPolicy="restart" required="false" default="5" displayName="Measurement Collection Threadpool Size" description="Number of concurrent measurement collections that can be run" />
<c:simple-property name="rhq.agent.plugins.drift-detection.initial-delay-secs" type="integer" units="seconds" activationPolicy="restart" required="false" default="30" displayName="Drift Detection Initial Delay" description="Startup delay before the first drift detection scan is run (in seconds)" />
10 years, 5 months
[rhq] Branch 'jay-avail' - modules/core
by Jay Shaughnessy
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/ResourceContainer.java | 15 ++++------
1 file changed, 6 insertions(+), 9 deletions(-)
New commits:
commit f387ddc361cd525680a0253ab84618dac2d34700
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Nov 25 15:20:07 2013 -0500
Fix jdoc for new avail thread pool
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/ResourceContainer.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/ResourceContainer.java
index af418ad..f81e7ca 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/ResourceContainer.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/ResourceContainer.java
@@ -91,9 +91,12 @@ public class ResourceContainer implements Serializable {
private static ExecutorService AVAIL_CHECK_THREAD_POOL;
/**
- * How long to wait for a resource to return their availability immediately (in ms).
- * If a resource takes longer than this, then the number of timeouts is incremented, and then
- * the container will just assume availability will be returned asynchronously for this resource.
+ * This thread pool protects us from generating a potentially huge number of threads on slow running
+ * agents where avail checks are taking longer that 1s (given a default setting). Each avail check
+ * requests a thread on the assumption that most if not all checks will be sub-second. But if that
+ * is not the case we could, if using an CachedThreadPool, end up with N concurrent avail check threads,
+ * where N is the number of resources managed by the agent (because that type of pool can grow unbounded).
+ * Instead, limit the max # of threads and fall back to synchronous checking when overloaded.
*/
private static final int AVAIL_CHECK_THREAD_POOL_SIZE;
@@ -138,12 +141,6 @@ public class ResourceContainer implements Serializable {
LoggingThreadFactory availCheckFactory = new LoggingThreadFactory(AVAIL_CHECK_THREAD_POOL_NAME, true);
DAEMON_THREAD_POOL = Executors.newCachedThreadPool(daemonFactory);
NON_DAEMON_THREAD_POOL = Executors.newCachedThreadPool(nonDaemonFactory);
- // This thread pool protects us from generating a potentially huge number of threads on slow running
- // agents where avail checks are taking longer that 1s (given a default setting). Each avail check
- // requests a thread on the assumption that most if not all checks will be sub-second. But if that
- // is not the case we could, if using an CachedThreadPool, end up with N concurrent avail check threads,
- // where N is the number of resources managed by the agent (because that type of pool can grow unbounded).
- // Instead, limit the max # of threads and fall back to synchronous checking when overloaded.
AVAIL_CHECK_THREAD_POOL = Executors.newFixedThreadPool(AVAIL_CHECK_THREAD_POOL_SIZE, availCheckFactory);
}
10 years, 5 months
[rhq] Branch 'jay-avail' - 3 commits - modules/core modules/enterprise modules/plugins
by Jay Shaughnessy
modules/core/plugin-container/src/test/java/org/rhq/core/pc/inventory/AvailabilityProxyTest.java | 3 +
modules/enterprise/agent/src/main/resources/log4j.xml | 5 ++
modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java | 18 ++++++++--
modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatServerComponent.java | 17 ++++++---
4 files changed, 33 insertions(+), 10 deletions(-)
New commits:
commit 8e7f97567327ba25c4a7023e99afd491ee4ec55b
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Nov 25 15:10:58 2013 -0500
Quiet the Tomcat plugin by switching some INFO logging to DEBUG
diff --git a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatServerComponent.java b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatServerComponent.java
index 7886939..440939f 100644
--- a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatServerComponent.java
+++ b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatServerComponent.java
@@ -211,12 +211,16 @@ public class TomcatServerComponent<T extends ResourceComponent<?>> implements JM
connectionSettings.getControlProperties().setProperty(ConnectionFactory.JAR_TEMP_DIR,
tempDir.getAbsolutePath());
- log.info("Loading connection [" + connectionSettings.getServerUrl() + "] with install path ["
- + connectionSettings.getLibraryURI() + "] and temp directory [" + tempDir.getAbsolutePath()
- + "]");
+ if (log.isDebugEnabled()) {
+ log.debug("Loading connection [" + connectionSettings.getServerUrl() + "] with install path ["
+ + connectionSettings.getLibraryURI() + "] and temp directory [" + tempDir.getAbsolutePath()
+ + "]");
+ }
} else {
- log.info("Loading connection [" + connectionSettings.getServerUrl()
- + "] ignoring remote install path [" + catalinaHome + "]");
+ if (log.isDebugEnabled()) {
+ log.debug("Loading connection [" + connectionSettings.getServerUrl()
+ + "] ignoring remote install path [" + catalinaHome + "]");
+ }
}
ConnectionProvider connectionProvider = connectionFactory.getConnectionProvider(connectionSettings);
@@ -415,7 +419,8 @@ public class TomcatServerComponent<T extends ResourceComponent<?>> implements JM
return scriptFile;
}
- private File resolvePathRelativeToHomeDir(@NotNull String path) {
+ private File resolvePathRelativeToHomeDir(@NotNull
+ String path) {
return resolvePathRelativeToHomeDir(this.resourceContext.getPluginConfiguration(), path);
}
commit 5389dbbfe4b927a603fb2d2369ac87edcc734679
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Nov 25 15:10:27 2013 -0500
Quiet the JMX plugin by:
- suffocating INFO messages generated by EMS's ConnectionFactory
- protecting against an NPE in JMXServerComponent.start when
connections couldn't be made
- dumping stack traces in in JMXServerComponent.star in debug only
diff --git a/modules/enterprise/agent/src/main/resources/log4j.xml b/modules/enterprise/agent/src/main/resources/log4j.xml
index b135bb8..23a7064 100644
--- a/modules/enterprise/agent/src/main/resources/log4j.xml
+++ b/modules/enterprise/agent/src/main/resources/log4j.xml
@@ -91,6 +91,11 @@
</category>
-->
+ <!-- EMS connection factory can be noisy with its INFO messages - comment the below to see them. -->
+ <category name="org.mc4j.ems.connection.ConnectionFactory">
+ <priority value="WARN"/>
+ </category>
+
<!-- EMS can be noisy with its WARN messages - uncomment the below to suppress them. -->
<!--
<category name="org.mc4j.ems">
diff --git a/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java b/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java
index 14f43b9..f801cc5 100644
--- a/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java
+++ b/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXServerComponent.java
@@ -71,9 +71,15 @@ public class JMXServerComponent<T extends ResourceComponent<?>> implements JMXCo
} catch (Exception e) {
if (e.getCause() instanceof SecurityException) {
throw new InvalidPluginConfigurationException("Failed to authenticate to managed JVM - "
- + "principal and/or credentials connection properties are not set correctly.");
+ + "principal and/or credentials connection properties are not set correctly.");
+ }
+ // don't litter agent log with a stack trace unless we're in debug
+ if (log.isDebugEnabled()) {
+ log.warn("Failed to connect to " + context.getResourceType() + "[" + context.getResourceKey() + "].", e);
+ } else {
+ log.warn("Failed to connect to " + context.getResourceType() + "[" + context.getResourceKey() + "]: "
+ + e.getMessage());
}
- log.warn("Failed to connect to " + context.getResourceType() + "[" + context.getResourceKey() + "].", e);
}
}
@@ -82,13 +88,19 @@ public class JMXServerComponent<T extends ResourceComponent<?>> implements JMXCo
String connectionTypeDescriptorClassName = pluginConfig.getSimple(JMXDiscoveryComponent.CONNECTION_TYPE)
.getStringValue();
if (JMXDiscoveryComponent.PARENT_TYPE.equals(connectionTypeDescriptorClassName)) {
- // Our parent is itself a JMX component, so just reuse its connection.
+ // Our parent is itself a JMX component, so just reuse its connection, if it has one.
this.connection = ((JMXComponent) context.getParentResourceComponent()).getEmsConnection();
+ if (null == this.connection) {
+ throw new IllegalStateException("Could not access parent connection, parent may be down");
+ }
this.connectionProvider = this.connection.getConnectionProvider();
} else {
this.connectionProvider = ConnectionProviderFactory.createConnectionProvider(pluginConfig,
this.context.getNativeProcess(), this.context.getTemporaryDirectory());
this.connection = this.connectionProvider.connect();
+ if (null == this.connection) {
+ throw new IllegalStateException("Failed to create connection, resource may be down");
+ }
this.connection.loadSynchronous(false);
}
}
commit 61ba50c44f9a5fad9d9d12db9931e6f7a0c2fcb9
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Nov 25 15:06:55 2013 -0500
calls to a component's getAvailbility() impl should return UP or DOWN. In
the case of a timeout on the initial getAvail call to the proxy, it will
convert an UNKNOWN to DOWN.
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/inventory/AvailabilityProxyTest.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/inventory/AvailabilityProxyTest.java
index aae52a2..e8dd78d 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/inventory/AvailabilityProxyTest.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/inventory/AvailabilityProxyTest.java
@@ -18,6 +18,7 @@
*/
package org.rhq.core.pc.inventory;
+import static org.rhq.core.domain.measurement.AvailabilityType.DOWN;
import static org.rhq.core.domain.measurement.AvailabilityType.UNKNOWN;
import static org.rhq.core.domain.measurement.AvailabilityType.UP;
import static org.testng.AssertJUnit.assertEquals;
@@ -55,7 +56,7 @@ public class AvailabilityProxyTest implements AvailabilityFacet {
assertEquals("should be up", avail, ap.getAvailability());
assertEquals(false, interrupted);
timeout = 1100;
- assertEquals("should be unknown", UNKNOWN, ap.getAvailability());
+ assertEquals("should be down", DOWN, ap.getAvailability());
Thread.sleep(500); // waited 1.5 sec
assertEquals("should be up now", UP, ap.getAvailability());
Thread.sleep(1); // waited 1.001 seconds
10 years, 5 months