[JBoss Seam] - synchronized keyword in SLSB
by toni
Hi,
may we use the java keyword "synchronized" on a method of a SLSB to ensure that several statements get executed all together or not at all?
I have a method in a SLSB, which updates a counter kept in an Entity bean, if some condition is fulfilled.
Afterwards the counter is increased. I want to ensure the integrity of the counter. Because several threads can and will access the method.
What would you suggest?
This how the pseudo code block looks like:
|
| public String methodDoesNotBelongToSLSinterface(EnityBeanWithCounter eb)
| {
| ...
| ...
| // make sure that no race condition can occur using
| synchronized(this)
| {
| statement1;
| statement2;
| ...
| statementN;
| // Increase counter if successful
| if (someCondition)
| eb.setCounter(eb.getCounter + 1);
| }
| ....
| ....
| }
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4084564#4084564
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4084564
18 years, 9 months
[JBoss Portal] - Updated Preferences not available
by chennaikar
Hi,
I am trying to get the updated preferences from the PortletPreferences interfaces, but I keep getting the values set in the xml.
Here is my Portlet code
| public void doView(RenderRequest request, RenderResponse response) {
| .........
| System.out.println("Name is:"+prefs.getValue("name", "AAAA"));
| .........
| }
|
Here is my portlet-instances.xml
| <deployments>
| <deployment>
| <instance>
| <instance-id>myInstance</instance-id>
| <portlet-ref>MyPortlet</portlet-ref>
| <preferences>
| <preference>
| <name>name</name>
| <value>YYYY</value>
| </preference>
| </preferences>
| </instance>
| </deployment>
| </deployments>
|
When I execute the portlet I get
| Name is:YYYY
|
When I log into admin portal and change the value of the preference to "ZZZZ" and execute the portlet I sill get
| Name is:YYYY
|
What am I missing.
Please help.
TIA
Chennaikar
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4084562#4084562
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4084562
18 years, 9 months
[JBoss Seam] - reasociating detached entities (non smpc)
by cba2
Because I am using Seam only for the presentation layer (and Spring for the rest) obviously I have no seam managed persistence context. If I would nevertheless like to store (hibernate) entities inside my long running conversations I run into many problems. I always get LazyInitializationExceptions because my entities from a previous request (but from the same conversation) are no longer associated with the current session.
What is the easiest way to manually re-associate all detached entities in my conversation with the new session of the current request? I tried to study the Seam source code but did not discover which trick Seam uses to achieve this so smoothly an transparent.
FYI: I'm using Seam 2.0.0.BETA1 and Hibernate 3 (and Spring 2).
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4084552#4084552
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4084552
18 years, 9 months