You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2017/09/17 12:29:57 UTC

[myfaces-trinidad] branch 1.2.12.1.1-branch created (now 802c2f8)

This is an automated email from the ASF dual-hosted git repository.

deki pushed a change to branch 1.2.12.1.1-branch
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git.


      at 802c2f8  TRINIDAD-1702 decrease memory of FileSystemStyleCache by reusing CSSStyle objects for branch 1.2.12.1.1-branch

This branch includes the following new commits:

     new a4004ba  tmp branch
     new 656e0d4  updating some version # strings.....
     new 97502ab  minor fix on some version ID...
     new 802c2f8  TRINIDAD-1702 decrease memory of FileSystemStyleCache by reusing CSSStyle objects for branch 1.2.12.1.1-branch

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


-- 
To stop receiving notification emails like this one, please contact
['"commits@myfaces.apache.org" <co...@myfaces.apache.org>'].

[myfaces-trinidad] 04/04: TRINIDAD-1702 decrease memory of FileSystemStyleCache by reusing CSSStyle objects for branch 1.2.12.1.1-branch

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

deki pushed a commit to branch 1.2.12.1.1-branch
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git

commit 802c2f8fe9ecc457cd984d58ace3300c97622942
Author: Jeanne Waldman <jw...@apache.org>
AuthorDate: Wed Mar 3 19:26:32 2010 +0000

    TRINIDAD-1702 decrease memory of FileSystemStyleCache by reusing CSSStyle objects
    for branch 1.2.12.1.1-branch
---
 .../style/cache/FileSystemStyleCache.java          | 64 +++++++++++++++++++++-
 1 file changed, 61 insertions(+), 3 deletions(-)

diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java
index fbbad0b..dfd4a6b 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java
@@ -1514,8 +1514,66 @@ public class FileSystemStyleCache implements StyleProvider
         if (name != null && value != null)
           styleProperties.put(name, value);
       }
+      
+      // To save memory, we reuse CSSStyle objects if 
+      // they have the same list of style property names and values.
+      // StyleKey is the key into the StyleKey, CSSStyle map.
+      StyleKey key = new StyleKey(styleProperties);
+      Style cachedStyle = _styleNodeToStyleMap.get(key);
+      if (cachedStyle == null)
+      {
+        // no match is cached yet, so create a new CSSStyle and cache in the map.
+        Style style = new CSSStyle(styleProperties);
+        _styleNodeToStyleMap.put(key, style);
+        return style;         
+      }
+      else
+      {
+        return cachedStyle;
+      }
+    }
+    
+    /**
+     * A StyleKey object is used as a key into a map so that we can share CSSStyle objects
+     * if they are equal and they have the same hashCode.
+     */
+    private static class StyleKey
+    {
+      public StyleKey(Map<String, String> styleProperties)
+      {
+        _styleProperties = styleProperties;
+      }
+      
+      @Override
+      public int hashCode()
+      {
+        int hash = 17;
+        // take each style property name and value and create a hashCode from it.
+        for (Map.Entry<String, String> e : _styleProperties.entrySet())
+        {
+          String name = e.getKey();
+          hash = 37*hash + ((null == name) ? 0 : name.hashCode());
+
+          String value = e.getValue();
+          hash = 37*hash + ((null == value) ? 0 : value.hashCode());
 
-      return new CSSStyle(styleProperties);
+        }
+        return hash;
+      }
+      @Override  
+      public boolean equals(Object obj)
+      {
+        if (this == obj)
+          return true;
+        if (!(obj instanceof StyleKey))
+          return false;
+          
+        // obj at this point must be a StyleKey
+        StyleKey test = (StyleKey)obj;
+        return test._styleProperties.equals(this._styleProperties);
+      }
+      
+      Map<String, String> _styleProperties;
 
     }
 
@@ -1524,6 +1582,7 @@ public class FileSystemStyleCache implements StyleProvider
     private final String[]             _namespacePrefixArray;
     private final Map<String, String>  _shortStyleClassMap;
     private final boolean              _compress;
+    private Map<StyleKey, Style> _styleNodeToStyleMap = new ConcurrentHashMap<StyleKey, Style>();
   }
 
   private class StyleWriterFactoryImpl
@@ -1553,7 +1612,7 @@ public class FileSystemStyleCache implements StyleProvider
       }
 
       File outputFile = _getOutputFile(_baseFilename, _files.size() + 1);
-      // We never want to do anything other then read it or delete it:
+      // We never want to do anything other than read it or delete it:
       outputFile.setReadOnly();
 
       _files.add(outputFile);
