[ 
https://issues.apache.org/jira/browse/WICKET-6963?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17528876#comment-17528876
 ] 

ASF GitHub Bot commented on WICKET-6963:
----------------------------------------

theigl commented on code in PR #517:
URL: https://github.com/apache/wicket/pull/517#discussion_r859999830


##########
wicket-core/src/main/java/org/apache/wicket/markup/html/panel/PanelMarkupSourcingStrategy.java:
##########
@@ -33,9 +33,28 @@
  */
 public class PanelMarkupSourcingStrategy extends 
AssociatedMarkupSourcingStrategy
 {
+       private static final PanelMarkupSourcingStrategy PANEL_INSTANCE = new 
PanelMarkupSourcingStrategy(
+               false);
+       private static final PanelMarkupSourcingStrategy BORDER_INSTANCE = new 
PanelMarkupSourcingStrategy(
+               true);
+
        // False for Panel and true for Border components.
        private final boolean allowWicketComponentsInBodyMarkup;

Review Comment:
   @martin-g: I experimentally refactored this in 
https://github.com/theigl/wicket/pull/1. Could you take a look? I couldn't 
think of a good name for the new enum. I'm not sure this refactoring is really 
worth it.





> Use singletons for PanelMarkupSourcingStrategy
> ----------------------------------------------
>
>                 Key: WICKET-6963
>                 URL: https://issues.apache.org/jira/browse/WICKET-6963
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-core
>    Affects Versions: 9.8.0
>            Reporter: Thomas Heigl
>            Assignee: Thomas Heigl
>            Priority: Major
>             Fix For: 10.0.0, 9.9.0, 9.9.1
>
>         Attachments: image-2022-03-21-18-21-51-613.png
>
>
> My latest heapdump contained millions of instances of 
> {{{}PanelMarkupSourcingStrategy{}}}:
> !image-2022-03-21-18-21-51-613.png|width=839,height=24!
> This class is completely stateless and only takes a single boolean 
> constructor parameter. We should replace current instances by a factory 
> method and two singletons.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to