Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PhaseListener blocks application

537328Jan 29 2008 — edited Apr 30 2008
Hello, I have a rather critical problem. I modified the ADF lifecycle by creating a phaseListener that executes some code in the <b> UPDATE_MODEL_VALUES </b>afterPhase and we just realized that <b>only one</b> user can work in the application at a time.
<p/>
This is what happens, user1 opens the jsp and starts working, when a checkbox is selected (it also happens with other components) the afterPhase is executed, this method does some queries to the database and executes some other calculations and it takes about 30 seconds to do everything that it has to do. Now, the user2 logs into the system, and tries to go into the same page but the application does not respond, once the 30secs are over the application gets back to work and now user2 can do whatever he wants, but only after the phaseListener that the user1 fired has finished what it was doing, which means that during that period of time no one else can use the application!! we didn't notice this before because our previous tests took about 2 secs so it wasn't noticeable, but now that we are using real data obtained by external webServices the response takes a lot longer.
<p/>
<b>this is my phaseListener</b>

<p/>
[corresponding imports]
<p/>
public class LocalRoutinesPhaseListener implements PhaseListener {
<p/>
/**
* Logger
*/
private static Logger logger = Logger.getLogger(LocalRoutinesPhaseListener.class);
<p/>
private static final long serialVersionUID = 3576307615728932485L;
<p/>
public LocalRoutinesPhaseListener() {<p/>
}
<p/>
public void beforePhase(PhaseEvent phaseEvent) {
}
<p/>
public void afterPhase(PhaseEvent phaseEvent) {<p/>
String viewId = phaseEvent.getFacesContext().getViewRoot().getViewId();<p/>
if (viewId.contains(ValidationsPhaseListener.PARSE_WEB) || viewId.contains(ValidationsPhaseListener.POPUP_MR)
|| viewId.contains(ValidationsPhaseListener.EDIT_TASK)) {<p/>
Boolean isPopUp = false;<p/>

if (viewId.contains(ValidationsPhaseListener.POPUP_MR)) {<p/>
isPopUp = true;<p/>
}<p/>

BTRenderWebUtil bTRenderWebUtil = new BTRenderWebUtil();<p/>
FisaDataBean dataBean = bTRenderWebUtil.getDataBean();<p/>
if (dataBean != null) {<p/>
CoreInputHidden changedComponent = dataBean.getChangedComponent();<p/>
String changedComponentId = null;<p/>
AdfFacesContext adfContext = AdfFacesContext.getCurrentInstance();<p/>

if (changedComponent != null && changedComponent.getValue() != null) {<p/>
changedComponentId = changedComponent.getValue().toString();<p/>
UIComponent component = null;<p/>
if (changedComponentId != null) {<p/>
component = new BTRenderWebUtil().findComponentInRoot(changedComponentId);<p/>

if (component != null) {<p/>
bTRenderWebUtil.executeLocalRutine(component, isPopUp); <b>//<---- all the queries and calculations are executed in this method </b><p/> }<p/>
}<p/>
}<p/>
changedComponent.setValue(null);<p/>
adfContext.addPartialTarget(changedComponent);<p/>
component = null;<p/>
}<p/>
}<p/>
}<p/>
}<p/>
<p/>
public PhaseId getPhaseId() {<p/>
return PhaseId.UPDATE_MODEL_VALUES;<p/>
}<p/>
}<p/>
<p/><p/>
this is the phasesListener configuration:<p/>

<lifecycle><p/>
<phase-listener>com.fisa.efisa.process.render.manage.bean.LocalRoutinesPhaseListener</phase-listener><p/>
</lifecycle><p/>

Please tell me what is it that I'm doing wrong. I really hope you can help me, I think this is a serious problem because only one person can use the application at a time!!
<p/>
Thank you so much!!
<p/>
Tamara
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 28 2008
Added on Jan 29 2008
2 comments
666 views