modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinition.java
| 10 ++-
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java
| 6 +-
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AvailabilityExecutor.java
| 4 -
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/ResourceContainer.java
| 30 ++++++----
modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server.sh
| 6 +-
modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-server-wrapper.conf
| 3 +
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/PROPERTY_VALUE.java
| 24 +++++---
7 files changed, 56 insertions(+), 27 deletions(-)
New commits:
commit ac34372eebdb57ff9ef9fafcf9842f9a81f20048
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Jan 2 11:42:36 2014 +0100
Use a long for scheduleTime and inline the SlimAvailability into fields. Saves another
32bytes per resource
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AvailabilityExecutor.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AvailabilityExecutor.java
index d21505e..a6a87fe 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AvailabilityExecutor.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/AvailabilityExecutor.java
@@ -240,12 +240,12 @@ public class AvailabilityExecutor implements Runnable,
Callable<AvailabilityRepo
// See if this resource is scheduled for an avail check
boolean checkAvail = false;
boolean deferToParent = false;
- Long availabilityScheduleTime = resourceContainer.getAvailabilityScheduleTime();
+ long availabilityScheduleTime = resourceContainer.getAvailabilityScheduleTime();
MeasurementScheduleRequest availScheduleRequest =
resourceContainer.getAvailabilitySchedule();
// if no avail check is scheduled or we're forcing the check, schedule the
next check. Note that a forcedCheck
// is "off-schedule" so we need to push out the next check.
- if ((null == availabilityScheduleTime) || isForced) {
+ if ((0 == availabilityScheduleTime) || isForced) {
// if there is no availability schedule (platform) then just perform the
avail check
// (note, platforms always return UP anyway).
if (null == availScheduleRequest) {
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 79610b6..aa6fc47 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
@@ -121,9 +121,10 @@ public class ResourceContainer implements Serializable {
private transient TIntObjectMap<Object> proxyCache = new
TIntObjectHashMap<Object>(5);
private transient ClassLoader resourceClassLoader;
// the currently known availability
- private transient SlimAvailability availability = new SlimAvailability();
- // the time at which this resource is up for an avail check. null indicates
unscheduled.
- private transient Long availabilityScheduleTime;
+ private transient AvailabilityType currentAvailType = AvailabilityType.UNKNOWN;
+ private transient long currentAvailStart;
+ // the time at which this resource is up for an avail check. 0 indicates
unscheduled.
+ private transient long availabilityScheduleTime;
private transient AvailabilityProxy availabilityProxy;
/**
@@ -158,9 +159,12 @@ public class ResourceContainer implements Serializable {
public Availability updateAvailability(AvailabilityType availabilityType) {
synchronized (this) {
- this.availability = new SlimAvailability(availabilityType);
+ this.currentAvailType = availabilityType;
+ this.currentAvailStart = System.currentTimeMillis();
- return this.availability.toAvailability(this.resource);
+ Availability tmp = new Availability(this.resource,availabilityType);
+ tmp.setStartTime(this.currentAvailStart);
+ return tmp;
}
}
@@ -177,7 +181,9 @@ public class ResourceContainer implements Serializable {
@Nullable
public Availability getAvailability() {
synchronized (this) {
- return this.availability.toAvailability(this.resource);
+ Availability tmp = new Availability(this.resource,this.currentAvailType);
+ tmp.setStartTime(this.currentAvailStart);
+ return tmp;
}
}
@@ -302,13 +308,13 @@ public class ResourceContainer implements Serializable {
public void setAvailabilitySchedule(MeasurementScheduleRequest availabilitySchedule)
{
synchronized (this) {
this.availabilitySchedule = availabilitySchedule;
- // when the schedule is (re)set just null out the schedule time and it will
get rescheduled on the
+ // when the schedule is (re)set just 0 out the schedule time and it will get
rescheduled on the
// next avail execution.
- this.availabilityScheduleTime = null;
+ this.availabilityScheduleTime = 0;
}
}
- public Long getAvailabilityScheduleTime() {
+ public long getAvailabilityScheduleTime() {
return availabilityScheduleTime;
}
@@ -452,7 +458,7 @@ public class ResourceContainer implements Serializable {
@Override
public String toString() {
- AvailabilityType avail = (this.availability != null) ? this.availability.type :
null;
+ AvailabilityType avail = (this.currentAvailType != null) ? this.currentAvailType
: null;
return this.getClass().getSimpleName() + "[resource=" + this.resource +
", syncState="
+ this.synchronizationState + ", componentState=" +
this.resourceComponentState + ", avail=" + avail + "]";
}
@@ -784,30 +790,4 @@ public class ResourceContainer implements Serializable {
return sb.toString();
}
}
-
- private static class SlimAvailability {
-
- private long startTime;
- private AvailabilityType type = AvailabilityType.UNKNOWN;
-
- private SlimAvailability() {
- type = AvailabilityType.UNKNOWN;
- }
-
- private SlimAvailability(AvailabilityType type) {
- this.type = type;
- this.startTime = System.currentTimeMillis();
- }
-
- private SlimAvailability(long startTime, AvailabilityType type) {
- this.startTime = startTime;
- this.type = type;
- }
-
- Availability toAvailability(Resource r) {
- Availability tmp = new Availability(r,type);
- tmp.setStartTime(startTime);
- return tmp;
- }
- }
}
commit 75a8e23f5b67830336b1bafccf15590688c3787c
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Jan 2 09:26:25 2014 +0100
Prevent a possible NPE in tests
diff --git
a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java
b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java
index ca0a048..7d1e3ff 100644
---
a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java
+++
b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java
@@ -186,7 +186,11 @@ public class ResourceContext<T extends
ResourceComponent<?>> {
this.systemInformation = systemInfo;
this.pluginConfiguration = resource.getPluginConfiguration();
this.baseDataDirectory = baseDataDirectory;
- this.pluginContainerName = pluginContainerName.intern();
+ if (pluginContainerName!=null) {
+ this.pluginContainerName = pluginContainerName.intern();
+ } else {
+ this.pluginContainerName = null;
+ }
this.pluginContainerDeployment = pluginContainerDeployment;
this.temporaryDirectory = temporaryDirectory;
commit bc73492047cbaf6125e9fb2ee2d9c9cd8d1a7dbb
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Jan 2 09:25:59 2014 +0100
Keep a slim version of Availability - saves 32bytes per resource.
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 61ebafd..79610b6 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
@@ -121,7 +121,7 @@ public class ResourceContainer implements Serializable {
private transient TIntObjectMap<Object> proxyCache = new
TIntObjectHashMap<Object>(5);
private transient ClassLoader resourceClassLoader;
// the currently known availability
- private transient Availability availability;
+ private transient SlimAvailability availability = new SlimAvailability();
// the time at which this resource is up for an avail check. null indicates
unscheduled.
private transient Long availabilityScheduleTime;
private transient AvailabilityProxy availabilityProxy;
@@ -158,8 +158,9 @@ public class ResourceContainer implements Serializable {
public Availability updateAvailability(AvailabilityType availabilityType) {
synchronized (this) {
- this.availability = new Availability(this.resource, availabilityType);
- return this.availability;
+ this.availability = new SlimAvailability(availabilityType);
+
+ return this.availability.toAvailability(this.resource);
}
}
@@ -176,7 +177,7 @@ public class ResourceContainer implements Serializable {
@Nullable
public Availability getAvailability() {
synchronized (this) {
- return this.availability;
+ return this.availability.toAvailability(this.resource);
}
}
@@ -451,7 +452,7 @@ public class ResourceContainer implements Serializable {
@Override
public String toString() {
- AvailabilityType avail = (this.availability != null) ?
this.availability.getAvailabilityType() : null;
+ AvailabilityType avail = (this.availability != null) ? this.availability.type :
null;
return this.getClass().getSimpleName() + "[resource=" + this.resource +
", syncState="
+ this.synchronizationState + ", componentState=" +
this.resourceComponentState + ", avail=" + avail + "]";
}
@@ -783,4 +784,30 @@ public class ResourceContainer implements Serializable {
return sb.toString();
}
}
+
+ private static class SlimAvailability {
+
+ private long startTime;
+ private AvailabilityType type = AvailabilityType.UNKNOWN;
+
+ private SlimAvailability() {
+ type = AvailabilityType.UNKNOWN;
+ }
+
+ private SlimAvailability(AvailabilityType type) {
+ this.type = type;
+ this.startTime = System.currentTimeMillis();
+ }
+
+ private SlimAvailability(long startTime, AvailabilityType type) {
+ this.startTime = startTime;
+ this.type = type;
+ }
+
+ Availability toAvailability(Resource r) {
+ Availability tmp = new Availability(r,type);
+ tmp.setStartTime(startTime);
+ return tmp;
+ }
+ }
}
commit 4254af520b01bf0b3520a463a9ee578c1d99edd4
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Dec 31 14:16:02 2013 +0100
Re-package schedules in a Trove HashSet; saves ~200bytes per resource (depending on
number of schedules)
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 39e6f1a..61ebafd 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
@@ -42,6 +42,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.TIntObjectHashMap;
+import gnu.trove.set.hash.THashSet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -253,7 +254,7 @@ public class ResourceContainer implements Serializable {
public void setMeasurementSchedule(Set<MeasurementScheduleRequest>
measurementSchedule) {
synchronized (this) {
- this.measurementSchedule = measurementSchedule;
+ this.measurementSchedule = new
THashSet<MeasurementScheduleRequest>(measurementSchedule);
// this should not happen but if it does, protect against it because it will
sink the agent
if (null != this.measurementSchedule) {
commit d6af564d06ce769d1fccd66dc3b75f2fcc251982
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Dec 31 13:59:59 2013 +0100
Increase the interning map size on the server as well.
diff --git
a/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server.sh
b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server.sh
index 9856190..d30bef2 100755
---
a/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server.sh
+++
b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server.sh
@@ -86,8 +86,8 @@
# killed if it is still running after the
# RHQ_SERVER_STOP_DELAY. If this is not
# defined or set to "false" the script
-# will exit with error code 127.
-#
+# will exit with error code 127.
+#
#
#
# If the embedded JRE is to be used but is not available, the fallback
@@ -392,7 +392,7 @@ fi
# Add the JVM opts that we always want to specify, whether or not the user set
RHQ_SERVER_JAVA_OPTS.
# Note that the double equals for the policy file specification IS INTENTIONAL
_HTTP_COMPRESSION="-Dorg.apache.coyote.http11.Http11Protocol.COMPRESSION=on
-Dorg.apache.coyote.http11.Http11Protocol.COMPRESSION_MIME_TYPES=text/javascript,text/css,text/html"
-RHQ_SERVER_JAVA_OPTS="-Dapp.name=rhq-server ${RHQ_SERVER_JAVA_OPTS}
-Drhq.server.home=${RHQ_SERVER_HOME} -Djboss.server.log.dir=${_LOG_DIR_PATH}
-Djava.awt.headless=true -Dsun.lang.ClassLoader.allowArraySyntax=true
-Djboss.server.default.config=standalone-full.xml
-Djboss.modules.system.pkgs=org.jboss.byteman -Djava.security.manager
-Djava.security.policy==${RHQ_SERVER_HOME}/bin/internal/rhq-server.security-policy
${_HTTP_COMPRESSION} ${_JBOSS_DEBUG_LOGGING}"
+RHQ_SERVER_JAVA_OPTS="-Dapp.name=rhq-server ${RHQ_SERVER_JAVA_OPTS}
-Drhq.server.home=${RHQ_SERVER_HOME} -Djboss.server.log.dir=${_LOG_DIR_PATH}
-Djava.awt.headless=true -Dsun.lang.ClassLoader.allowArraySyntax=true
-Djboss.server.default.config=standalone-full.xml
-Djboss.modules.system.pkgs=org.jboss.byteman -Djava.security.manager
-Djava.security.policy==${RHQ_SERVER_HOME}/bin/internal/rhq-server.security-policy
${_HTTP_COMPRESSION} ${_JBOSS_DEBUG_LOGGING} -XX:StringTableSize=1000003"
debug_msg "RHQ_SERVER_JAVA_OPTS: $RHQ_SERVER_JAVA_OPTS"
debug_msg "RHQ_SERVER_ADDITIONAL_JAVA_OPTS: $RHQ_SERVER_ADDITIONAL_JAVA_OPTS"
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 8546c02..9bfecee 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
@@ -98,6 +98,9 @@
wrapper.java.additional.23="-Djava.io.tmpdir=%RHQ_SERVER_HOME%/temp"
# Don't need these now, but this is commented out in case we need to add an endorsed
dir in the future
#wrapper.java.additional.26="-Djava.endorsed.dirs=%RHQ_SERVER_HOME%/jbossas/lib/endorsed"
+# For string interning
+wrapper.java.additional.27=-XX:StringTableSize=1000003
+
# We want to make sure the Server starts in the JBossAS bin directory
wrapper.working.dir=%RHQ_SERVER_HOME%/jbossas/bin
commit 09182720b47c6c08d33573f6792ea6fe8f6cb2fe
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Dec 31 13:59:24 2013 +0100
Display names are very often the same, so we can intern them to save space.
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinition.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinition.java
index db22c1d..0d3b144 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinition.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinition.java
@@ -120,7 +120,9 @@ public class PropertyDefinition implements Serializable {
}
protected PropertyDefinition(@NotNull String name, String description, boolean
required) {
- this.name = name;
+ if (name!=null) {
+ this.name = name.intern();
+ }
this.description = description;
this.required = required;
}
@@ -164,7 +166,11 @@ public class PropertyDefinition implements Serializable {
}
public void setDisplayName(String displayName) {
- this.displayName = displayName;
+ if (displayName!=null) {
+ this.displayName = displayName.intern();
+ } else {
+ this.displayName = displayName;
+ }
}
public String getDescription() {
commit 42cf83c6f37788287aafca53a513c4967d9dda74
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Dec 31 10:10:59 2013 +0100
Keys are very often the same, so we can intern them to save space.
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/PROPERTY_VALUE.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/PROPERTY_VALUE.java
index c9c9ac9..887171b 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/PROPERTY_VALUE.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/json/PROPERTY_VALUE.java
@@ -1,20 +1,24 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2011 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 as published by
- * the Free Software Foundation version 2 of the License.
+ * 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.
*
* 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 for more details.
+ * GNU General Public License and the GNU Lesser 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.
+ * 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.
*/
package org.rhq.modules.plugins.jbossas7.json;
@@ -37,7 +41,9 @@ public class PROPERTY_VALUE implements Serializable{
private String value;
public PROPERTY_VALUE(String key, String value) {
- this.key = key;
+ if (key!=null) {
+ this.key = key.intern();
+ }
this.value = value;
}
@@ -50,7 +56,9 @@ public class PROPERTY_VALUE implements Serializable{
}
public void setKey(String key) {
- this.key = key;
+ if (key!=null) {
+ this.key = key.intern();
+ }
}
public void setValue(String value) {