[rhq] modules/enterprise
by lkrejci
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementScheduleManagerBean.java | 3 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java | 24 +++++++++-
2 files changed, 25 insertions(+), 2 deletions(-)
New commits:
commit 25f768afb5c72e5eb0fa17c6789b3b8aaa895be9
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Nov 28 13:39:26 2013 +0100
[BZ 1035767] - Enable altering count query along with alterProjection
If CriteriaQueryGeneration.alterProjection changes the projection such
that the actual number of returned results changes (e.g. using distinct),
the default count query would no longer match and the returned results
would be inconsistent with the count found by the count query.
Because alterProjection is essentially free-form JPQL, we need to provide
a similar means to alter the count query so that the data query and count
query can be modified to return consistent data.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementScheduleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementScheduleManagerBean.java
index d53a037..5d5c48a 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementScheduleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementScheduleManagerBean.java
@@ -1485,6 +1485,7 @@ public class MeasurementScheduleManagerBean implements MeasurementScheduleManage
// the JPQL above, I've chosen to just make a change to the custom altered projection, using
// the JPQL to guide me.
generator.alterProjection(" distinct orderingField0");
+ generator.alterCountProjection(" count(distinct orderingField0)");
CriteriaQueryRunner<MeasurementDefinition> queryRunner = new CriteriaQueryRunner(criteria, generator,
entityManager);
definitions = queryRunner.execute();
@@ -1609,4 +1610,4 @@ public class MeasurementScheduleManagerBean implements MeasurementScheduleManage
// }
// }
-}
\ No newline at end of file
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
index a1f3122..36b3770 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
@@ -84,6 +84,7 @@ public final class CriteriaQueryGenerator {
private String alias;
private String className;
private String projection;
+ private String countProjection;
private String groupByClause;
private String havingClause;
private static String NL = System.getProperty("line.separator");
@@ -411,7 +412,10 @@ public final class CriteriaQueryGenerator {
boolean useJoinFetch = projection == null && pc.isUnlimited() && !fetchFields.isEmpty();
if (countQuery) {
- if (groupByClause == null) { // non-grouped method
+ if (countProjection != null) {
+ //just use whatever we are told
+ results.append(countProjection).append(NL);
+ } else if (groupByClause == null) { // non-grouped method
// use count(*) instead of count(alias) due to https://bugzilla.redhat.com/show_bug.cgi?id=699842
results.append("COUNT(*)").append(NL);
} else {
@@ -840,6 +844,24 @@ public final class CriteriaQueryGenerator {
this.projection = projection;
}
+ /**
+ * Sometimes the altered projection ({@link #alterProjection(String)}) might cause the result set to have different
+ * number of results than the default/unaltered projection. Leaving the count query in the default form could then
+ * generate seemingly inconsistent results, where the data query and the count query wouldn't match up.
+ * <p/>
+ * An example of a projection that might alter the number of results is the {@code " distinct ..."} projection that
+ * would only return distinct results from a dataset, while the default count query (COUNT(*)) would produce the
+ * count including duplicate results that were eliminated in the returned data.
+ * <p/>
+ * In these cases one can also alter the count query to count the results the data query will return.
+ *
+ * @param countProjection a complete JPQL fragment expressing the count expression (e.g.
+ * {@code COUNT(DISTINCT ...)})
+ */
+ public void alterCountProjection(String countProjection) {
+ this.countProjection = countProjection;
+ }
+
public boolean isProjectionAltered() {
return this.projection != null;
}
10 years, 5 months
[rhq] modules/plugins
by Jean-Frederic Clere
modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatServerComponent.java | 10 ++++++++++
1 file changed, 10 insertions(+)
New commits:
commit 49d276b51a5a1a849a38fc1f75250096d141c813
Author: Jean-Frederic Clere <jfclere(a)redhat.com>
Date: Thu Nov 28 13:34:30 2013 +0100
[BZ 1017961] JMX Plugin can fail testing for registration
Submitted by Thomas Segismont (tsegismo(a)redhat.com)
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..9838c14 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
@@ -158,6 +158,16 @@ public class TomcatServerComponent<T extends ResourceComponent<?>> implements JM
* @throws Exception if there are any issues at all connecting to the server
*/
private synchronized EmsConnection loadConnection() throws Exception {
+
+ if (this.connection != null && !this.connection.getConnectionProvider().isConnected()) {
+ try {
+ this.connection.close();
+ } catch (Exception ignore) {
+ } finally {
+ this.connection = null;
+ }
+ }
+
if (this.connection == null) {
try {
Configuration pluginConfig = this.resourceContext.getPluginConfiguration();
10 years, 5 months
[rhq] modules/plugins
by Jean-Frederic Clere
modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatWarComponent.java | 24 +++++-----
1 file changed, 12 insertions(+), 12 deletions(-)
New commits:
commit 807dbaf6be0833386a7c1efff5298c5b63021deb
Author: Jean-Frederic Clere <jfclere(a)redhat.com>
Date: Thu Nov 28 12:10:14 2013 +0100
[BZ 997669] Tomcat Web Application (WAR)" components stay down when server comes back up.
Submitted by Thomas Segismont (tsegismo(a)redhat.com)
diff --git a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatWarComponent.java b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatWarComponent.java
index 0a51c45..d70a82f 100644
--- a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatWarComponent.java
+++ b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatWarComponent.java
@@ -1,24 +1,20 @@
/*
- * Jopr Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * RHQ Management Platform
+ * 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.jboss.on.plugins.tomcat;
@@ -141,7 +137,7 @@ public class TomcatWarComponent extends MBeanResourceComponent<TomcatVHostCompon
public AvailabilityType getAvailability() {
AvailabilityType availability;
- if (null == this.webModuleMBean) {
+ if (null == this.webModuleMBean || isStaleWebModuleMBeanReference(this.webModuleMBean, getEmsConnection())) {
this.webModuleMBean = getWebModuleMBean();
}
@@ -179,6 +175,10 @@ public class TomcatWarComponent extends MBeanResourceComponent<TomcatVHostCompon
return availability;
}
+ private static boolean isStaleWebModuleMBeanReference(EmsBean webModuleMBean, EmsConnection emsConnection) {
+ return !webModuleMBean.getConnectionProvider().getExistingConnection().equals(emsConnection);
+ }
+
@Override
public void start(ResourceContext<TomcatVHostComponent> resourceContext) {
super.start(resourceContext);
10 years, 5 months
[rhq] modules/enterprise
by Jay Shaughnessy
modules/enterprise/agent/src/etc/rhq-agent-env.bat | 18 ++-
modules/enterprise/agent/src/etc/rhq-agent-wrapper.bat | 33 +++++-
modules/enterprise/agent/src/etc/rhq-agent.bat | 33 +++---
modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server.bat | 50 +++++++---
modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage-installer.bat | 13 ++
modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage.bat | 50 +++++++---
modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-server-wrapper.conf | 8 -
modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-storage-wrapper.conf | 8 -
8 files changed, 146 insertions(+), 67 deletions(-)
New commits:
commit ecb4d5877a6c585f0900389bb5c0f6bf587fe6b7
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Nov 27 17:33:24 2013 -0500
[1023019] Windows 2008 - Upgrade to JON3.2.ER3 freezes on 'Updating RHQ Agent Service'
rhqctl-based installs will now exit if the password is not set when the RUN_AS
option is specified. The RHQ_XXX_PASSWORD_PROMPT env vars are no
longer relevant or documented for rhqctl-based installs. Note that
the agent is typically installed standalone, outside of rhqctl, and in
that case the RHQ_AGENT_PASSWORD_PROMPT env var is still relevant.
Additionally, rhq-agent.bat had some newly discovered problems handling
certain options (32-bit java install, I think), and has had a decent
amount of reworking to deal with the issues.
diff --git a/modules/enterprise/agent/src/etc/rhq-agent-env.bat b/modules/enterprise/agent/src/etc/rhq-agent-env.bat
index 56485a1..eb1be8e 100644
--- a/modules/enterprise/agent/src/etc/rhq-agent-env.bat
+++ b/modules/enterprise/agent/src/etc/rhq-agent-env.bat
@@ -157,20 +157,24 @@ rem set RHQ_AGENT_RUN_AS=.\%USERNAME%
rem RHQ_AGENT_RUN_AS_ME - if defined, then when the Windows Service is
rem installed, the domain\username of the
rem user that the Windows Service will run as will
-rem be the current user (.\%USERNAME%). This takes
+rem be the current user (.\%USERNAME%). This takes
rem precedence over RHQ_AGENT_RUN_AS.
rem
rem set RHQ_AGENT_RUN_AS_ME=true
-rem RHQ_AGENT_PASSWORD_PROMPT - if "true", the user that is to run the
-rem service (as defined by RHQ_AGENT_RUN_AS or
-rem RHQ_AGENT_RUN_AS_ME) must type the password
+rem RHQ_AGENT_PASSWORD_PROMPT - ignored unless RHQ_AGENT_RUN_AS or
+rem RHQ_AGENT_RUN_AS_ME is in use.
+rem Ignored by 'rhqctl install', in which case
+rem RHQ_AGENT_PASSWORD is required.
+rem Used only when installing the agent as a
+rem service via 'rhq-agent-wrapper.bat install'.
+rem If "true", the user that is to
+rem run the service must type the password
rem on the console in order to install service.
rem If "false", you must provide the password
rem in RHQ_AGENT_PASSWORD. Default is "true".
-rem This is only used when installing the
-rem service; it is not needed to be set when
-rem starting, stopping or removing the service.
+rem It is not needed to be set when starting,
+rem stopping or removing the service.
rem
rem set RHQ_AGENT_PASSWORD_PROMPT=true
diff --git a/modules/enterprise/agent/src/etc/rhq-agent-wrapper.bat b/modules/enterprise/agent/src/etc/rhq-agent-wrapper.bat
index debbebb..90e9666 100644
--- a/modules/enterprise/agent/src/etc/rhq-agent-wrapper.bat
+++ b/modules/enterprise/agent/src/etc/rhq-agent-wrapper.bat
@@ -28,7 +28,7 @@ rem If the embedded JRE is to be used but is not available, the fallback
rem JRE to be used will be determined by the JAVA_HOME environment variable.
rem ===========================================================================
-setlocal
+setlocal enabledelayedexpansion
rem ----------------------------------------------------------------------
rem Let's load in the env script first. We assume our custom environment
@@ -121,13 +121,32 @@ rem Determine if there should be debug VM options passed into it
rem For some reason, this can't go inside another if statement
if defined RHQ_AGENT_DEBUG set _DEBUG_OPTS=wrapper.debug=true wrapper.java.additional.1=-Dlog4j.configuration=log4j-debug.xml wrapper.java.additional.4=-Di18nlog.dump-stack-traces=true wrapper.java.additional.5=-Dsigar.nativeLogging=true
-rem Determine what user the Windows Service will run as
-if defined RHQ_AGENT_RUN_AS set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=%RHQ_AGENT_RUN_AS%"
-if defined RHQ_AGENT_RUN_AS_ME set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=.\%USERNAME%"
-if not defined RHQ_AGENT_PASSWORD_PROMPT set RHQ_AGENT_PASSWORD_PROMPT=true
-
if /i "%1"=="install" (
- "%RHQ_AGENT_WRAPPER_EXE_FILE_PATH%" -i "%RHQ_AGENT_WRAPPER_CONF_FILE_PATH%" "set.RHQ_AGENT_HOME=%RHQ_AGENT_HOME%" "set.RHQ_AGENT_INSTANCE_NAME=%RHQ_AGENT_INSTANCE_NAME%" "set.RHQ_JAVA_EXE_FILE_PATH=%RHQ_JAVA_EXE_FILE_PATH%" "set.RHQ_AGENT_OS_PLATFORM=%RHQ_AGENT_OS_PLATFORM%" "set.RHQ_AGENT_WRAPPER_LOG_DIR_PATH=%RHQ_AGENT_WRAPPER_LOG_DIR_PATH%" %_WRAPPER_NTSERVICE_ACCOUNT% %_DEBUG_OPTS%
+ rem Determine what user the Windows Service will run as
+ rem If this is an rhqctl install then ensure password is set as needed because we can't perform interactive prompt
+ rem Note - using the RHQ_CONTROL_JAVA_OPTS env var as a flag indicating we're being called from rhqctl
+ if defined RHQ_CONTROL_JAVA_OPTS (
+ if defined RHQ_AGENT_RUN_AS (
+ if not defined RHQ_AGENT_PASSWORD (
+ echo Exiting. RHQ_AGENT_PASSWORD is not set but is required because RHQ_AGENT_RUN_AS is set: %RHQ_AGENT_RUN_AS%.
+ exit /B 1
+ )
+ set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=%RHQ_AGENT_RUN_AS%"
+ )
+ if defined RHQ_AGENT_RUN_AS_ME (
+ if not defined RHQ_AGENT_PASSWORD (
+ echo Exiting. RHQ_AGENT_PASSWORD is not set but is required because RHQ_AGENT_RUN_AS_ME is set.
+ exit /B 1
+ )
+ set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=.\%USERNAME%"
+ )
+ ) else (
+ if defined RHQ_AGENT_RUN_AS set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=%RHQ_AGENT_RUN_AS%"
+ if defined RHQ_AGENT_RUN_AS_ME set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=.\%USERNAME%"
+ if not defined RHQ_AGENT_PASSWORD_PROMPT set RHQ_AGENT_PASSWORD_PROMPT=true
+ )
+
+ "%RHQ_AGENT_WRAPPER_EXE_FILE_PATH%" -i "%RHQ_AGENT_WRAPPER_CONF_FILE_PATH%" "set.RHQ_AGENT_HOME=%RHQ_AGENT_HOME%" "set.RHQ_AGENT_INSTANCE_NAME=%RHQ_AGENT_INSTANCE_NAME%" "set.RHQ_JAVA_EXE_FILE_PATH=%RHQ_JAVA_EXE_FILE_PATH%" "set.RHQ_AGENT_OS_PLATFORM=%RHQ_AGENT_OS_PLATFORM%" "set.RHQ_AGENT_WRAPPER_LOG_DIR_PATH=%RHQ_AGENT_WRAPPER_LOG_DIR_PATH%" !_WRAPPER_NTSERVICE_ACCOUNT! %_DEBUG_OPTS%
if ERRORLEVEL 1 goto error
goto done
)
diff --git a/modules/enterprise/agent/src/etc/rhq-agent.bat b/modules/enterprise/agent/src/etc/rhq-agent.bat
index 46ef0b9..0d035b2 100644
--- a/modules/enterprise/agent/src/etc/rhq-agent.bat
+++ b/modules/enterprise/agent/src/etc/rhq-agent.bat
@@ -114,16 +114,15 @@ set CLASSPATH=
call :append_classpath "%RHQ_AGENT_HOME%\conf"
for /R "%RHQ_AGENT_HOME%\lib" %%G in ("*.jar") do (
call :append_classpath "%%G"
- if defined RHQ_AGENT_DEBUG echo CLASSPATH entry: %%G
)
-for %%G in ("%RHQ_JAVA_HOME%\lib\tools.jar" "%RHQ_JAVA_HOME%\..\lib\tools.jar") do (
+for %%G in ("!RHQ_JAVA_HOME!\lib\tools.jar" "!RHQ_JAVA_HOME!\..\lib\tools.jar") do (
if exist "%%G" (
- call :append_classpath "%%G"
- if defined RHQ_AGENT_DEBUG echo CLASSPATH entry: %%G
+ call :append_classpath %%G
goto end_classpath
)
)
:end_classpath
+if defined RHQ_AGENT_DEBUG echo CLASSPATH: %CLASSPATH%
rem ----------------------------------------------------------------------
rem Prepare the VM command line options to be passed in
@@ -137,7 +136,7 @@ if defined RHQ_AGENT_DEBUG echo RHQ_AGENT_JAVA_OPTS: %RHQ_AGENT_JAVA_OPTS%
rem ----------------------------------------------------------------------
rem Ensure the agent uses our custom JavaPreferences implementation
rem ----------------------------------------------------------------------
-set _JAVA_PREFERENCES_FACTORY_OPT="-Djava.util.prefs.PreferencesFactory=org.rhq.core.util.preferences.FilePreferencesFactory"
+set _JAVA_PREFERENCES_FACTORY_OPT=-Djava.util.prefs.PreferencesFactory=org.rhq.core.util.preferences.FilePreferencesFactory
if "%RHQ_AGENT_JAVA_ENDORSED_DIRS%" == "none" (
if defined RHQ_AGENT_DEBUG echo Not explicitly setting java.endorsed.dirs
@@ -145,7 +144,7 @@ if "%RHQ_AGENT_JAVA_ENDORSED_DIRS%" == "none" (
)
if not defined RHQ_AGENT_JAVA_ENDORSED_DIRS set RHQ_AGENT_JAVA_ENDORSED_DIRS=%RHQ_AGENT_HOME%\lib\endorsed
if defined RHQ_AGENT_DEBUG echo RHQ_AGENT_JAVA_ENDORSED_DIRS: %RHQ_AGENT_JAVA_ENDORSED_DIRS%
-set _JAVA_ENDORSED_DIRS_OPT="-Djava.endorsed.dirs=%RHQ_AGENT_JAVA_ENDORSED_DIRS%"
+set _JAVA_ENDORSED_DIRS_OPT=-Djava.endorsed.dirs="%RHQ_AGENT_JAVA_ENDORSED_DIRS%"
:skip_java_endorsed_dirs
if "%RHQ_AGENT_JAVA_LIBRARY_PATH%" == "none" (
@@ -154,7 +153,7 @@ if "%RHQ_AGENT_JAVA_LIBRARY_PATH%" == "none" (
)
if not defined RHQ_AGENT_JAVA_LIBRARY_PATH set RHQ_AGENT_JAVA_LIBRARY_PATH=%RHQ_AGENT_HOME%\lib
if defined RHQ_AGENT_DEBUG echo RHQ_AGENT_JAVA_LIBRARY_PATH: %RHQ_AGENT_JAVA_LIBRARY_PATH%
-set _JAVA_LIBRARY_PATH_OPT="-Djava.library.path=%RHQ_AGENT_JAVA_LIBRARY_PATH%"
+set _JAVA_LIBRARY_PATH_OPT=-Djava.library.path="%RHQ_AGENT_JAVA_LIBRARY_PATH%"
:skip_java_library_path
if defined RHQ_AGENT_DEBUG echo RHQ_AGENT_ADDITIONAL_JAVA_OPTS: %RHQ_AGENT_ADDITIONAL_JAVA_OPTS%
@@ -183,18 +182,17 @@ rem if sigar debug is enabled, the log configuration is different - sigar debugg
if defined RHQ_AGENT_SIGAR_DEBUG (
set _LOG_CONFIG=%_LOG_CONFIG% -Dsigar.nativeLogging=true
)
-
rem to support other agents/plugin containers, allow the caller to override the main classname
if not defined RHQ_AGENT_MAINCLASS (
set RHQ_AGENT_MAINCLASS=org.rhq.enterprise.agent.AgentMain
)
-rem note - currently not using custom Java Prefs as the default, use commented command line to activate. If installing
-rem note - the agent as a windows service, you must also uncomment lines in wrapper/rhq-agent-wrapper.conf.
-rem set CMD="%RHQ_JAVA_EXE_FILE_PATH%" %_JAVA_ENDORSED_DIRS_OPT% %_JAVA_LIBRARY_PATH_OPT% %_JAVA_PREFERENCES_FACTORY_OPT% %RHQ_AGENT_JAVA_OPTS% %RHQ_AGENT_ADDITIONAL_JAVA_OPTS% %_LOG_CONFIG% -cp "%CLASSPATH%" %RHQ_AGENT_MAINCLASS% %RHQ_AGENT_CMDLINE_OPTS%
-set CMD="%RHQ_JAVA_EXE_FILE_PATH%" %_JAVA_ENDORSED_DIRS_OPT% %_JAVA_LIBRARY_PATH_OPT% %RHQ_AGENT_JAVA_OPTS% %RHQ_AGENT_ADDITIONAL_JAVA_OPTS% %_LOG_CONFIG% -cp "%CLASSPATH%" %RHQ_AGENT_MAINCLASS% %RHQ_AGENT_CMDLINE_OPTS%
-
if not defined _SETENV_ONLY (
+ rem note - currently not using custom Java Prefs as the default, use commented command line to activate. If installing
+ rem note - the agent as a windows service, you must also uncomment lines in wrapper/rhq-agent-wrapper.conf.
+ rem set CMD="%RHQ_JAVA_EXE_FILE_PATH%" %_JAVA_ENDORSED_DIRS_OPT% %_JAVA_LIBRARY_PATH_OPT% %_JAVA_PREFERENCES_FACTORY_OPT% %RHQ_AGENT_JAVA_OPTS% %RHQ_AGENT_ADDITIONAL_JAVA_OPTS% %_LOG_CONFIG% -cp "%CLASSPATH%" %RHQ_AGENT_MAINCLASS% %RHQ_AGENT_CMDLINE_OPTS%
+ set CMD="%RHQ_JAVA_EXE_FILE_PATH%" %_JAVA_ENDORSED_DIRS_OPT% %_JAVA_LIBRARY_PATH_OPT% %RHQ_AGENT_JAVA_OPTS% %RHQ_AGENT_ADDITIONAL_JAVA_OPTS% %_LOG_CONFIG% -cp "%CLASSPATH%" %RHQ_AGENT_MAINCLASS% %RHQ_AGENT_CMDLINE_OPTS%
+
rem log4j 1.2.8 does not create the directory for us (later versions do)
if not exist "%RHQ_AGENT_HOME%\logs" (
mkdir "%RHQ_AGENT_HOME%\logs"
@@ -203,7 +201,7 @@ if not defined _SETENV_ONLY (
echo Executing the agent with this command line:
echo %CMD%
)
- cmd.exe /S /C "%CMD%"
+ cmd.exe /S /C "!CMD!"
)
goto :done
@@ -213,11 +211,12 @@ rem CALL subroutine that appends the first argument to CLASSPATH
rem ----------------------------------------------------------------------
:append_classpath
-set _entry=%1
+set "_entry=%1"
+if defined RHQ_AGENT_DEBUG echo CLASSPATH entry: !_entry!
if not defined CLASSPATH (
- set CLASSPATH=%_entry:"=%
+ set CLASSPATH=!_entry:"=!
) else (
- set CLASSPATH=%CLASSPATH%;%_entry:"=%
+ set CLASSPATH=!CLASSPATH!;!_entry:"=!
)
goto :eof
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server.bat
index ba6cbd8..f303c5f 100644
--- a/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server.bat
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server.bat
@@ -41,14 +41,14 @@ rem
rem RHQ_SERVER_RUN_AS - if defined, then when the Windows Service is
rem installed, the value is the domain\username of the
rem user that the Windows Service will run as. It is
-rem important to also set RHQ_SERVER_PASSWORD for the
-rem current user account.
+rem required to also set RHQ_SERVER_PASSWORD for the
+rem specified user account.
rem
rem RHQ_SERVER_RUN_AS_ME - if defined, then when the Windows Service is
rem installed, the domain\username of the user that the Windows
rem Service will run as will be the current user (.\%USERNAME%).
rem This takes precedence over RHQ_SERVER_RUN_AS. It is
-rem important to also set RHQ_SERVER_PASSWORD for the
+rem required to also set RHQ_SERVER_PASSWORD for the
rem current user account.
rem
rem Note that you cannot define custom Java VM parameters or command line
@@ -178,20 +178,46 @@ rem Determine if there should be debug VM options passed into it.
rem For some reason, this can't go inside another if statement.
if defined RHQ_SERVER_DEBUG set _DEBUG_OPTS=wrapper.debug=true
-rem Determine what user the Windows Service will run as.
-if defined RHQ_SERVER_RUN_AS set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=%RHQ_SERVER_RUN_AS%"
-if defined RHQ_SERVER_RUN_AS_ME set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=.\%USERNAME%"
-rem This service is typically installed by rhqctl, so assume we don't want to prompt
-if not defined RHQ_SERVER_PASSWORD_PROMPT set RHQ_SERVER_PASSWORD_PROMPT=false
-
if /i "%1"=="console" (
- rem START SERVER
- "%RHQ_SERVER_WRAPPER_EXE_FILE_PATH%" -c "%RHQ_SERVER_WRAPPER_CONF_FILE_PATH%" "set.RHQ_SERVER_HOME=%RHQ_SERVER_HOME%" "set.RHQ_SERVER_INSTANCE_NAME=%RHQ_SERVER_INSTANCE_NAME%" "set.RHQ_JAVA_EXE_FILE_PATH=%RHQ_JAVA_EXE_FILE_PATH%" "set.RHQ_SERVER_OS_PLATFORM=%RHQ_SERVER_OS_PLATFORM%" "set.RHQ_SERVER_WRAPPER_LOG_DIR_PATH=%RHQ_SERVER_WRAPPER_LOG_DIR_PATH%" %_WRAPPER_NTSERVICE_ACCOUNT% %_DEBUG_OPTS%
+ rem Determine what user the Windows Service will run as.
+ if defined RHQ_SERVER_RUN_AS (
+ if not defined RHQ_SERVER_PASSWORD (
+ echo Exiting. RHQ_SERVER_PASSWORD is not set but is required because RHQ_SERVER_RUN_AS is set: %RHQ_SERVER_RUN_AS%.
+ exit /B 1
+ )
+ set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=%RHQ_SERVER_RUN_AS%"
+ )
+ if defined RHQ_SERVER_RUN_AS_ME (
+ if not defined RHQ_SERVER_PASSWORD (
+ echo Exiting. RHQ_SERVER_PASSWORD is not set but is required because RHQ_SERVER_RUN_AS_ME is set.
+ exit /B 1
+ )
+ set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=.\%USERNAME%"
+ )
+
+ rem START SERVER as console
+ "%RHQ_SERVER_WRAPPER_EXE_FILE_PATH%" -c "%RHQ_SERVER_WRAPPER_CONF_FILE_PATH%" "set.RHQ_SERVER_HOME=%RHQ_SERVER_HOME%" "set.RHQ_SERVER_INSTANCE_NAME=%RHQ_SERVER_INSTANCE_NAME%" "set.RHQ_JAVA_EXE_FILE_PATH=%RHQ_JAVA_EXE_FILE_PATH%" "set.RHQ_SERVER_OS_PLATFORM=%RHQ_SERVER_OS_PLATFORM%" "set.RHQ_SERVER_WRAPPER_LOG_DIR_PATH=%RHQ_SERVER_WRAPPER_LOG_DIR_PATH%" !_WRAPPER_NTSERVICE_ACCOUNT! %_DEBUG_OPTS%
goto done
)
if /i "%1"=="install" (
- "%RHQ_SERVER_WRAPPER_EXE_FILE_PATH%" -i "%RHQ_SERVER_WRAPPER_CONF_FILE_PATH%" "set.RHQ_SERVER_HOME=%RHQ_SERVER_HOME%" "set.RHQ_SERVER_INSTANCE_NAME=%RHQ_SERVER_INSTANCE_NAME%" "set.RHQ_JAVA_EXE_FILE_PATH=%RHQ_JAVA_EXE_FILE_PATH%" "set.RHQ_SERVER_OS_PLATFORM=%RHQ_SERVER_OS_PLATFORM%" "set.RHQ_SERVER_WRAPPER_LOG_DIR_PATH=%RHQ_SERVER_WRAPPER_LOG_DIR_PATH%" %_WRAPPER_NTSERVICE_ACCOUNT% %_DEBUG_OPTS%
+ rem Determine what user the Windows Service will run as.
+ if defined RHQ_SERVER_RUN_AS (
+ if not defined RHQ_SERVER_PASSWORD (
+ echo Exiting. RHQ_SERVER_PASSWORD is not set but is required because RHQ_SERVER_RUN_AS is set: %RHQ_SERVER_RUN_AS%.
+ exit /B 1
+ )
+ set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=%RHQ_SERVER_RUN_AS%"
+ )
+ if defined RHQ_SERVER_RUN_AS_ME (
+ if not defined RHQ_SERVER_PASSWORD (
+ echo Exiting. RHQ_SERVER_PASSWORD is not set but is required because RHQ_SERVER_RUN_AS_ME is set.
+ exit /B 1
+ )
+ set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=.\%USERNAME%"
+ )
+
+ "%RHQ_SERVER_WRAPPER_EXE_FILE_PATH%" -i "%RHQ_SERVER_WRAPPER_CONF_FILE_PATH%" "set.RHQ_SERVER_HOME=%RHQ_SERVER_HOME%" "set.RHQ_SERVER_INSTANCE_NAME=%RHQ_SERVER_INSTANCE_NAME%" "set.RHQ_JAVA_EXE_FILE_PATH=%RHQ_JAVA_EXE_FILE_PATH%" "set.RHQ_SERVER_OS_PLATFORM=%RHQ_SERVER_OS_PLATFORM%" "set.RHQ_SERVER_WRAPPER_LOG_DIR_PATH=%RHQ_SERVER_WRAPPER_LOG_DIR_PATH%" !_WRAPPER_NTSERVICE_ACCOUNT! %_DEBUG_OPTS%
goto done
)
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage-installer.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage-installer.bat
index f29b7c9..fa14a5b 100644
--- a/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage-installer.bat
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage-installer.bat
@@ -199,6 +199,19 @@ set _JBOSS_MODULEPATH=%_RHQ_MODULES_PATH%;%_INTERNAL_MODULES_PATH%
if defined RHQ_STORAGE_DEBUG echo _JBOSS_MODULEPATH: %_JBOSS_MODULEPATH%
+rem before running the storage installer, ensure password is set if RUN_AS is in use
+if defined RHQ_STORAGE_RUN_AS (
+ if not defined RHQ_STORAGE_PASSWORD (
+ echo Exiting. RHQ_STORAGE_PASSWORD is not set but is required because RHQ_STORAGE_RUN_AS is set: %RHQ_STORAGE_RUN_AS%.
+ exit /B 1
+ )
+)
+if defined RHQ_STORAGE_RUN_AS_ME (
+ if not defined RHQ_STORAGE_PASSWORD (
+ echo Exiting. RHQ_STORAGE_PASSWORD is not set but is required because RHQ_STORAGE_RUN_AS_ME is set.
+ exit /B 1
+ )
+)
echo "Starting RHQ Storage Installer ..."
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage.bat
index c2f7f02..46e483b 100644
--- a/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage.bat
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage.bat
@@ -43,15 +43,15 @@ rem
rem RHQ_STORAGE_RUN_AS - if defined, then when the Windows Service is
rem installed, the value is the domain\username of the
rem user that the Windows Service will run as. It is
-rem important to also set RHQ_STORAGE_PASSWORD for the
-rem current user account.
+rem required to also set RHQ_STORAGE_PASSWORD for the
+rem specified user account.
rem
rem RHQ_STORAGE_RUN_AS_ME - if defined, then when the Windows Service is
rem installed, the domain\username of the user that the Windows
rem Service will run as will be the current user (.\%USERNAME%).
rem This takes precedence over RHQ_STORAGE_RUN_AS. It is
-rem important to also set RHQ_STORAGE_PASSWORD for the
-rem current user account.
+rem required to also set RHQ_STORAGE_PASSWORD for the
+rem specified user account.
rem
rem Note that you cannot define custom Java VM parameters or command line
rem arguments to pass to Cassandra. If you wish to pass in specific arguments,
@@ -199,20 +199,46 @@ rem Determine if there should be debug VM options passed into it.
rem For some reason, this can't go inside another if statement.
if defined RHQ_STORAGE_DEBUG set _DEBUG_OPTS=wrapper.debug=true
-rem Determine what user the Windows Service will run as.
-if defined RHQ_STORAGE_RUN_AS set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=%RHQ_STORAGE_RUN_AS%"
-if defined RHQ_STORAGE_RUN_AS_ME set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=.\%USERNAME%"
-rem This service is typically installed by rhqctl, so assume we don't want to prompt
-if not defined RHQ_STORAGE_PASSWORD_PROMPT set RHQ_STORAGE_PASSWORD_PROMPT=false
-
if /i "%1"=="console" (
+ rem Determine what user the Windows Service will run as.
+ if defined RHQ_STORAGE_RUN_AS (
+ if not defined RHQ_STORAGE_PASSWORD (
+ echo Exiting. RHQ_STORAGE_PASSWORD is not set but is required because RHQ_STORAGE_RUN_AS is set: %RHQ_STORAGE_RUN_AS%.
+ exit /B 1
+ )
+ set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=%RHQ_STORAGE_RUN_AS%"
+ )
+ if defined RHQ_STORAGE_RUN_AS_ME (
+ if not defined RHQ_STORAGE_PASSWORD (
+ echo Exiting. RHQ_STORAGE_PASSWORD is not set but is required because RHQ_STORAGE_RUN_AS_ME is set.
+ exit /B 1
+ )
+ set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=.\%USERNAME%"
+ )
+
rem START STORAGE NODE
- start "%RHQ_STORAGE_WRAPPER_EXE_FILE_PATH%" -c "%RHQ_STORAGE_WRAPPER_CONF_FILE_PATH%" "set.RHQ_SERVER_HOME=%RHQ_SERVER_HOME%" "set.RHQ_STORAGE_HOME=%RHQ_STORAGE_HOME%" "set.RHQ_STORAGE_INSTANCE_NAME=%RHQ_STORAGE_INSTANCE_NAME%" "set.RHQ_JAVA_EXE_FILE_PATH=%RHQ_JAVA_EXE_FILE_PATH%" "set.RHQ_STORAGE_OS_PLATFORM=%RHQ_STORAGE_OS_PLATFORM%" "set.RHQ_STORAGE_WRAPPER_LOG_DIR_PATH=%RHQ_STORAGE_WRAPPER_LOG_DIR_PATH%" %_WRAPPER_NTSERVICE_ACCOUNT% %_DEBUG_OPTS%
+ start "%RHQ_STORAGE_WRAPPER_EXE_FILE_PATH%" -c "%RHQ_STORAGE_WRAPPER_CONF_FILE_PATH%" "set.RHQ_SERVER_HOME=%RHQ_SERVER_HOME%" "set.RHQ_STORAGE_HOME=%RHQ_STORAGE_HOME%" "set.RHQ_STORAGE_INSTANCE_NAME=%RHQ_STORAGE_INSTANCE_NAME%" "set.RHQ_JAVA_EXE_FILE_PATH=%RHQ_JAVA_EXE_FILE_PATH%" "set.RHQ_STORAGE_OS_PLATFORM=%RHQ_STORAGE_OS_PLATFORM%" "set.RHQ_STORAGE_WRAPPER_LOG_DIR_PATH=%RHQ_STORAGE_WRAPPER_LOG_DIR_PATH%" !_WRAPPER_NTSERVICE_ACCOUNT! %_DEBUG_OPTS%
goto done
)
if /i "%1"=="install" (
- "%RHQ_STORAGE_WRAPPER_EXE_FILE_PATH%" -i "%RHQ_STORAGE_WRAPPER_CONF_FILE_PATH%" "set.RHQ_SERVER_HOME=%RHQ_SERVER_HOME%" "set.RHQ_STORAGE_HOME=%RHQ_STORAGE_HOME%" "set.RHQ_STORAGE_INSTANCE_NAME=%RHQ_STORAGE_INSTANCE_NAME%" "set.RHQ_JAVA_EXE_FILE_PATH=%RHQ_JAVA_EXE_FILE_PATH%" "set.RHQ_STORAGE_OS_PLATFORM=%RHQ_STORAGE_OS_PLATFORM%" "set.RHQ_STORAGE_WRAPPER_LOG_DIR_PATH=%RHQ_STORAGE_WRAPPER_LOG_DIR_PATH%" %_WRAPPER_NTSERVICE_ACCOUNT% %_DEBUG_OPTS%
+ rem Determine what user the Windows Service will run as.
+ if defined RHQ_STORAGE_RUN_AS (
+ if not defined RHQ_STORAGE_PASSWORD (
+ echo Exiting. RHQ_STORAGE_PASSWORD is not set but is required because RHQ_STORAGE_RUN_AS is set: %RHQ_STORAGE_RUN_AS%.
+ exit /B 1
+ )
+ set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=%RHQ_STORAGE_RUN_AS%"
+ )
+ if defined RHQ_STORAGE_RUN_AS_ME (
+ if not defined RHQ_STORAGE_PASSWORD (
+ echo Exiting. RHQ_STORAGE_PASSWORD is not set but is required because RHQ_STORAGE_RUN_AS_ME is set.
+ exit /B 1
+ )
+ set _WRAPPER_NTSERVICE_ACCOUNT="wrapper.ntservice.account=.\%USERNAME%"
+ )
+
+ "%RHQ_STORAGE_WRAPPER_EXE_FILE_PATH%" -i "%RHQ_STORAGE_WRAPPER_CONF_FILE_PATH%" "set.RHQ_SERVER_HOME=%RHQ_SERVER_HOME%" "set.RHQ_STORAGE_HOME=%RHQ_STORAGE_HOME%" "set.RHQ_STORAGE_INSTANCE_NAME=%RHQ_STORAGE_INSTANCE_NAME%" "set.RHQ_JAVA_EXE_FILE_PATH=%RHQ_JAVA_EXE_FILE_PATH%" "set.RHQ_STORAGE_OS_PLATFORM=%RHQ_STORAGE_OS_PLATFORM%" "set.RHQ_STORAGE_WRAPPER_LOG_DIR_PATH=%RHQ_STORAGE_WRAPPER_LOG_DIR_PATH%" !_WRAPPER_NTSERVICE_ACCOUNT! %_DEBUG_OPTS%
goto done
)
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-server-wrapper.conf b/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-server-wrapper.conf
index 761dc3b..8546c02 100644
--- a/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-server-wrapper.conf
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-server-wrapper.conf
@@ -25,12 +25,8 @@
# set.RHQ_SERVER_INSTANCE_NAME - A name to identify the RHQ Server
# set.RHQ_SERVER_OS_PLATFORM - The operating system platform name
# set.RHQ_SERVER_WRAPPER_LOG_DIR_PATH - The Java Service Wrapper's log file (helpful if installing, uninstalling or starting fails)
-# set.RHQ_SERVER_PASSWORD_PROMPT - TRUE if password needs to be typed on
-# the console when installing. FALSE
-# requires RHQ_SERVER_PASSWORD to be set.
# set.RHQ_SERVER_PASSWORD - the password of the user that is to
-# run the service. Only used if
-# RHQ_SERVER_PASSWORD_PROMPT is FALSE.
+# run the service.
# set.RHQ_JAVA_EXE_FILE_PATH - Java executable
#*****************************************************************************
@@ -182,7 +178,7 @@ wrapper.ntservice.console=FALSE
# If prompt is true, the user will be prompted for the password. If false,
# the password configuration property will be used.
#wrapper.ntservice.account=.\username
-wrapper.ntservice.password.prompt=%RHQ_SERVER_PASSWORD_PROMPT%
+wrapper.ntservice.password.prompt=false
wrapper.ntservice.password=%RHQ_SERVER_PASSWORD%
#*****************************************************************************
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-storage-wrapper.conf b/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-storage-wrapper.conf
index 88f6011..7d9b65f 100644
--- a/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-storage-wrapper.conf
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-storage-wrapper.conf
@@ -26,12 +26,8 @@
# set.RHQ_STORAGE_INSTANCE_NAME - A name to identify the RHQ Storage Node
# set.RHQ_STORAGE_OS_PLATFORM - The operating system platform name
# set.RHQ_STORAGE_WRAPPER_LOG_DIR_PATH - The Java Service Wrapper's log file (helpful if installing, uninstalling or starting fails)
-# set.RHQ_STORAGE_PASSWORD_PROMPT - TRUE if password needs to be typed on
-# the console when installing. FALSE
-# requires RHQ_STORAGE_PASSWORD to be set.
# set.RHQ_STORAGE_PASSWORD - the password of the user that is to
-# run the service. Only used if
-# RHQ_STORAGE_PASSWORD_PROMPT is FALSE.
+# run the service.
# set.RHQ_JAVA_EXE_FILE_PATH - Java executable
#*****************************************************************************
@@ -166,7 +162,7 @@ wrapper.ntservice.console=FALSE
# If prompt is true, the user will be prompted for the password. If false,
# the password configuration property will be used.
#wrapper.ntservice.account=.\username
-wrapper.ntservice.password.prompt=%RHQ_STORAGE_PASSWORD_PROMPT%
+wrapper.ntservice.password.prompt=false
wrapper.ntservice.password=%RHQ_STORAGE_PASSWORD%
#*****************************************************************************
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 174e29808171c4b0386b4935b31183b8d228e5fb
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Wed Nov 27 10:39:25 2013 -0500
[BZ 1034236] One more property check for original and updated property parsing.
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 2fc875d..a042e77 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
@@ -683,7 +683,7 @@ SystemSetting.LDAP_GROUP_QUERY_PAGE_SIZE.name(), ""
// Setup SSL if requested
String value = env.getProperty(SystemSetting.USE_SSL_FOR_LDAP.getInternalName());
- boolean ldapSsl = "ssl".equalsIgnoreCase(value);
+ boolean ldapSsl = "ssl".equalsIgnoreCase(value) || "true".equalsIgnoreCase(value);
if (ldapSsl) {
String ldapSocketFactory = env.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 06e0317aa27afdfd00f4bfc584b3bffb62ae75c9
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Wed Nov 27 10:39:25 2013 -0500
[BZ 1034236] One more property check for original and updated property parsing.
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 2fc875d..a042e77 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
@@ -683,7 +683,7 @@ SystemSetting.LDAP_GROUP_QUERY_PAGE_SIZE.name(), ""
// Setup SSL if requested
String value = env.getProperty(SystemSetting.USE_SSL_FOR_LDAP.getInternalName());
- boolean ldapSsl = "ssl".equalsIgnoreCase(value);
+ boolean ldapSsl = "ssl".equalsIgnoreCase(value) || "true".equalsIgnoreCase(value);
if (ldapSsl) {
String ldapSocketFactory = env.getProperty("java.naming.ldap.factory.socket");
if (ldapSocketFactory == null) {
10 years, 5 months
[rhq] Branch 'release/jon3.2.x' - 2 commits - modules/enterprise
by mike thompson
modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java | 360 ++++------
modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java | 318 +++-----
2 files changed, 316 insertions(+), 362 deletions(-)
New commits:
commit a0452e14bb4958093d8ece81e29caec017e45bf2
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Tue Nov 26 14:46:14 2013 -0800
[BZ 1034852] time range change in summary->activity doesn't change time range in monitoring->metrics
(cherry picked from commit 6b6f1894258cb4dcbcd2cdcf82908a1d266f3f59)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
index b3b734a..c1d7269 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
@@ -33,6 +33,9 @@ import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.Window;
+import com.smartgwt.client.widgets.events.CloseClickEvent;
+import com.smartgwt.client.widgets.events.CloseClickHandler;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.events.SubmitValuesEvent;
import com.smartgwt.client.widgets.form.events.SubmitValuesHandler;
@@ -67,7 +70,6 @@ import org.rhq.coregui.client.dashboard.portlets.PortletConfigurationEditorCompo
import org.rhq.coregui.client.dashboard.portlets.PortletConfigurationEditorComponent.Constant;
import org.rhq.coregui.client.gwt.GWTServiceLookup;
import org.rhq.coregui.client.inventory.common.detail.summary.AbstractActivityView;
-import org.rhq.coregui.client.inventory.common.detail.summary.AbstractActivityView.ChartViewWindow;
import org.rhq.coregui.client.inventory.common.graph.CustomDateRangeState;
import org.rhq.coregui.client.inventory.groups.detail.monitoring.table.CompositeGroupD3GraphListView;
import org.rhq.coregui.client.inventory.groups.detail.monitoring.table.CompositeGroupD3MultiLineGraph;
@@ -83,6 +85,7 @@ import org.rhq.coregui.client.util.enhanced.EnhancedVLayout;
*/
public class GroupMetricsPortlet extends EnhancedVLayout implements CustomSettingsPortlet, AutoRefreshPortlet {
+ public static final String CHART_TITLE = MSG.common_title_metric_chart();
private int groupId = -1;
private EntityContext context;
protected Canvas recentMeasurementsContent = new Canvas();
@@ -99,6 +102,10 @@ public class GroupMetricsPortlet extends EnhancedVLayout implements CustomSettin
protected Timer refreshTimer;
+ // final version needed to pass to anon classes
+ // so we can call refresh in anon callback handler
+ final protected GroupMetricsPortlet refreshablePortlet;
+
//defines the list of configuration elements to load/persist for this portlet
protected static List<String> CONFIG_INCLUDE = new ArrayList<String>();
static {
@@ -113,6 +120,7 @@ public class GroupMetricsPortlet extends EnhancedVLayout implements CustomSettin
super();
this.groupId = context.getGroupId();
this.context = context;
+ this.refreshablePortlet = this;
}
@Override
@@ -372,7 +380,7 @@ public class GroupMetricsPortlet extends EnhancedVLayout implements CustomSettin
@Override
public void onClick(ClickEvent event) {
ChartViewWindow window = new ChartViewWindow(
- title);
+ title, "", refreshablePortlet);
CompositeGroupD3GraphListView graph = new CompositeGroupD3MultiLineGraph(
groupId, md.getId(), isAutoGroup);
window.addItem(graph);
@@ -489,4 +497,40 @@ public class GroupMetricsPortlet extends EnhancedVLayout implements CustomSettin
protected void setRefreshing(boolean currentlyRefreshing) {
this.currentlyLoading = currentlyRefreshing;
}
+ public static class ChartViewWindow extends Window {
+
+
+ public ChartViewWindow(String title, String windowTitle,final GroupMetricsPortlet portlet) {
+ super();
+ if ((windowTitle != null) && (!windowTitle.trim().isEmpty())) {
+ setTitle(windowTitle + ": " + title);
+ } else {
+ setTitle(CHART_TITLE + ": " + title);
+ }
+ setShowMinimizeButton(false);
+ setShowMaximizeButton(false);
+ setShowCloseButton(true);
+ setIsModal(true);
+ setShowModalMask(true);
+ setWidth(950);
+ setHeight(420);
+ setShowResizer(true);
+ setCanDragResize(true);
+ centerInPage();
+
+ addCloseClickHandler(new CloseClickHandler() {
+ @Override
+ public void onCloseClick(CloseClickEvent event) {
+ try {
+ ChartViewWindow.this.destroy();
+ portlet.refresh();
+
+ } catch (Throwable e) {
+ Log.warn("Cannot destroy chart display window.", e);
+ }
+ }
+ });
+
+ }
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
index 862749d..ddd70a3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
@@ -55,7 +55,6 @@ import org.rhq.coregui.client.dashboard.PortletViewFactory;
import org.rhq.coregui.client.dashboard.portlets.groups.GroupMetricsPortlet;
import org.rhq.coregui.client.gwt.GWTServiceLookup;
import org.rhq.coregui.client.inventory.common.detail.summary.AbstractActivityView;
-import org.rhq.coregui.client.inventory.common.detail.summary.AbstractActivityView.ChartViewWindow;
import org.rhq.coregui.client.inventory.common.graph.CustomDateRangeState;
import org.rhq.coregui.client.inventory.resource.detail.monitoring.D3GraphListView;
import org.rhq.coregui.client.inventory.resource.type.ResourceTypeRepository;
@@ -240,7 +239,7 @@ public class ResourceMetricsPortlet extends GroupMetricsPortlet {
link.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
- window = new ChartViewWindow(title);
+ window = new ChartViewWindow(title,"", refreshablePortlet);
graphView = D3GraphListView.createSingleGraph(
resourceComposite.getResource(), md.getId(),
commit 393d350149f01f0c30b3b897c1f68acd9f6453ef
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Tue Nov 26 12:20:40 2013 -0800
[BZ 1035443] Summary Last Metrics values are different values than Chart Last Metric values.
(cherry picked from commit a532e90dd41ce1fcfb3f3d9fbdf126448ac80c1c)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
index 9fe962c..b3b734a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
@@ -68,15 +68,16 @@ import org.rhq.coregui.client.dashboard.portlets.PortletConfigurationEditorCompo
import org.rhq.coregui.client.gwt.GWTServiceLookup;
import org.rhq.coregui.client.inventory.common.detail.summary.AbstractActivityView;
import org.rhq.coregui.client.inventory.common.detail.summary.AbstractActivityView.ChartViewWindow;
+import org.rhq.coregui.client.inventory.common.graph.CustomDateRangeState;
import org.rhq.coregui.client.inventory.groups.detail.monitoring.table.CompositeGroupD3GraphListView;
import org.rhq.coregui.client.inventory.groups.detail.monitoring.table.CompositeGroupD3MultiLineGraph;
import org.rhq.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.coregui.client.util.BrowserUtility;
import org.rhq.coregui.client.util.Log;
-import org.rhq.coregui.client.util.MeasurementUtility;
import org.rhq.coregui.client.util.enhanced.EnhancedVLayout;
-/**This portlet allows the end user to customize the metric display
+/**
+ * This portlet allows the end user to customize the metric display
*
* @author Simeon Pinder
*/
@@ -86,11 +87,6 @@ public class GroupMetricsPortlet extends EnhancedVLayout implements CustomSettin
private EntityContext context;
protected Canvas recentMeasurementsContent = new Canvas();
protected boolean currentlyLoading = false;
- protected long start = -1;
- protected long end = -1;
- protected int lastN = -1;
- protected int units = -1;
-
// A non-displayed, persisted identifier for the portlet
public static final String KEY = "GroupMetrics";
// A default displayed, persisted name for the portlet
@@ -216,46 +212,11 @@ public class GroupMetricsPortlet extends EnhancedVLayout implements CustomSettin
* digits.
*/
protected void getRecentMetrics() {
- final DashboardPortlet storedPortlet = this.portletWindow.getStoredPortlet();
- final Configuration portletConfig = storedPortlet.getConfiguration();
//display container
final VLayout column = new VLayout();
column.setHeight(10);//pack
- //initialize to defaults
- end = -1;
- start = -1;
- lastN = -1;
- units = -1;
-
- //result timeframe if enabled
- PropertySimple property = portletConfig.getSimple(Constant.METRIC_RANGE_ENABLE);
- if (null != property && Boolean.valueOf(property.getBooleanValue())) {//then proceed setting
-
- boolean isAdvanced = Boolean.valueOf(portletConfig.getSimpleValue(Constant.METRIC_RANGE_BEGIN_END_FLAG,
- Constant.METRIC_RANGE_BEGIN_END_FLAG_DEFAULT));
- if (isAdvanced) {
- //Advanced time settings
- String currentSetting = portletConfig.getSimpleValue(Constant.METRIC_RANGE,
- Constant.METRIC_RANGE_DEFAULT);
- String[] range = currentSetting.split(",");
- if (range.length == 2) {
- start = Long.valueOf(range[0]);
- end = Long.valueOf(range[1]);
- }
- } else {
- //Simple time settings
- property = portletConfig.getSimple(Constant.METRIC_RANGE_LASTN);
- if (property != null) {
- lastN = Integer.valueOf(portletConfig.getSimpleValue(Constant.METRIC_RANGE_LASTN,
- Constant.METRIC_RANGE_LASTN_DEFAULT));
- units = Integer.valueOf(portletConfig.getSimpleValue(Constant.METRIC_RANGE_UNIT,
- Constant.METRIC_RANGE_UNIT_DEFAULT));
- }
- }
- }
-
//locate resourceGroupRef
ResourceGroupCriteria criteria = new ResourceGroupCriteria();
criteria.addFilterId(this.groupId);
@@ -324,158 +285,151 @@ public class GroupMetricsPortlet extends EnhancedVLayout implements CustomSettin
.getId();
}
- AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>> callback = new AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>>() {
- @Override
- public void onFailure(Throwable caught) {
- Log.debug("Error retrieving recent metrics charting data for group ["
- + groupId + "]:" + caught.getMessage());
- setRefreshing(false);
- }
+ GWTServiceLookup.getMeasurementDataService().findDataForCompatibleGroup(
+ groupId, definitionArrayIds,
+ CustomDateRangeState.getInstance().getStartTime(),
+ CustomDateRangeState.getInstance().getEndTime(), 60,
+ new AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving recent metrics charting data for group ["
+ + groupId + "]:" + caught.getMessage());
+ setRefreshing(false);
+ }
- @Override
- public void onSuccess(
- List<List<MeasurementDataNumericHighLowComposite>> results) {
- if (!results.isEmpty()) {
- boolean someChartedData = false;
- //iterate over the retrieved charting data
- for (int index = 0; index < displayOrder.length; index++) {
- //retrieve the correct measurement definition
- final MeasurementDefinition md = measurementDefMap
- .get(displayOrder[index]);
-
- //load the data results for the given metric definition
- List<MeasurementDataNumericHighLowComposite> data = results
- .get(index);
-
- //locate last and minimum values.
- double lastValue = -1;
- double minValue = Double.MAX_VALUE;//
- for (MeasurementDataNumericHighLowComposite d : data) {
- if ((!Double.isNaN(d.getValue()))
- && (String.valueOf(d.getValue()).indexOf("NaN") == -1)) {
- if (d.getValue() < minValue) {
- minValue = d.getValue();
+ @Override
+ public void onSuccess(
+ List<List<MeasurementDataNumericHighLowComposite>> results) {
+ if (!results.isEmpty()) {
+ boolean someChartedData = false;
+ //iterate over the retrieved charting data
+ for (int index = 0; index < displayOrder.length; index++) {
+ //retrieve the correct measurement definition
+ final MeasurementDefinition md = measurementDefMap
+ .get(displayOrder[index]);
+
+ //load the data results for the given metric definition
+ List<MeasurementDataNumericHighLowComposite> data = results
+ .get(index);
+
+ //locate last and minimum values.
+ double lastValue = -1;
+ double minValue = Double.MAX_VALUE;//
+ for (MeasurementDataNumericHighLowComposite d : data) {
+ if ((!Double.isNaN(d.getValue()))
+ && (!String.valueOf(d.getValue()).contains("NaN"))) {
+ if (d.getValue() < minValue) {
+ minValue = d.getValue();
+ }
+ lastValue = d.getValue();
}
- lastValue = d.getValue();
}
- }
- //collapse the data into comma delimited list for consumption by third party javascript library(jquery.sparkline)
- String commaDelimitedList = "";
+ //collapse the data into comma delimited list for consumption by third party javascript library(jquery.sparkline)
+ String commaDelimitedList = "";
- for (MeasurementDataNumericHighLowComposite d : data) {
- if ((!Double.isNaN(d.getValue()))
- && (String.valueOf(d.getValue()).indexOf("NaN") == -1)) {
- commaDelimitedList += d.getValue() + ",";
+ for (MeasurementDataNumericHighLowComposite d : data) {
+ if ((!Double.isNaN(d.getValue()))
+ && (!String.valueOf(d.getValue()).contains("NaN"))) {
+ commaDelimitedList += d.getValue() + ",";
+ }
}
- }
- DynamicForm row = new DynamicForm();
- row.setNumCols(3);
- row.setColWidths(65, "*", 100);
- row.setWidth100();
- row.setAutoHeight();
- row.setOverflow(Overflow.VISIBLE);
- HTMLFlow graph = new HTMLFlow();
- // String contents = "<span id='sparkline_" + index + "' class='dynamicsparkline' width='0'>"
- // + commaDelimitedList + "</span>";
- String contents = "<span id='sparkline_" + index
- + "' class='dynamicsparkline' width='0' " + "values='"
- + commaDelimitedList + "'>...</span>";
- graph.setContents(contents);
- graph.setContentsType(ContentsType.PAGE);
- //disable scrollbars on span
- graph.setScrollbarSize(0);
-
- CanvasItem graphContainer = new CanvasItem();
- graphContainer.setShowTitle(false);
- graphContainer.setHeight(16);
- graphContainer.setWidth(60);
- graphContainer.setCanvas(graph);
-
- final String title = md.getDisplayName();
- LinkItem link = AbstractActivityView.newLinkItem(title, null);
- link.setTooltip(title);
- link.setTitleVAlign(VerticalAlignment.TOP);
- link.setAlign(Alignment.LEFT);
- link.setClipValue(true);
- link.setWrap(true);
- link.setHeight(26);
- if(!BrowserUtility.isBrowserPreIE9()){
-
- link.addClickHandler(new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- ChartViewWindow window = new ChartViewWindow(title);
- CompositeGroupD3GraphListView graph = new CompositeGroupD3MultiLineGraph(
- groupId, md.getId(), isAutoGroup);
- window.addItem(graph);
- graph.populateData();
- window.show();
+ DynamicForm row = new DynamicForm();
+ row.setNumCols(3);
+ row.setColWidths(65, "*", 100);
+ row.setWidth100();
+ row.setAutoHeight();
+ row.setOverflow(Overflow.VISIBLE);
+ HTMLFlow graph = new HTMLFlow();
+ // String contents = "<span id='sparkline_" + index + "' class='dynamicsparkline' width='0'>"
+ // + commaDelimitedList + "</span>";
+ String contents = "<span id='sparkline_" + index
+ + "' class='dynamicsparkline' width='0' " + "values='"
+ + commaDelimitedList + "'>...</span>";
+ graph.setContents(contents);
+ graph.setContentsType(ContentsType.PAGE);
+ //disable scrollbars on span
+ graph.setScrollbarSize(0);
+
+ CanvasItem graphContainer = new CanvasItem();
+ graphContainer.setShowTitle(false);
+ graphContainer.setHeight(16);
+ graphContainer.setWidth(60);
+ graphContainer.setCanvas(graph);
+
+ final String title = md.getDisplayName();
+ LinkItem link = AbstractActivityView.newLinkItem(title,
+ null);
+ link.setTooltip(title);
+ link.setTitleVAlign(VerticalAlignment.TOP);
+ link.setAlign(Alignment.LEFT);
+ link.setClipValue(true);
+ link.setWrap(true);
+ link.setHeight(26);
+ if (!BrowserUtility.isBrowserPreIE9()) {
+
+ link.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ ChartViewWindow window = new ChartViewWindow(
+ title);
+ CompositeGroupD3GraphListView graph = new CompositeGroupD3MultiLineGraph(
+ groupId, md.getId(), isAutoGroup);
+ window.addItem(graph);
+ graph.populateData();
+ window.show();
+ }
+ });
+ } else {
+ link.disable();
}
- });
- }else {
- link.disable();
- }
-
- //Value
- String convertedValue = AbstractActivityView
- .convertLastValueForDisplay(lastValue, md);
- StaticTextItem value = AbstractActivityView
- .newTextItem(convertedValue);
- value.setVAlign(VerticalAlignment.TOP);
- value.setAlign(Alignment.RIGHT);
- value.setWidth("100%");
-
- row.setItems(graphContainer, link, value);
- row.setWidth100();
- //if graph content returned
- if ((!md.getName().trim().contains("Trait."))
- && (lastValue != -1)) {
+ //Value
+ String convertedValue = AbstractActivityView
+ .convertLastValueForDisplay(lastValue, md);
+ StaticTextItem value = AbstractActivityView
+ .newTextItem(convertedValue);
+ value.setVAlign(VerticalAlignment.TOP);
+ value.setAlign(Alignment.RIGHT);
+ value.setWidth("100%");
+
+ row.setItems(graphContainer, link, value);
+ row.setWidth100();
+ //if graph content returned
+ if ((!md.getName().trim().contains("Trait."))
+ && (lastValue != -1)) {
+ column.addMember(row);
+ someChartedData = true;
+ }
+ }
+ if (!someChartedData) {// when there are results but no chartable entries.
+ DynamicForm row = AbstractActivityView
+ .createEmptyDisplayRow(AbstractActivityView.RECENT_MEASUREMENTS_GROUP_NONE);
column.addMember(row);
- someChartedData = true;
+ } else {
+ //insert see more link
+ DynamicForm row = new DynamicForm();
+ String link = LinkManager
+ .getGroupMonitoringGraphsLink(context);
+ AbstractActivityView.addSeeMoreLink(row, link, column);
}
- }
- if (!someChartedData) {// when there are results but no chartable entries.
- DynamicForm row = AbstractActivityView
- .createEmptyDisplayRow(AbstractActivityView.RECENT_MEASUREMENTS_GROUP_NONE);
- column.addMember(row);
+ //call out to 3rd party javascript lib
+ new Timer() {
+ @Override
+ public void run() {
+ BrowserUtility.graphSparkLines();
+ }
+ }.schedule(200);
+
} else {
- //insert see more link
- DynamicForm row = new DynamicForm();
- String link = LinkManager.getGroupMonitoringGraphsLink(context);
- AbstractActivityView.addSeeMoreLink(row, link, column);
+ DynamicForm row = AbstractActivityView.createEmptyDisplayRow(
+ AbstractActivityView.RECENT_MEASUREMENTS_GROUP_NONE);
+ column.addMember(row);
}
- //call out to 3rd party javascript lib
- new Timer(){
- @Override
- public void run() {
- BrowserUtility.graphSparkLines();
- }
- }.schedule(200);
- } else {
- DynamicForm row = AbstractActivityView.createEmptyDisplayRow(
-
- AbstractActivityView.RECENT_MEASUREMENTS_GROUP_NONE);
- column.addMember(row);
+ setRefreshing(false);
}
- setRefreshing(false);
}
- };
-
- //make the asynchronous call for all the measurement data
- if (end != -1 && start != -1) {
- GWTServiceLookup.getMeasurementDataService().findDataForCompatibleGroup(
- groupId, definitionArrayIds, start, end, 60, callback);
- } else if (lastN != -1 && units != -1) {
- GWTServiceLookup.getMeasurementDataService()
- .findDataForCompatibleGroupForLast(groupId, definitionArrayIds, lastN,
- units, 60, callback);
- } else {
- GWTServiceLookup.getMeasurementDataService()
- .findDataForCompatibleGroupForLast(groupId, definitionArrayIds, 8,
- MeasurementUtility.UNIT_HOURS, 60, callback);
- }
+ );
}
});
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
index d470663..862749d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
@@ -41,8 +41,6 @@ import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.common.EntityContext;
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.core.domain.measurement.MeasurementDefinition;
@@ -54,18 +52,18 @@ import org.rhq.core.domain.util.PageList;
import org.rhq.coregui.client.LinkManager;
import org.rhq.coregui.client.dashboard.Portlet;
import org.rhq.coregui.client.dashboard.PortletViewFactory;
-import org.rhq.coregui.client.dashboard.portlets.PortletConfigurationEditorComponent.Constant;
import org.rhq.coregui.client.dashboard.portlets.groups.GroupMetricsPortlet;
import org.rhq.coregui.client.gwt.GWTServiceLookup;
import org.rhq.coregui.client.inventory.common.detail.summary.AbstractActivityView;
import org.rhq.coregui.client.inventory.common.detail.summary.AbstractActivityView.ChartViewWindow;
+import org.rhq.coregui.client.inventory.common.graph.CustomDateRangeState;
import org.rhq.coregui.client.inventory.resource.detail.monitoring.D3GraphListView;
import org.rhq.coregui.client.inventory.resource.type.ResourceTypeRepository;
import org.rhq.coregui.client.util.BrowserUtility;
import org.rhq.coregui.client.util.Log;
-import org.rhq.coregui.client.util.MeasurementUtility;
-/**This portlet allows the end user to customize the metric display
+/**
+ * This portlet allows the end user to customize the metric display
*
* @author Simeon Pinder
*/
@@ -106,45 +104,11 @@ public class ResourceMetricsPortlet extends GroupMetricsPortlet {
@Override
protected void getRecentMetrics() {
final DashboardPortlet storedPortlet = this.portletWindow.getStoredPortlet();
- final Configuration portletConfig = storedPortlet.getConfiguration();
//display container
final VLayout column = new VLayout();
column.setHeight(10);//pack
column.setWidth100();
- //initialize to defaults
- end = -1;
- start = -1;
- lastN = -1;
- units = -1;
-
- //result timeframe if enabled
- PropertySimple property = portletConfig.getSimple(Constant.METRIC_RANGE_ENABLE);
- if (null != property && property.getBooleanValue()) {//then proceed setting
-
- boolean isAdvanced = Boolean.valueOf(portletConfig.getSimpleValue(Constant.METRIC_RANGE_BEGIN_END_FLAG,
- Constant.METRIC_RANGE_BEGIN_END_FLAG_DEFAULT));
- if (isAdvanced) {
- //Advanced time settings
- String currentSetting = portletConfig.getSimpleValue(Constant.METRIC_RANGE,
- Constant.METRIC_RANGE_DEFAULT);
- String[] range = currentSetting.split(",");
- if (range.length == 2) {
- start = Long.valueOf(range[0]);
- end = Long.valueOf(range[1]);
- }
- } else {
- //Simple time settings
- property = portletConfig.getSimple(Constant.METRIC_RANGE_LASTN);
- if (property != null) {
- lastN = Integer.valueOf(portletConfig.getSimpleValue(Constant.METRIC_RANGE_LASTN,
- Constant.METRIC_RANGE_LASTN_DEFAULT));
- units = Integer.valueOf(portletConfig.getSimpleValue(Constant.METRIC_RANGE_UNIT,
- Constant.METRIC_RANGE_UNIT_DEFAULT));
- }
- }
- }
-
//locate resource reference
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterId(this.resourceId);
@@ -166,9 +130,8 @@ public class ResourceMetricsPortlet extends GroupMetricsPortlet {
final Resource resource = resourceComposite.getResource();
// Load the fully fetched ResourceType.
ResourceType resourceType = resource.getResourceType();
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(
- resourceType.getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.measurements ),
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(resourceType.getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.measurements),
new ResourceTypeRepository.TypeLoadedCallback() {
public void onTypesLoaded(ResourceType type) {
resource.setResourceType(type);
@@ -194,158 +157,152 @@ public class ResourceMetricsPortlet extends GroupMetricsPortlet {
.getId();
}
- AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>> callback = new AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>>() {
- @Override
- public void onFailure(Throwable caught) {
- Log.debug("Error retrieving recent metrics charting data for resource ["
- + resourceId + "]:" + caught.getMessage());
- setRefreshing(false);
- }
+ GWTServiceLookup.getMeasurementDataService().findDataForResource(resourceId,
+ definitionArrayIds, CustomDateRangeState.getInstance().getStartTime(),
+ CustomDateRangeState.getInstance().getEndTime(), 60,
+ new AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.debug("Error retrieving recent metrics charting data for resource ["
+ + resourceId + "]:" + caught.getMessage());
+ setRefreshing(false);
+ }
- @Override
- public void onSuccess(List<List<MeasurementDataNumericHighLowComposite>> results) {
- if (!results.isEmpty()) {
- boolean someChartedData = false;
- //iterate over the retrieved charting data
- for (int index = 0; index < displayOrder.length; index++) {
- //retrieve the correct measurement definition
- final MeasurementDefinition md = measurementDefMap
- .get(displayOrder[index]);
-
- //load the data results for the given metric definition
- List<MeasurementDataNumericHighLowComposite> data = results
- .get(index);
-
- //locate last and minimum values.
- double lastValue = -1;
- double minValue = Double.MAX_VALUE;//
- for (MeasurementDataNumericHighLowComposite d : data) {
- if ((!Double.isNaN(d.getValue()))
- && (!String.valueOf(d.getValue()).contains("NaN"))) {
- if (d.getValue() < minValue) {
- minValue = d.getValue();
+ @Override
+ public void onSuccess(
+ List<List<MeasurementDataNumericHighLowComposite>> results) {
+ if (!results.isEmpty()) {
+ boolean someChartedData = false;
+ //iterate over the retrieved charting data
+ for (int index = 0; index < displayOrder.length; index++) {
+ //retrieve the correct measurement definition
+ final MeasurementDefinition md = measurementDefMap
+ .get(displayOrder[index]);
+
+ //load the data results for the given metric definition
+ List<MeasurementDataNumericHighLowComposite> data = results
+ .get(index);
+
+ //locate last and minimum values.
+ double lastValue = -1;
+ double minValue = Double.MAX_VALUE;//
+ for (MeasurementDataNumericHighLowComposite d : data) {
+ if ((!Double.isNaN(d.getValue()))
+ && (!String.valueOf(d.getValue()).contains("NaN"))) {
+ if (d.getValue() < minValue) {
+ minValue = d.getValue();
+ }
+ lastValue = d.getValue();
}
- lastValue = d.getValue();
}
- }
- //collapse the data into comma delimited list for consumption by third party javascript library(jquery.sparkline)
- String commaDelimitedList = "";
+ //collapse the data into comma delimited list for consumption by third party javascript library(jquery.sparkline)
+ String commaDelimitedList = "";
- for (MeasurementDataNumericHighLowComposite d : data) {
- if ((!Double.isNaN(d.getValue()))
- && (!String.valueOf(d.getValue()).contains("NaN"))) {
- commaDelimitedList += d.getValue() + ",";
- }
- }
- DynamicForm row = new DynamicForm();
- row.setNumCols(3);
- row.setColWidths(65, "*", 100);
- row.setWidth100();
- row.setAutoHeight();
- row.setOverflow(Overflow.VISIBLE);
- HTMLFlow sparklineGraph = new HTMLFlow();
- String contents = "<span id='sparkline_" + index
- + "' class='dynamicsparkline' width='0' " + "values='"
- + commaDelimitedList + "'>...</span>";
- sparklineGraph.setContents(contents);
- sparklineGraph.setContentsType(ContentsType.PAGE);
- //disable scrollbars on span
- sparklineGraph.setScrollbarSize(0);
-
- CanvasItem sparklineContainer = new CanvasItem();
- sparklineContainer.setShowTitle(false);
- sparklineContainer.setHeight(16);
- sparklineContainer.setWidth(60);
- sparklineContainer.setCanvas(sparklineGraph);
-
- //Link/title element
- final String title = md.getDisplayName();
- LinkItem link = AbstractActivityView.newLinkItem(title, null);
- link.setTooltip(title);
- link.setTitleVAlign(VerticalAlignment.TOP);
- link.setAlign(Alignment.LEFT);
- link.setClipValue(true);
- link.setWrap(true);
- link.setHeight(26);
- link.setWidth("100%");
- if(!BrowserUtility.isBrowserPreIE9()){
- link.addClickHandler(new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- window = new ChartViewWindow(title);
-
- graphView = D3GraphListView
- .createSingleGraph(resourceComposite.getResource(),
- md.getId(), true);
-
- window.addItem(graphView);
- window.show();
+ for (MeasurementDataNumericHighLowComposite d : data) {
+ if ((!Double.isNaN(d.getValue()))
+ && (!String.valueOf(d.getValue()).contains("NaN"))) {
+ commaDelimitedList += d.getValue() + ",";
}
- });
- }else{
- link.disable();
- }
-
-
- //Value
- String convertedValue;
- convertedValue = AbstractActivityView.convertLastValueForDisplay(
- lastValue, md);
- StaticTextItem value = AbstractActivityView
- .newTextItem(convertedValue);
- value.setVAlign(VerticalAlignment.TOP);
- value.setAlign(Alignment.RIGHT);
+ }
+ DynamicForm row = new DynamicForm();
+ row.setNumCols(3);
+ row.setColWidths(65, "*", 100);
+ row.setWidth100();
+ row.setAutoHeight();
+ row.setOverflow(Overflow.VISIBLE);
+ HTMLFlow sparklineGraph = new HTMLFlow();
+ String contents = "<span id='sparkline_" + index
+ + "' class='dynamicsparkline' width='0' " + "values='"
+ + commaDelimitedList + "'>...</span>";
+ sparklineGraph.setContents(contents);
+ sparklineGraph.setContentsType(ContentsType.PAGE);
+ //disable scrollbars on span
+ sparklineGraph.setScrollbarSize(0);
+
+ CanvasItem sparklineContainer = new CanvasItem();
+ sparklineContainer.setShowTitle(false);
+ sparklineContainer.setHeight(16);
+ sparklineContainer.setWidth(60);
+ sparklineContainer.setCanvas(sparklineGraph);
+
+ //Link/title element
+ final String title = md.getDisplayName();
+ LinkItem link = AbstractActivityView.newLinkItem(title, null);
+ link.setTooltip(title);
+ link.setTitleVAlign(VerticalAlignment.TOP);
+ link.setAlign(Alignment.LEFT);
+ link.setClipValue(true);
+ link.setWrap(true);
+ link.setHeight(26);
+ link.setWidth("100%");
+ if (!BrowserUtility.isBrowserPreIE9()) {
+ link.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ window = new ChartViewWindow(title);
+
+ graphView = D3GraphListView.createSingleGraph(
+ resourceComposite.getResource(), md.getId(),
+ true);
+
+ window.addItem(graphView);
+ window.show();
+ }
+ });
+ } else {
+ link.disable();
+ }
- row.setItems(sparklineContainer, link, value);
- row.setWidth100();
+ //Value
+ String convertedValue;
+ convertedValue = AbstractActivityView
+ .convertLastValueForDisplay(lastValue, md);
+ StaticTextItem value = AbstractActivityView
+ .newTextItem(convertedValue);
+ value.setVAlign(VerticalAlignment.TOP);
+ value.setAlign(Alignment.RIGHT);
+
+ row.setItems(sparklineContainer, link, value);
+ row.setWidth100();
+
+ //if graph content returned
+ if ((!md.getName().trim().contains("Trait."))
+ && (lastValue != -1)) {
+ column.addMember(row);
+ someChartedData = true;
+ }
+ }
+ if (!someChartedData) {// when there are results but no chartable entries.
+ DynamicForm row = AbstractActivityView.createEmptyDisplayRow(
- //if graph content returned
- if ((!md.getName().trim().contains("Trait.")) && (lastValue != -1)) {
+ AbstractActivityView.RECENT_MEASUREMENTS_NONE);
column.addMember(row);
- someChartedData = true;
+ } else {
+ //insert see more link
+ DynamicForm row = new DynamicForm();
+ String link = LinkManager
+ .getResourceMonitoringGraphsLink(resourceId);
+ AbstractActivityView.addSeeMoreLink(row, link, column);
}
- }
- if (!someChartedData) {// when there are results but no chartable entries.
- DynamicForm row = AbstractActivityView.createEmptyDisplayRow(
-
- AbstractActivityView.RECENT_MEASUREMENTS_NONE);
- column.addMember(row);
+ //call out to 3rd party javascript lib
+ new Timer() {
+ @Override
+ public void run() {
+ BrowserUtility.graphSparkLines();
+ }
+ }.schedule(200);
} else {
- //insert see more link
- DynamicForm row = new DynamicForm();
- String link = LinkManager
- .getResourceMonitoringGraphsLink(resourceId);
- AbstractActivityView.addSeeMoreLink(row, link, column);
+ DynamicForm row = AbstractActivityView
+ .createEmptyDisplayRow(AbstractActivityView.RECENT_MEASUREMENTS_NONE);
+ column.addMember(row);
}
- //call out to 3rd party javascript lib
- new Timer(){
- @Override
- public void run() {
- BrowserUtility.graphSparkLines();
- }
- }.schedule(200);
- } else {
- DynamicForm row = AbstractActivityView
- .createEmptyDisplayRow(AbstractActivityView.RECENT_MEASUREMENTS_NONE);
- column.addMember(row);
+ setRefreshing(false);
}
- setRefreshing(false);
}
- };
-
- //make the asynchronous call for all the measurement data
- if (end != -1 && start != -1) {
- GWTServiceLookup.getMeasurementDataService().findDataForResource(resourceId,
- definitionArrayIds, start, end, 60, callback);
- } else if (lastN != -1 && units != -1) {
- GWTServiceLookup.getMeasurementDataService().findDataForResourceForLast(
- resourceId, definitionArrayIds, lastN, units, 60, callback);
- } else {
- GWTServiceLookup.getMeasurementDataService().findDataForResourceForLast(
- resourceId, definitionArrayIds, 8, MeasurementUtility.UNIT_HOURS, 60,
- callback);
- }
+
+ );
+
}
});
}
10 years, 5 months
[rhq] Branch 'release/jon3.2.x' - modules/enterprise
by Jiri Kremser
modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html | 5 +++++
modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml | 7 ++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
New commits:
commit 20dffd6feddcf0edff534d4e46e4912829d793ba
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Wed Nov 27 19:46:31 2013 +0100
[BZ 891876] - JON login screen does not appear in IE9 - adding the 'noscript' element that will show the warning if the browser has the JavaScript disabled.
(cherry picked from commit 90d2e708c82a98549c9168f8305a7d3f06cf112f)
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html
index 0362a7e..f56517f 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html
+++ b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html
@@ -65,6 +65,11 @@
<script type="text/javascript" language="javascript"
src="org.rhq.coregui.CoreGUI/org.rhq.coregui.CoreGUI.nocache.js"></script>
+<noscript>
+ <h1>Your browser does not support JavaScript!</h1>
+ <h2>Please turn it on or use a different browser.</h2>
+</noscript>
+
<div id="Loading-Panel" style="width: 214px; height: 90px; margin-top: 300px; margin-left: 40%; margin-right: 40%;">
diff --git a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
index aa9ba6d..3e80a5b 100644
--- a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
+++ b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
@@ -496,7 +496,12 @@
}

checkIfRunning(16);

-->

- </script>'/>
+ </script>


+ <noscript>

+ <h1>Your browser does not support JavaScript!</h1>

+ <h2>Please turn it on or use a different browser.</h2>

+ <h2>You will NOT be automatically redirected...</h2>

+ </noscript>
'/>
<!-- Changing the default content of the welcome page -->
<replaceregexp file="${jboss.home}/welcome-content/index.html" flags="gis" match='<div class="section">(.*?)</div>' replace='
10 years, 5 months
[rhq] modules/enterprise
by Jiri Kremser
modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html | 5 +++++
modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml | 7 ++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
New commits:
commit 90d2e708c82a98549c9168f8305a7d3f06cf112f
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Wed Nov 27 19:46:31 2013 +0100
[BZ 891876] - JON login screen does not appear in IE9 - adding the 'noscript' element that will show the warning if the browser has the JavaScript disabled.
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html
index 0362a7e..f56517f 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html
+++ b/modules/enterprise/gui/coregui/src/main/webapp/CoreGUI.html
@@ -65,6 +65,11 @@
<script type="text/javascript" language="javascript"
src="org.rhq.coregui.CoreGUI/org.rhq.coregui.CoreGUI.nocache.js"></script>
+<noscript>
+ <h1>Your browser does not support JavaScript!</h1>
+ <h2>Please turn it on or use a different browser.</h2>
+</noscript>
+
<div id="Loading-Panel" style="width: 214px; height: 90px; margin-top: 300px; margin-left: 40%; margin-right: 40%;">
diff --git a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
index 3eda658..585ce10 100644
--- a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
+++ b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
@@ -496,7 +496,12 @@
}

checkIfRunning(16);

-->

- </script>'/>
+ </script>


+ <noscript>

+ <h1>Your browser does not support JavaScript!</h1>

+ <h2>Please turn it on or use a different browser.</h2>

+ <h2>You will NOT be automatically redirected...</h2>

+ </noscript>
'/>
<!-- Changing the default content of the welcome page -->
<replaceregexp file="${jboss.home}/welcome-content/index.html" flags="gis" match='<div class="section">(.*?)</div>' replace='
10 years, 5 months
[rhq] Branch 'jay-avail' - modules/core
by mazz
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AvailabilityProxy.java | 72 +++++++---
modules/core/plugin-container/src/test/java/org/rhq/core/pc/inventory/AvailabilityProxyConcurrencyTest.java | 17 +-
2 files changed, 65 insertions(+), 24 deletions(-)
New commits:
commit 7fe7f7efb4d5754d8a0ebdccaa4604a450f3e0db
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Nov 27 12:44:18 2013 -0500
get avail proxy test to pass. we no longer assume that we need to abort if the first time we check if the future is done and it is not.
instead, we check the time when the future was submitted. if its been under a certain time (1m by default), then
we just return the last avail known to have been returned. otherwise, we timeout.
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AvailabilityProxy.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AvailabilityProxy.java
index 4e14581..1bf380f 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AvailabilityProxy.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AvailabilityProxy.java
@@ -52,7 +52,7 @@ public class AvailabilityProxy implements AvailabilityFacet, Callable<Availabili
private static final Log LOG = LogFactory.getLog(AvailabilityProxy.class); // purposefully static, don't create one per proxy
/**
- * How long to wait for a resource to return their availability immediately (in ms).
+ * 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.
*/
@@ -66,6 +66,15 @@ public class AvailabilityProxy implements AvailabilityFacet, Callable<Availabili
*/
private static final int AVAIL_SYNC_TIMEOUT_LIMIT;
+ /**
+ * How long to wait for an *async* future to return a resource availability (in ms).
+ * If a resource takes longer than this during an async call (via a thread from the executor thread pool)
+ * and another request comes in for the availability, then that async call will be canceled and a new
+ * one will be resubmitted, restarting the clock. This just helps clean up any hung threads waiting
+ * for an availability that is just taking too much time to complete.
+ */
+ private static final int AVAIL_ASYNC_TIMEOUT;
+
static {
int syncAvailTimeout;
try {
@@ -86,6 +95,16 @@ public class AvailabilityProxy implements AvailabilityFacet, Callable<Availabili
syncAvailTimeoutLimit = 5;
}
AVAIL_SYNC_TIMEOUT_LIMIT = syncAvailTimeoutLimit;
+
+ int asyncAvailTimeout;
+ try {
+ // unlikely to be changed but back-door configurable
+ asyncAvailTimeout = Integer.parseInt(System.getProperty(
+ "rhq.agent.plugins.availability-scan.async-timeout", "60000"));
+ } catch (Throwable t) {
+ asyncAvailTimeout = 60000;
+ }
+ AVAIL_ASYNC_TIMEOUT = asyncAvailTimeout;
}
private final AvailabilityFacet resourceComponent;
@@ -96,7 +115,9 @@ public class AvailabilityProxy implements AvailabilityFacet, Callable<Availabili
private volatile Thread current;
- private AvailabilityType last = UNKNOWN;
+ private long lastSubmitTime = 0;
+
+ private AvailabilityType lastAvail = UNKNOWN;
/**
* Number of consecutive avail sync timeouts for the resource. This value is reset if availability is
@@ -149,25 +170,33 @@ public class AvailabilityProxy implements AvailabilityFacet, Callable<Availabili
avail = availabilityFuture.get();
} else {
- // if the future is not done then it means this thread has been checking avail since the
- // last scheduled avail check. Not good. Throw a detailed exception to the avail checker..
- Throwable t = new Throwable();
- if (current != null) {
- t.setStackTrace(current.getStackTrace());
+ // We are still waiting on the previously submitted async avail check - let's just return
+ // the last one we got. Note that if the future is not done after a large amount of time,
+ // then it means this thread could somehow be hung or otherwise stuck and not returning. Not good.
+ // In this case, throw a detailed exception to the avail checker.
+ if ((System.currentTimeMillis() - lastSubmitTime) > AVAIL_ASYNC_TIMEOUT) {
+ Throwable t = new Throwable();
+ if (current != null) {
+ t.setStackTrace(current.getStackTrace());
+ }
+ String msg = "Availability check running too long, canceled for [" + resourceComponent
+ + "]; Stack trace includes the timed out thread's stack trace.";
+ availabilityFuture.cancel(true);
+
+ // try again, maybe the situation will resolve in time for the next check
+ availabilityFuture = executor.submit(this);
+ lastSubmitTime = System.currentTimeMillis();
+
+ throw new TimeoutException(msg, t);
+ } else {
+ return lastAvail;
}
- String msg = "Availability check running too long, canceled for " + resourceComponent
- + "; Stack trace includes the timed out thread's stack trace.";
- availabilityFuture.cancel(true);
-
- // try again, maybe the situation will resolve in time for the next check
- availabilityFuture = executor.submit(this);
-
- throw new TimeoutException(msg, t);
}
}
// request a thread to do an avail check
availabilityFuture = executor.submit(this);
+ lastSubmitTime = System.currentTimeMillis();
// if we have exceeded the timeout too many times in a row assume that this is a slow
// resource and stop performing synchronous checks, which would likely fail to return fast enough anyway.
@@ -213,7 +242,7 @@ public class AvailabilityProxy implements AvailabilityFacet, Callable<Availabili
break;
default:
if (LOG.isDebugEnabled()) {
- LOG.debug("ResourceComponent " + resourceComponent + " getAvailability() returned " + type
+ LOG.debug("ResourceComponent [" + resourceComponent + "] getAvailability() returned " + type
+ ". This is invalid and is being replaced with DOWN.");
}
result = DOWN;
@@ -222,18 +251,18 @@ public class AvailabilityProxy implements AvailabilityFacet, Callable<Availabili
// whenever changing to UP we reset the timeout counter. This is because DOWN resources often respond
// slowly to getAvailability() calls (for example, waiting for a connection attempt to time out). When a
// resource comes up we should give it a chance to respond quickly and provide live avail.
- if (result != last) {
+ if (result != lastAvail) {
if (result == UP) {
if (availAsyncConsecutiveTimeouts >= AVAIL_SYNC_TIMEOUT_LIMIT) {
if (LOG.isDebugEnabled()) {
LOG.debug("Enabling synchronous availability collection for [" + resourceComponent
- + "]; Availability has just changed from [" + last + "] to UP.");
+ + "]; Availability has just changed from [" + lastAvail + "] to UP.");
}
}
availAsyncConsecutiveTimeouts = 0;
}
- last = result;
+ lastAvail = result;
}
return result;
@@ -244,8 +273,9 @@ public class AvailabilityProxy implements AvailabilityFacet, Callable<Availabili
*/
@Override
public String toString() {
- return "AvailabilityProxy [resourceComponent=" + resourceComponent + ", executor=" + executor
- + ", availabilityFuture=" + availabilityFuture + ", current=" + current + ", timeouts="
+ return "AvailabilityProxy [resourceComponent=" + resourceComponent + ", lastAvail=" + lastAvail
+ + ", lastSubmitTime=" + new java.util.Date(lastSubmitTime) + ", executor="
+ + executor + ", availabilityFuture=" + availabilityFuture + ", current=" + current + ", timeouts="
+ availAsyncConsecutiveTimeouts + "]";
}
}
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/inventory/AvailabilityProxyConcurrencyTest.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/inventory/AvailabilityProxyConcurrencyTest.java
index f2880dd..06753ca 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/inventory/AvailabilityProxyConcurrencyTest.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/inventory/AvailabilityProxyConcurrencyTest.java
@@ -26,15 +26,18 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
import org.testng.annotations.Test;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.pluginapi.availability.AvailabilityFacet;
-@Test(enabled = false)
+@Test
public class AvailabilityProxyConcurrencyTest implements AvailabilityFacet {
+ private AtomicInteger numberOfFacetCalls = new AtomicInteger(-1);
+
public void testConcurrentAvailChecks() throws Exception {
Thread.interrupted(); // clear any hanging around interrupt status
@@ -48,7 +51,7 @@ public class AvailabilityProxyConcurrencyTest implements AvailabilityFacet {
assert UP.equals(firstAvail) : "Can't even get our first avail correctly: " + firstAvail;
// create several threads that will concurrently call getAvailability
- final int numThreads = 2;
+ final int numThreads = 10;
final Hashtable<String, AvailabilityType> availResults = new Hashtable<String, AvailabilityType>(numThreads);
final Hashtable<String, Date> dateResults = new Hashtable<String, Date>(numThreads);
final Hashtable<String, Throwable> throwableResults = new Hashtable<String, Throwable>(numThreads);
@@ -68,6 +71,7 @@ public class AvailabilityProxyConcurrencyTest implements AvailabilityFacet {
}
}
};
+ numberOfFacetCalls.set(0); // this will count how many times the proxy actually calls the facet getAvail method
for (int i = 0; i < numThreads; i++) {
Thread t = new Thread(runnable, "t" + i);
t.start();
@@ -86,6 +90,12 @@ public class AvailabilityProxyConcurrencyTest implements AvailabilityFacet {
for (AvailabilityType availtype : availResults.values()) {
assert availtype.equals(UP) : "Failed, bad avail: availResults = " + availResults;
}
+
+ // make sure we actually tested the code we need to test - we should not be making
+ // individual facet calls for each request because we shotgun the requests so fast,
+ // and the facet sleeps so long, that the proxy should return the last avail rather
+ // than requiring a new facet call.
+ assert (numberOfFacetCalls.get()) < numThreads : numberOfFacetCalls;
} finally {
executor.shutdownNow();
}
@@ -94,7 +104,8 @@ public class AvailabilityProxyConcurrencyTest implements AvailabilityFacet {
@Override
public synchronized AvailabilityType getAvailability() {
try {
- Thread.sleep(750);
+ System.out.println("~~~AVAILABILITY FACET CALL #" + numberOfFacetCalls.incrementAndGet());
+ Thread.sleep(250); // just make it slow enough so a few proxy calls are done concurrently while this method is running
} catch (Exception e) {
System.out.println("~~~AVAILABILITY SLEEP WAS ABORTED: " + e);
}
10 years, 5 months