@@ -1628,7 +1687,6 @@ public class FileSystemStyleCache implements StyleProvider
    * names do not contain html, whereas our internal style selector
    * names may. We write out the shortened version of the mapped
    * selector names to the css file.
-   * jmw.
    * @todo Need to find a better spot for this, like the skin?
    */
   private static final Map<String, String> _STYLE_KEY_MAP;

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.

[myfaces-trinidad] 01/04: tmp branch

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

deki pushed a commit to branch 1.2.12.1.1-branch
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git

commit a4004bab9de062ebb9c803443070d34666e93323
Author: Matthias Wessendorf <ma...@apache.org>
AuthorDate: Mon Nov 23 13:07:59 2009 +0000

    tmp branch

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.

[myfaces-trinidad] 02/04: updating some version # strings.....

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

deki pushed a commit to branch 1.2.12.1.1-branch
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git

commit 656e0d46526780509448cd4c7b0adede511fdcb4
Author: Matthias Wessendorf <ma...@apache.org>
AuthorDate: Mon Nov 23 13:49:05 2009 +0000

    updating some version # strings.....
---
 pom.xml                                                        | 2 +-
 trinidad-api/pom.xml                                           | 2 +-
 trinidad-assembly/pom.xml                                      | 2 +-
 trinidad-build/pom.xml                                         | 2 +-
 trinidad-examples/pom.xml                                      | 2 +-
 trinidad-examples/trinidad-blank/pom.xml                       | 2 +-
 trinidad-examples/trinidad-demo/pom.xml                        | 2 +-
 trinidad-examples/trinidad-example-assembly/pom.xml            | 2 +-
 trinidad-impl/pom.xml                                          | 2 +-
 trinidad-impl/src/main/resources/META-INF/trinidad-version.txt | 2 +-
 trinidad-partial-lifecycle/pom.xml                             | 2 +-
 11 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/pom.xml b/pom.xml
index 764606d..3ecf147 100644
--- a/pom.xml
+++ b/pom.xml
@@ -33,7 +33,7 @@
 
   <groupId>org.apache.myfaces.trinidad</groupId>
   <artifactId>trinidad</artifactId>
-  <version>1.2.12.1-SNAPSHOT</version>
+  <version>1.2.12.1.1-SNAPSHOT</version>
   <packaging>pom</packaging>
 
   <properties>
diff --git a/trinidad-api/pom.xml b/trinidad-api/pom.xml
index 0b3f7db..fd4705c 100644
--- a/trinidad-api/pom.xml
+++ b/trinidad-api/pom.xml
@@ -27,7 +27,7 @@
   <parent>
     <groupId>org.apache.myfaces.trinidad</groupId>
     <artifactId>trinidad</artifactId>
-    <version>1.2.12.1-SNAPSHOT</version>
+    <version>1.2.12.1.1-SNAPSHOT</version>
   </parent>
 
   <artifactId>trinidad-api</artifactId>
diff --git a/trinidad-assembly/pom.xml b/trinidad-assembly/pom.xml
index 3a67783..c411ba8 100644
--- a/trinidad-assembly/pom.xml
+++ b/trinidad-assembly/pom.xml
@@ -26,7 +26,7 @@
   <parent>
     <groupId>org.apache.myfaces.trinidad</groupId>
     <artifactId>trinidad</artifactId>
-    <version>1.2.12.1-SNAPSHOT</version>
+    <version>1.2.12.1.1-SNAPSHOT</version>
   </parent>
 
   <artifactId>trinidad-assembly</artifactId>
diff --git a/trinidad-build/pom.xml b/trinidad-build/pom.xml
index d74750e..64964e2 100644
--- a/trinidad-build/pom.xml
+++ b/trinidad-build/pom.xml
@@ -27,7 +27,7 @@
   <parent>
     <groupId>org.apache.myfaces.trinidad</groupId>
     <artifactId>trinidad</artifactId>
-    <version>1.2.12.1-SNAPSHOT</version>
+    <version>1.2.12.1.1-SNAPSHOT</version>
   </parent>
 
   <artifactId>trinidad-build</artifactId>
diff --git a/trinidad-examples/pom.xml b/trinidad-examples/pom.xml
index dfe8766..fb78360 100644
--- a/trinidad-examples/pom.xml
+++ b/trinidad-examples/pom.xml
@@ -27,7 +27,7 @@
   <parent>
     <groupId>org.apache.myfaces.trinidad</groupId>
     <artifactId>trinidad</artifactId>
-    <version>1.2.12.1-SNAPSHOT</version>
+    <version>1.2.12.1.1-SNAPSHOT</version>
   </parent>
 
   <artifactId>trinidad-example</artifactId>
