On click of updateRecords button, a DB operation is performed which takes a very long time. I intend to show a dynamic progress bar depicting the status of the DB operation to the user.
I am using myfaces.orchestra's access scope & primefaces' progress bar.
The orchestra applies a lock and does not allow the myBean.progressMonitor to be fetched until myBean.updateRecords() is executed completely..
The error is :
Waited for longer than 30000 milliseconds for access to lock org.apache.myfaces.lib._ReentrantLock@2c93ed which is locked by thread ..
There is ReentrantLock which is not allowing the access of FacesContex from different thread. So not able to access the progressbar model and the partial request is locked till the full request is finished. Though ajax is set to 'false'.
How can we allow the concurrent requests with orchestra?
I also tried creating a thread & performing the heavy operation in that thread. But, I do not get the FacesContext there.
What could be the workaround for the same ?
Sample Code Snippet:
<p:commandButton id="updateRecords" onclick="startProgressBar();"
async="true" ajax="false" actionListener="#{myBean.updateRecords}" />
<h:panelGrid id="progressBarPanel">
<p:progressBar id="progress" interval="10"
rendered="#{myBean.progressBarRendered}" ajax="true"
value="#{myBean.progressMonitor}"
widgetVar="pbAjax" labelTemplate="{value}%}"/>
</h:panelGrid>