+ All Categories
Home > Documents > Spago thread safety BUG. Situazione Lutente richiama una pagina PAGE con publisher jsp (padre) La...

Spago thread safety BUG. Situazione Lutente richiama una pagina PAGE con publisher jsp (padre) La...

Date post: 01-May-2015
Category:
Upload: pietro-messina
View: 215 times
Download: 1 times
Share this document with a friend
6
Spago thread safety BUG
Transcript
Page 1: Spago thread safety BUG. Situazione Lutente richiama una pagina PAGE con publisher jsp (padre) La jsp (padre) di presentazione fa 3 chiamate ajax a 3.

Spago thread safety BUG

Page 2: Spago thread safety BUG. Situazione Lutente richiama una pagina PAGE con publisher jsp (padre) La jsp (padre) di presentazione fa 3 chiamate ajax a 3.

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

Page 3: Spago thread safety BUG. Situazione Lutente richiama una pagina PAGE con publisher jsp (padre) La jsp (padre) di presentazione fa 3 chiamate ajax a 3.

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

Page 4: Spago thread safety BUG. Situazione Lutente richiama una pagina PAGE con publisher jsp (padre) La jsp (padre) di presentazione fa 3 chiamate ajax a 3.

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>

Page 5: Spago thread safety BUG. Situazione Lutente richiama una pagina PAGE con publisher jsp (padre) La jsp (padre) di presentazione fa 3 chiamate ajax a 3.

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)

Page 6: Spago thread safety BUG. Situazione Lutente richiama una pagina PAGE con publisher jsp (padre) La jsp (padre) di presentazione fa 3 chiamate ajax a 3.

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


Recommended