[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-2493) Problems with faces Renderer when used simultaneously from different threads
Pete Muir (JIRA)
jira-events at lists.jboss.org
Fri Mar 14 09:03:58 EDT 2008
[ http://jira.jboss.com/jira/browse/JBSEAM-2493?page=comments#action_12402890 ]
Pete Muir commented on JBSEAM-2493:
-----------------------------------
Patch version of this for mail example
Index: resources/WEB-INF/pages.xml
===================================================================
--- resources/WEB-INF/pages.xml (revision 7576)
+++ resources/WEB-INF/pages.xml (working copy)
@@ -6,5 +6,8 @@
<page view-id="/index.xhtml">
<begin-conversation join="true" />
</page>
+
+
+ <page view-id="/mailbug.xhtml" action="#{seamMailBug1.send}"/>
</pages>
Index: src/org/jboss/seam/example/mail/SeamMailBug.java
===================================================================
--- src/org/jboss/seam/example/mail/SeamMailBug.java (revision 0)
+++ src/org/jboss/seam/example/mail/SeamMailBug.java (revision 0)
@@ -0,0 +1,27 @@
+package org.jboss.seam.example.mail;
+
+import java.util.List;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.async.Asynchronous;
+import org.jboss.seam.contexts.Context;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.faces.Renderer;
+
+ at Name("seamMailBug")
+ at Scope(ScopeType.EVENT)
+public class SeamMailBug {
+
+ @In
+ private Renderer renderer;
+
+ @Asynchronous
+ public void send(List<String> asList) {
+ Context c = Contexts.getEventContext();
+ c.set("l", asList);
+ renderer.render("/seamMailBug.xhtml");
+ }
+}
Index: src/org/jboss/seam/example/mail/SeamMailBug1.java
===================================================================
--- src/org/jboss/seam/example/mail/SeamMailBug1.java (revision 0)
+++ src/org/jboss/seam/example/mail/SeamMailBug1.java (revision 0)
@@ -0,0 +1,20 @@
+package org.jboss.seam.example.mail;
+
+import java.util.Arrays;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+
+ at Name("seamMailBug1")
+ at Scope(ScopeType.EVENT)
+public class SeamMailBug1 {
+ public void send() {
+ SeamMailBug smb = (SeamMailBug) Component
+ .getInstance(SeamMailBug.class);
+ smb.send(Arrays.asList(new String[] { "L2-1" }));
+ smb.send(Arrays.asList(new String[] { "L1-1", "L1-2", "L1-3" }));
+ }
+
+}
\ No newline at end of file
Index: view/seamMailBug.xhtml
===================================================================
--- view/seamMailBug.xhtml (revision 0)
+++ view/seamMailBug.xhtml (revision 0)
@@ -0,0 +1,13 @@
+<ui:composition
+ xmlns:m="http://jboss.com/products/seam/mail"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+<ui:repeat value="#{l}" var="v">
+ <m:message>
+ <m:from>some at bo.dy</m:from>
+ <m:to name="Marcus">pmuir at bleepbleep.org.uk</m:to>
+ <m:body>
+ Guten Tag! #{v}
+</m:body>
+ </m:message>
+</ui:repeat>
+</ui:composition>
\ No newline at end of file
> Problems with faces Renderer when used simultaneously from different threads
> ----------------------------------------------------------------------------
>
> Key: JBSEAM-2493
> URL: http://jira.jboss.com/jira/browse/JBSEAM-2493
> Project: JBoss Seam
> Issue Type: Bug
> Components: Mail
> Affects Versions: 2.0.0.GA
> Environment: Seam-App in JBoss 4.2
> Properly configure mail-service
> Reporter: Marcus Schmidke
> Assigned To: Pete Muir
> Priority: Minor
> Fix For: 2.0.2.GA, 2.1.0.GA
>
>
> When creating multiple renderers in different threads and using them simultaneously, there are problems with JSF variables (for example in ui:repeat)
> Create the following classes:
> @Name("seamMailBug")
> @Scope(ScopeType.EVENT)
> public class SeamMailBug {
> @In
> private Renderer renderer;
> @Asynchronous
> public void send(List<String> asList) {
> Context c = Contexts.getEventContext();
> c.set("l", asList);
> renderer.render("/seamMailBug.xhtml");
> }
> }
> @Name("seamMailBug1")
> @Scope(ScopeType.EVENT)
> public class SeamMailBug1 {
> public void send() {
> SeamMailBug smb = (SeamMailBug) Component
> .getInstance(SeamMailBug.class);
> smb.send(Arrays.asList(new String[] { "L2-1" }));
> smb.send(Arrays.asList(new String[] { "L1-1", "L1-2", "L1-3" }));
> }
> }
> Create the mail template seamMailBug.xhtml:
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <ui:repeat xmlns="http://www.w3.org/1999/xhtml"
> xmlns:m="http://jboss.com/products/seam/mail"
> xmlns:ui="http://java.sun.com/jsf/facelets"
> value="#{l}" var="v"
> >
> <m:message>
> <m:from>some at bo.dy</m:from>
> <m:to name="Marcus">your.own at email.address</m:to>
> <m:body>
> Guten Tag! #{v}
> </m:body>
> </m:message>
> </ui:repeat>
> And in pages.xml:
> <page view-id="/seambug.xhtml" action="#{seamMailBug1.send}"/>
> Start the server and get the URL: http://..../.../seambug.seam
> One should expect 4 mails being sent, containing the strings L1-1, L1-2, L1-3 and L2-1.
> The number of mails actually sent will be correct, but carefully verify the strings being sent.
> You will see that the "v" iterator variable is the same used from both threads.
--
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
More information about the seam-issues
mailing list