[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-3653) Remove String concat in ScopeType
by Michael Youngstrom (JIRA)
Remove String concat in ScopeType
---------------------------------
Key: JBSEAM-3653
URL: https://jira.jboss.org/jira/browse/JBSEAM-3653
Project: Seam
Issue Type: Bug
Affects Versions: 2.1.0.GA, 2.0.3.CR1
Reporter: Michael Youngstrom
Assignee: Michael Youngstrom
Fix For: 2.1.1.CR1
In my application profiling the SeamELResolver is an extremely hot spot. This is one seemingly harmless fix that can be applied to minimally improve component lookup and hence SeamELResolver performance. This fix may appear small but in my app this method is getting called thousands of times a page load.
Index: src/main/org/jboss/seam/ScopeType.java
===================================================================
--- src/main/org/jboss/seam/ScopeType.java (revision 9465)
+++ src/main/org/jboss/seam/ScopeType.java (working copy)
@@ -69,6 +69,12 @@
*/
UNSPECIFIED;
+ private final String prefix;
+
+ private ScopeType() {
+ prefix = "org.jboss.seam." + toString();
+ }
+
public boolean isContextActive()
{
switch (this)
@@ -151,7 +157,7 @@
public String getPrefix()
{
- return "org.jboss.seam." + toString();
+ return prefix;
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 4 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-1922) Back button doesn't work with PAGE scope and JSF-RI Server state saving
by Michael Youngstrom (JIRA)
Back button doesn't work with PAGE scope and JSF-RI Server state saving
-----------------------------------------------------------------------
Key: JBSEAM-1922
URL: http://jira.jboss.com/jira/browse/JBSEAM-1922
Project: JBoss Seam
Issue Type: Bug
Components: Core
Affects Versions: 2.0.0.BETA1
Reporter: Michael Youngstrom
JSF doesn't make any guarentees about the isolation of attributes stored in the view. Because of this a PAGE scoped component that gets passed along to several views will actually be a single instance when using Server state management with the RI.
This causes a problem with back button support for the PAGE scope (imho the main difference of PAGE scope over CONVERSATION). For example:
@Name("test")
@Scope(PAGE)
public class Test implements Serializable {
private int value = 0;
public int getValue() {
return value;
}
public void incValue() {
value++;
}
}
Value = #{test.value}
<h:form>
<h:commandButton action="#{test.incValue}" value="Increment Value"/>
</h:form>
Test Case when using Server side state management:
1. I view the page: "Value = 0" Displayed
2. I press "Increment" button: "Value = 1"
3. I press "Increment" button: "Value = 2"
4. I press "back" button: "Value = 1"
5. I press "Increment" button: "Value=3"
If running in client state mode Step 5 displays "Value=2".
To make PAGE scope work consistently between client and server JSF state management we need to figure out some way to serialize PAGE scoped values when doing "saveState" or something so that a new instance of PAGE is accessed from restore-view of any subsequent requests.
Here is a link to a conversation on the RI about this issue:
https://javaserverfaces.dev.java.net/servlets/BrowseList?list=dev&by=thre...
>From the conversation it appears the MyFaces is not effected by this issue by default.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 4 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-3654) Reduce number of checks to see if Jbpm is installed in BusinessProcessContext
by Michael Youngstrom (JIRA)
Reduce number of checks to see if Jbpm is installed in BusinessProcessContext
-----------------------------------------------------------------------------
Key: JBSEAM-3654
URL: https://jira.jboss.org/jira/browse/JBSEAM-3654
Project: Seam
Issue Type: Bug
Affects Versions: 2.1.0.GA
Reporter: Michael Youngstrom
Assignee: Michael Youngstrom
Fix For: 2.1.1.CR1
In my application profiling the SeamELResolver is an extremely hot spot. Although checking to see if jbpm is installed would appear a rather efficient process when done thousands of times a request it can become harmful. BusinessProcessContext.get is called every time an el expression is evaluated in a page. Here is a simple and I believe safe patch that will help make BusinessProcessContext more efficient. isJbpmInstalled() is only called once a request.
Index: src/main/org/jboss/seam/contexts/Lifecycle.java
===================================================================
--- src/main/org/jboss/seam/contexts/Lifecycle.java (revision 9465)
+++ src/main/org/jboss/seam/contexts/Lifecycle.java (working copy)
@@ -81,11 +81,11 @@
public static void beginCall()
{
log.debug( ">>> Begin call" );
+ Contexts.applicationContext.set( new ApplicationContext(getApplication()) );
Contexts.eventContext.set( new BasicContext(ScopeType.EVENT) );
Contexts.sessionContext.set( new BasicContext(ScopeType.SESSION) );
Contexts.conversationContext.set( new BasicContext(ScopeType.CONVERSATION) );
Contexts.businessProcessContext.set( new BusinessProcessContext() );
- Contexts.applicationContext.set( new ApplicationContext(getApplication()) );
}
public static void endCall()
Index: src/main/org/jboss/seam/contexts/BusinessProcessContext.java
===================================================================
--- src/main/org/jboss/seam/contexts/BusinessProcessContext.java (revision 9465)
+++ src/main/org/jboss/seam/contexts/BusinessProcessContext.java (working copy)
@@ -35,21 +35,26 @@
private final Map<String, Object> additions = new HashMap<String, Object>();
private final Set<String> removals = new HashSet<String>();
+ private final boolean enabled;
public ScopeType getType()
{
return ScopeType.BUSINESS_PROCESS;
}
- public BusinessProcessContext() {}
+ public BusinessProcessContext() {
+ enabled = Init.instance().isJbpmInstalled();
+ }
public Object get(String name)
{
-
Object result = additions.get(name);
if (result!=null) return result;
if ( removals.contains(name) ) return null;
-
+
+ if(!enabled) {
+ return null;
+ }
org.jbpm.taskmgmt.exe.TaskInstance taskInstance = getTaskInstance();
if (taskInstance==null)
{
Index: src/main/org/jboss/seam/contexts/TestLifecycle.java
===================================================================
--- src/main/org/jboss/seam/contexts/TestLifecycle.java (revision 9465)
+++ src/main/org/jboss/seam/contexts/TestLifecycle.java (working copy)
@@ -29,11 +29,11 @@
public static void beginTest(ServletContext context, Map<String, Object> session)
{
log.debug( ">>> Begin test" );
+ Contexts.applicationContext.set( new ApplicationContext( new ServletApplicationMap(context) ) );
Contexts.eventContext.set( new BasicContext(ScopeType.EVENT) );
Contexts.conversationContext.set( new BasicContext(ScopeType.CONVERSATION) );
Contexts.businessProcessContext.set( new BusinessProcessContext() );
Contexts.sessionContext.set( new SessionContext(session) );
- Contexts.applicationContext.set( new ApplicationContext( new ServletApplicationMap(context) ) );
}
public static void endTest()
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 4 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-3656) Eliminate unnecessary String concat in PageContext
by Michael Youngstrom (JIRA)
Eliminate unnecessary String concat in PageContext
--------------------------------------------------
Key: JBSEAM-3656
URL: https://jira.jboss.org/jira/browse/JBSEAM-3656
Project: Seam
Issue Type: Bug
Components: Core
Reporter: Michael Youngstrom
Assignee: Michael Youngstrom
Fix For: 2.1.1.CR1
PageContext has an unnecessary string concat that would normally be harmless but when done thousands of times a request becomes a bigger problem. Here is the patch:
Index: src/main/org/jboss/seam/contexts/PageContext.java
===================================================================
--- src/main/org/jboss/seam/contexts/PageContext.java (revision 9465)
+++ src/main/org/jboss/seam/contexts/PageContext.java (working copy)
@@ -38,6 +38,7 @@
public class PageContext implements Context
{
+ private static final String PAGE_CONTEXT_PREFIX = ScopeType.PAGE.getPrefix() + '$';
private Map<String, Object> previousPageMap;
private Map<String, Object> nextPageMap;
@@ -59,7 +60,7 @@
private String getPrefix()
{
- return ScopeType.PAGE.getPrefix() + '$';
+ return PAGE_CONTEXT_PREFIX;
}
public Object get(String name)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 4 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-3655) Caching in ServerConversationContext
by Michael Youngstrom (JIRA)
Caching in ServerConversationContext
-------------------------------------
Key: JBSEAM-3655
URL: https://jira.jboss.org/jira/browse/JBSEAM-3655
Project: Seam
Issue Type: Bug
Components: Core
Reporter: Michael Youngstrom
Assignee: Michael Youngstrom
Fix For: 2.1.1.CR1
In my application profiling the SeamELResolver is an extremely hot spot. ServerConversationContext was the hottest. I think it would be safe to create a request scoped cache on ServerCovnersationContext. I believe nobody can really be add or removing values from the conversation without going through the ServerConversationContext. In my tests caching resolution of conversation values greatly improved EL performance.
Index: src/main/org/jboss/seam/contexts/ServerConversationContext.java
===================================================================
--- src/main/org/jboss/seam/contexts/ServerConversationContext.java (revision 9465)
+++ src/main/org/jboss/seam/contexts/ServerConversationContext.java (working copy)
@@ -36,6 +36,7 @@
private final Set<String> removals = new HashSet<String>();
private final String id;
private final List<String> idStack;
+ private final Map<String, Object> cache = new HashMap<String, Object>();
private List<String> getIdStack()
{
@@ -81,8 +82,15 @@
this.idStack = new LinkedList<String>();
idStack.add(id);
}
+
+ public Object get(String name) {
+ if (!cache.containsKey(name)) {
+ cache.put(name, resolveValue(name));
+ }
+ return cache.get(name);
+ }
- public Object get(String name)
+ protected Object resolveValue(String name)
{
Object result = additions.get(name);
if (result!=null)
@@ -148,6 +156,7 @@
public void set(String name, Object value)
{
if ( Events.exists() ) Events.instance().raiseEvent("org.jboss.seam.preSetVariable." + name);
+ cache.remove(name);
if (value==null)
{
//yes, we need this
@@ -185,6 +194,7 @@
public void remove(String name)
{
if ( Events.exists() ) Events.instance().raiseEvent("org.jboss.seam.preRemoveVariable." + name);
+ cache.remove(name);
additions.remove(name);
removals.add(name);
if ( Events.exists() ) Events.instance().raiseEvent("org.jboss.seam.postRemoveVariable." + name);
@@ -245,6 +255,7 @@
public void clear()
{
+ cache.clear();
additions.clear();
removals.addAll( getNamesFromSession() );
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 4 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-3746) Clean up imports
by Anthony Whitford (JIRA)
Clean up imports
----------------
Key: JBSEAM-3746
URL: https://jira.jboss.org/jira/browse/JBSEAM-3746
Project: Seam
Issue Type: Patch
Affects Versions: 2.1.1.CR1
Reporter: Anthony Whitford
Priority: Minor
Running a static code analysis check on the source exposed several import issues, such as:
seam\src\main\org\jboss\seam\contexts\FacesLifecycle.java 14 Avoid unused imports such as 'javax.servlet.ServletRequest'
seam\src\main\org\jboss\seam\document\DocumentStore.java 7 Avoid unused imports such as 'javax.faces.FacesException'
seam\src\pdf\org\jboss\seam\pdf\ui\UIBarCode.java 16 No need to import a type that lives in the same package
seam\src\pdf\org\jboss\seam\pdf\ui\UIField.java 8 Avoid unused imports such as 'javax.faces.component.UIComponent'
seam\src\pdf\org\jboss\seam\pdf\ui\UIForm.java 4 Avoid unused imports such as 'java.io.FileInputStream'
seam\src\pdf\org\jboss\seam\pdf\ui\UIForm.java 5 Avoid unused imports such as 'java.io.FileNotFoundException'
seam\src\pdf\org\jboss\seam\pdf\ui\UIForm.java 6 Avoid unused imports such as 'java.io.FileOutputStream'
seam\src\pdf\org\jboss\seam\pdf\ui\UITable.java 3 Avoid unused imports such as 'java.awt.Color'
seam\src\remoting\org\jboss\seam\remoting\MarshalUtils.java 7 Avoid unused imports such as 'java.util.List'
For more background information, see: http://pmd.sourceforge.net/rules/imports.html
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 4 months