Author: trang_vu
Date: 2011-11-02 05:19:38 -0400 (Wed, 02 Nov 2011)
New Revision: 5144
Added:
jcr/branches/1.12.x/patch/1.12.11-GA/JCR-1663/readme.txt
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/sql/QueryFormat.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/xpath/QueryFormat.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/JCRDateFormat.java
jcr/branches/1.12.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/HierarchicalProperty.java
Log:
JCR-1663: Contention on JCRDateFormat on heavy load
Fix description
* Avoided usage of method java.util.TimeZone.getTimeZone(String ID), now we use less
synchronized method implemented in kernel project instead.
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/sql/QueryFormat.java
===================================================================
---
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/sql/QueryFormat.java 2011-11-02
07:54:28 UTC (rev 5143)
+++
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/sql/QueryFormat.java 2011-11-02
09:19:38 UTC (rev 5144)
@@ -16,17 +16,8 @@
*/
package org.exoplatform.services.jcr.impl.core.query.sql;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Iterator;
-import java.util.List;
-import java.util.TimeZone;
-
-import javax.jcr.NamespaceException;
-import javax.jcr.RepositoryException;
-import javax.jcr.query.InvalidQueryException;
-
import org.exoplatform.commons.utils.ISO8601;
+import org.exoplatform.commons.utils.Tools;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.impl.Constants;
@@ -48,7 +39,16 @@
import org.exoplatform.services.jcr.impl.core.query.RelationQueryNode;
import org.exoplatform.services.jcr.impl.core.query.TextsearchQueryNode;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Iterator;
+import java.util.List;
+import javax.jcr.NamespaceException;
+import javax.jcr.RepositoryException;
+import javax.jcr.query.InvalidQueryException;
+
+
/**
* Implements the query node tree serialization into a String.
*/
@@ -553,7 +553,7 @@
} else if (node.getValueType() == TYPE_STRING) {
b.append("'").append(node.getStringValue().replaceAll("'",
"''")).append("'");
} else if (node.getValueType() == TYPE_DATE || node.getValueType() ==
TYPE_TIMESTAMP) {
- Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
+ Calendar cal = Calendar.getInstance(Tools.getTimeZone("UTC"));
cal.setTime(node.getDateValue());
b.append("TIMESTAMP
'").append(ISO8601.format(cal)).append("'");
} else {
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/xpath/QueryFormat.java
===================================================================
---
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/xpath/QueryFormat.java 2011-11-02
07:54:28 UTC (rev 5143)
+++
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/xpath/QueryFormat.java 2011-11-02
09:19:38 UTC (rev 5144)
@@ -16,16 +16,8 @@
*/
package org.exoplatform.services.jcr.impl.core.query.xpath;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.List;
-import java.util.TimeZone;
-
-import javax.jcr.NamespaceException;
-import javax.jcr.RepositoryException;
-import javax.jcr.query.InvalidQueryException;
-
import org.exoplatform.commons.utils.ISO8601;
+import org.exoplatform.commons.utils.Tools;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
@@ -47,9 +39,16 @@
import org.exoplatform.services.jcr.impl.core.query.QueryRootNode;
import org.exoplatform.services.jcr.impl.core.query.RelationQueryNode;
import org.exoplatform.services.jcr.impl.core.query.TextsearchQueryNode;
-
import org.exoplatform.services.jcr.impl.util.ISO9075;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+import javax.jcr.NamespaceException;
+import javax.jcr.RepositoryException;
+import javax.jcr.query.InvalidQueryException;
+
/**
* Implements the query node tree serialization into a String.
*/
@@ -510,7 +509,7 @@
} else if (node.getValueType() == TYPE_STRING) {
b.append("'").append(node.getStringValue().replaceAll("'",
"''")).append("'");
} else if (node.getValueType() == TYPE_DATE || node.getValueType() ==
TYPE_TIMESTAMP) {
- Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
+ Calendar cal = Calendar.getInstance(Tools.getTimeZone("UTC"));
cal.setTime(node.getDateValue());
b.append(resolver.createJCRName(XPathQueryBuilder.XS_DATETIME).getAsString());
b.append("('").append(ISO8601.format(cal)).append("')");
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/JCRDateFormat.java
===================================================================
---
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/JCRDateFormat.java 2011-11-02
07:54:28 UTC (rev 5143)
+++
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/JCRDateFormat.java 2011-11-02
09:19:38 UTC (rev 5144)
@@ -19,12 +19,12 @@
package org.exoplatform.services.jcr.impl.util;
import org.exoplatform.commons.utils.ISO8601;
+import org.exoplatform.commons.utils.Tools;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import java.text.ParseException;
import java.util.Calendar;
-import java.util.TimeZone;
import javax.jcr.ValueFormatException;
@@ -159,7 +159,7 @@
isoCalendar.setFirstDayOfWeek(Integer.parseInt(calendarFields[1]));
isoCalendar.setMinimalDaysInFirstWeek(Integer.parseInt(calendarFields[2]));
- isoCalendar.setTimeZone(TimeZone.getTimeZone(calendarFields[3]));
+ isoCalendar.setTimeZone(Tools.getTimeZone(calendarFields[3]));
}
catch (Exception e)
{
Modified:
jcr/branches/1.12.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/HierarchicalProperty.java
===================================================================
---
jcr/branches/1.12.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/HierarchicalProperty.java 2011-11-02
07:54:28 UTC (rev 5143)
+++
jcr/branches/1.12.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/HierarchicalProperty.java 2011-11-02
09:19:38 UTC (rev 5144)
@@ -18,13 +18,14 @@
*/
package org.exoplatform.services.jcr.webdav.resource;
+import org.exoplatform.commons.utils.Tools;
+
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
-import java.util.TimeZone;
import javax.xml.namespace.QName;
@@ -104,7 +105,7 @@
{
this(name, null);
SimpleDateFormat dateFormat = new SimpleDateFormat(formatPattern, Locale.ENGLISH);
- dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
+ dateFormat.setTimeZone(Tools.getTimeZone("GMT"));
this.value = dateFormat.format(dateValue.getTime());
}
Added: jcr/branches/1.12.x/patch/1.12.11-GA/JCR-1663/readme.txt
===================================================================
--- jcr/branches/1.12.x/patch/1.12.11-GA/JCR-1663/readme.txt (rev
0)
+++ jcr/branches/1.12.x/patch/1.12.11-GA/JCR-1663/readme.txt 2011-11-02 09:19:38 UTC (rev
5144)
@@ -0,0 +1,72 @@
+Summary
+
+ * Status: Contention on JCRDateFormat on heavy load
+ * CCP Issue: CCP-1118, Product Jira Issue: JCR-1663.
+ * Complexity: low
+
+The Proposal
+Problem description
+
+What is the problem to fix?
+When we activate the Concurrent GC during our benchmark, we have very poor performances
and we can observe that a huge amount of the http thread are waiting on the same piece of
code in org.exoplatform.services.jcr.impl.util.JCRDateFormat.deserialize(String serString)
due to the use of the synchronized method java.util.TimeZone.getTimeZone(String ID)
+
+Expected: an alternative to avoid/limit the usage of this synchronized method.
+
+Fix description
+
+How is the problem fixed?
+
+ * Avoided usage of method java.util.TimeZone.getTimeZone(String ID), now we use less
synchronized method implemented in kernel project instead.
+
+Patch file: JCR-1663.patch
+
+Tests to perform
+
+Reproduction test
+
+ * Activate the Concurrent GC during run of benchmark
+
+Tests performed at DevLevel
+
+ * Functional testing for all projects (kernel, core, ws, jcr)
+
+Tests performed at QA/Support Level
+*
+
+Documentation changes
+
+Documentation changes:
+
+ * None
+
+Configuration changes
+
+Configuration changes:
+
+ * None
+
+Will previous configuration continue to work?
+
+ * Yes
+
+Risks and impacts
+
+Can this bug fix have any side effects on current client projects?
+
+ * No
+
+Is there a performance risk/cost?
+
+ * No
+
+Validation (PM/Support/QA)
+
+PM Comment
+* PM validated
+
+Support Comment
+*
+
+QA Feedbacks
+*
+
Show replies by date