Hi!

A PersistenceContext is not thread safe, therefore, Orchestra tries to avoid 
that by locking the request.
It would be nice, if Orchestra does this just for requests requireing a 
PersistenceContext. But till today, we did not manage to spend some time to 
optimize that code.

You can set the webapp init parameter 
org.apache.myfaces.orchestra.CoreConfig:SERIALIZE_REQUESTS to false so that 
Orchestra does not check for thread safety.

You then have to ensure threadsafety against the PersistenceContext yourself 
(which might not be easy … not to say, impossible :-( )

Ciao,
Mario


Von: vojtech.zav...@gmail.com [mailto:vojtech.zav...@gmail.com] Im Auftrag von 
Vojtech Zavrel
Gesendet: Donnerstag, 20. August 2009 10:51
An: users@myfaces.apache.org
Betreff: Concurrent requests and Orchestra

Hi,
 we have a problem with concurrent request using combination Orchestra + Spring 
+ Trinidad. The application uses more than one window per session, so we have 
migrated all our beans to orchestra's conversation scope using 
conversation.manual.
We have a progress bar which is poling AJAX request during the main request is 
being done. Once user is waiting to the main request, there are partial 
requests each five seconds using Trinidad Javascript API. To be able handle 
more requests the partial request goes in another frame with same 
conversationContext.
Both partial and full request are accessing to the same bean. And this is the 
problem because there is there is ReentrantLock used not to be able to access 
to FacesContex from different thread. So that means, that we are not able to 
access to the progressbar model and the partial request is locked till the full 
request is finished. But I haven't understood why there is this concurrent 
limitatins because they aren't in other scopes.

This is the comment from the source code:

// Fetch a context for this request if one already exists, and lock it
72 // so that concurrent requests that affect this context block until
73 // this request is complete. Not doing so can cause races for resources
74 // within the current context, such as beans or PersistenceContexts.

But what kind of races and why there are not same problems using other scopes. 
Can anybody explain me the reasons please? Is there any possibility how to make 
a workaround?

Thanks


Daemon Thread [http-8080-1] (Suspended)
Object.wait(long) line: not available [native method] [local variables 
unavailable]
_ReentrantLock.lockInterruptibly() line: 80
ConversationContext.lockInterruptablyForCurrentThread() line: 475
ContextLockRequestHandler.init(FacesContext) line: 96
OrchestraFacesContextFactory$1.<init>(OrchestraFacesContextFactory, 
FacesContext, boolean, LinkedList, FacesContext) line: 119
OrchestraFacesContextFactory.getFacesContext(Object, Object, Object, Lifecycle) 
line: 100
RequestParameterFacesContextFactory.getFacesContext(Object, Object, Object, 
Lifecycle) line: 92
FacesContextFactoryImpl.getFacesContext(Object, Object, Object, Lifecycle) 
line: 64
FacesServlet.service(ServletRequest, ServletResponse) line: 260
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 
290
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 206
TrinidadFilterImpl._invokeDoFilter(ServletRequest, ServletResponse, 
FilterChain) line: 238
TrinidadFilterImpl._doFilterImpl(ServletRequest, ServletResponse, FilterChain) 
line: 195
TrinidadFilterImpl.doFilter(ServletRequest, ServletResponse, FilterChain) line: 
138
TrinidadFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 92
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 
235
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 206
LicenseFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 123
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 
235
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 206
ResponseHeaderFilter.doFilter(ServletRequest, ServletResponse, FilterChain) 
line: 54
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 
235
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 206
SessionTimeoutFilter.doFilter(ServletRequest, ServletResponse, FilterChain) 
line: 116
ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 
235
ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 206
StandardWrapperValve.invoke(Request, Response) line: 233
StandardContextValve.invoke(Request, Response) line: 175
StandardHostValve.invoke(Request, Response) line: 128
ErrorReportValve.invoke(Request, Response) line: 102
StandardEngineValve.invoke(Request, Response) line: 109
CoyoteAdapter.service(Request, Response) line: 263
Http11Processor.process(Socket) line: 844
Http11Protocol$Http11ConnectionHandler.process(Socket) line: 584
JIoEndpoint$Worker.run() line: 447
Thread.run() line: 619

Reply via email to