javaserverfaces
  1. javaserverfaces
  2. JAVASERVERFACES-2869

DbfFactory FacesSchema.Schema instances can be released after startup.

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.2.6
    • Component/s: configuration
    • Labels:
      None

      Description

      DbfFactory has an enum, FacesSchema, which creates instance of javax.xml.validation.Schema depending on which JSF versions are pulled in by a particular app. It is possible that we could achieve memory savings by ensuring that no references are kept to such instances.

        Activity

        Hide
        Ed Burns added a comment -

        In DbfFactory.java, you have

            /**
             * Stores the schemas in a synchronized map with the schema id as the key.
             */
            private static final Map<FacesSchema, Schema> schemas = Collections.synchronizedMap(
                    new EnumMap<FacesSchema, Schema>(FacesSchema.class));
        

        After learning more about Multi-tenancy, I can't in good faith endorse the introduction of any more static data structures. I know this is tricky, if not impossible of me to suggest, but can you please hang this off something else other than static?

        Other than that, looks great. Can you please produce another iteration?

        Show
        Ed Burns added a comment - In DbfFactory.java, you have /** * Stores the schemas in a synchronized map with the schema id as the key. */ private static final Map<FacesSchema, Schema> schemas = Collections.synchronizedMap( new EnumMap<FacesSchema, Schema>(FacesSchema.class)); After learning more about Multi-tenancy, I can't in good faith endorse the introduction of any more static data structures. I know this is tricky, if not impossible of me to suggest, but can you please hang this off something else other than static? Other than that, looks great. Can you please produce another iteration?
        Hide
        Ed Burns added a comment -

        From a maintenance programming perspective, why throw away the semantic richness of being able to say "find usages" on a constant by having this literal string in several places:

        "com.sun.faces.config.SchemaMap".

        Instead, please have constant for that.

        Make that change and you have r=edburns.

        Show
        Ed Burns added a comment - From a maintenance programming perspective, why throw away the semantic richness of being able to say "find usages" on a constant by having this literal string in several places: "com.sun.faces.config.SchemaMap". Instead, please have constant for that. Make that change and you have r=edburns.
        Hide
        Manfred Riem added a comment -

        Applied to 2.2 branch,

        svn commit -m "Fixes https://java.net/jira/browse/JAVASERVERFACES-2869, r=edburns, make it so the schemas are kept in the servlet context, but only as long as they are needed."
        Sending jsf-ri/src/main/java/com/sun/faces/config/ConfigManager.java
        Sending jsf-ri/src/main/java/com/sun/faces/config/DbfFactory.java
        Transmitting file data ..
        Committed revision 12808.

        Show
        Manfred Riem added a comment - Applied to 2.2 branch, svn commit -m "Fixes https://java.net/jira/browse/JAVASERVERFACES-2869 , r=edburns, make it so the schemas are kept in the servlet context, but only as long as they are needed." Sending jsf-ri/src/main/java/com/sun/faces/config/ConfigManager.java Sending jsf-ri/src/main/java/com/sun/faces/config/DbfFactory.java Transmitting file data .. Committed revision 12808.

          People

          • Assignee:
            Manfred Riem
            Reporter:
            Ed Burns
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: