Spago thread safety BUG. Situazione Lutente richiama una pagina PAGE con publisher jsp (padre) La...
-
Upload
pietro-messina -
Category
Documents
-
view
217 -
download
1
Transcript of Spago thread safety BUG. Situazione Lutente richiama una pagina PAGE con publisher jsp (padre) La...
Spago thread safety BUG
Situazione• L’utente richiama una pagina PAGE con
publisher jsp (padre)
• La jsp (padre) di presentazione fa 3 chiamate ajax a 3 PAGE spago diverse
Passo 2• Ogni page richiamata via ajax ha un publisher jsp (figlie)
• Ogni jsp figlia si limita a mostrare la service response tramite oggetti diversi in tempi diversi:
– ResponseContainerAccess.getResponseContainer(request).getServiceResponse()
– ResponseContainer.getResponseContainer().getServiceResponse()
– E anche dopo un attesa di 100ms.
– ResponseContainerAccess.getResponseContainer(request).getServiceResponse()
– ResponseContainer.getResponseContainer().getServiceResponse()
1 2
3 4
In teoria le 4 textarea dovrebbero mostrare la service_response prodotta dalla PAGE corrispondente
Codice JSP (figlie)
– <table style="font-size: 70%;">– <tr><td>– <b>ResponseContainerAccess.getResponseContainer(request).getServiceResponse()</b>– <textArea cols="50" rows="5"><%= ResponseContainerAccess.getResponseContainer(request).getServiceResponse()%></
textArea>– </td>– <td>– <b>ResponseContainer.getResponseContainer().getServiceResponse()</b>– <textArea cols="50" rows="5"><%= ResponseContainer.getResponseContainer().getServiceResponse()%></textArea><br/>– </td></tr>– <tr><td colspan="2">Sleep di 100ms</td></tr>– <%– Thread t = new Thread();– t.sleep(100);– %>– <tr><td>– <b>ResponseContainerAccess.getResponseContainer(request).getServiceResponse()</b>– <textArea cols="50" rows="5"><%= ResponseContainerAccess.getResponseContainer(request).getServiceResponse()%></
textArea>– </td>– <td>– <b>ResponseContainer.getResponseContainer().getServiceResponse()</b>– <textArea cols="50" rows="5"><%= ResponseContainer.getResponseContainer().getServiceResponse()%></textArea><br/>– </td></tr>– </table>
BUG?• In pratica, a fronte di più richieste contemporanee ( es 3 chiamate ajax ) eseguite su pagine
diverse il ResponseContainerAccess confonde la service response di request con quella di un’altra.
• Il risultato è visibile nel seguente screenshoot
Nella stessa jsp l’accesso alla serviceResponse in istanti diversi produce risultati diversi (sempre nell’esecuzione della stessa page)
in particolare la serviceResponse errata visualizzata dalla chiamata ajax 1 è relativa a quella prodotta da un’altra chiamata ajax Page 2
Ajax Page 1
AjaxPage 2
AjaxPage 3