diff --git a/trinidad-examples/trinidad-blank/pom.xml b/trinidad-examples/trinidad-blank/pom.xml
index 1c370b3..682d037 100644
--- a/trinidad-examples/trinidad-blank/pom.xml
+++ b/trinidad-examples/trinidad-blank/pom.xml
@@ -26,7 +26,7 @@
   <parent>
     <groupId>org.apache.myfaces.trinidad</groupId>
     <artifactId>trinidad-example</artifactId>
-    <version>1.2.12.1-SNAPSHOT</version>
+    <version>1.2.12.1.1-SNAPSHOT</version>
   </parent>
 
   <artifactId>trinidad-blank</artifactId>
diff --git a/trinidad-examples/trinidad-demo/pom.xml b/trinidad-examples/trinidad-demo/pom.xml
index 86ada40..8aee382 100644
--- a/trinidad-examples/trinidad-demo/pom.xml
+++ b/trinidad-examples/trinidad-demo/pom.xml
@@ -7,7 +7,7 @@
   <parent>
     <groupId>org.apache.myfaces.trinidad</groupId>
     <artifactId>trinidad-example</artifactId>
-    <version>1.2.12.1-SNAPSHOT</version>
+    <version>1.2.12.1.1-SNAPSHOT</version>
   </parent>
 
   <artifactId>trinidad-demo</artifactId>
diff --git a/trinidad-examples/trinidad-example-assembly/pom.xml b/trinidad-examples/trinidad-example-assembly/pom.xml
index e752f13..3514091 100644
--- a/trinidad-examples/trinidad-example-assembly/pom.xml
+++ b/trinidad-examples/trinidad-example-assembly/pom.xml
@@ -27,7 +27,7 @@
   <parent>
     <groupId>org.apache.myfaces.trinidad</groupId>
     <artifactId>trinidad</artifactId>
-    <version>1.2.12.1-SNAPSHOT</version>
+    <version>1.2.12.1.1-SNAPSHOT</version>
   </parent>
 
   <artifactId>trinidad-example-assembly</artifactId>
diff --git a/trinidad-impl/pom.xml b/trinidad-impl/pom.xml
index b616218..9e10002 100644
--- a/trinidad-impl/pom.xml
+++ b/trinidad-impl/pom.xml
@@ -27,7 +27,7 @@
   <parent>
     <groupId>org.apache.myfaces.trinidad</groupId>
     <artifactId>trinidad</artifactId>
-    <version>1.2.12.1-SNAPSHOT</version>
+    <version>1.2.12.1.1-SNAPSHOT</version>
   </parent>
 
   <artifactId>trinidad-impl</artifactId>
diff --git a/trinidad-impl/src/main/resources/META-INF/trinidad-version.txt b/trinidad-impl/src/main/resources/META-INF/trinidad-version.txt
index ab4d7d9..0936ecc 100644
--- a/trinidad-impl/src/main/resources/META-INF/trinidad-version.txt
+++ b/trinidad-impl/src/main/resources/META-INF/trinidad-version.txt
@@ -1 +1 @@
-1_2_12_1
+1_2_12_11
diff --git a/trinidad-partial-lifecycle/pom.xml b/trinidad-partial-lifecycle/pom.xml
index 78f135c..c1fbaf7 100644
--- a/trinidad-partial-lifecycle/pom.xml
+++ b/trinidad-partial-lifecycle/pom.xml
@@ -23,7 +23,7 @@
   <parent>
     <groupId>org.apache.myfaces.trinidad</groupId>
     <artifactId>trinidad</artifactId>
-    <version>1.2.12.1-SNAPSHOT</version>
+    <version>1.2.12.1.1-SNAPSHOT</version>
   </parent>
   <artifactId>trinidad-partial-lifecycle</artifactId>
   <name>Apache MyFaces Trinidad Partial Lifecycle</name>

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.

[myfaces-trinidad] 03/04: minor fix on some version ID...

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

deki pushed a commit to branch 1.2.12.1.1-branch
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git

commit 97502ab7170e186ee5c202a50c43b61cc8f0b5c8
Author: Matthias Wessendorf <ma...@apache.org>
AuthorDate: Tue Dec 8 13:25:40 2009 +0000

    minor fix on some version ID...
---
 trinidad-impl/src/main/resources/META-INF/trinidad-version.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/trinidad-impl/src/main/resources/META-INF/trinidad-version.txt b/trinidad-impl/src/main/resources/META-INF/trinidad-version.txt
index 0936ecc..3c310a4 100644
--- a/trinidad-impl/src/main/resources/META-INF/trinidad-version.txt
+++ b/trinidad-impl/src/main/resources/META-INF/trinidad-version.txt
@@ -1 +1 @@
-1_2_12_11
+1_2_12_1_1

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.