On Mon, 01 Nov 2010 11:43:28 -0200, Paulo Andrade <p...@mega.ist.utl.pt>
wrote:
Hello,
Hi!
Sorry if this an easy question,
It isn't. Actually, it's not even a Tapestry-only problem, but of stateful
web applications too.
but I'm new to tapestry and couldn't quite figure out how does tapestry
handle sessions.
Tapestry just delegates to an HttpSession.
If two request for the same session arrive simultaneously, will the
session object be accessed concurrently in two threads?
Yes, as in (almost) any other Java web app.
Take the following code:
______
@SessionState
Foo someSessionObject;
bool someSessionObjectExists;
if( !someSessionObjectExists ){
someSessionObject = getSomeSessionObject();
}
You can use @SessionState(create = null) and check if someSessionObject is
null directly.
If two request with the same session execute that if statement the
getSomeSessionObject() might be called twice and thus creating two
objects.
Yes, but only one will be used, as both will be mapped to the same session
attribute name.
Coming form WebObjects I usually don't have to worry about this because
I know that two threads are never accessing the same Session object
simultaneously. All session access is serialized.
So how does this work with tapestry?
Tapestry nor the Servlet API synchronize access to the session.
PS: I'm playing with Tapestry 5.2.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
Consultor, desenvolvedor e instrutor em Java, Tapestry e Hibernate
Coordenador e professor da Especialização em Engenharia de Software com
Ênfase em Java da Faculdade Pitágoras
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org