Java.lang.String is immutable - it has no setter
method.

Shing.


--- Sri Sankaran <[EMAIL PROTECTED]> wrote:
> I was reading Tapestry In Action and did not
> understand the implication of clustering a mutable
> object. Hope you can explain.
>  
> To set the stage, the section states that an app
> server -- such as Web Logic -- broadcasts a change
> to all servers in a cluster in response to an
> invocation of the setAttribute method of an
> HttpSession.  The article goes on differentiate
> mutable and immutable objects placed in a session. 
> It says that depending on the sequence of the steps,
> the value of a session attribute on server in a
> cluster can be stale.  For example:
>  
> session.setAttribute("some token", x);
> x.setSomeValue("some value");
>  
> In this case, since the object referred to by 'x' is
> being modified *after* a call to setAttribute, it
> may not get propagated to all servers in a cluster. 
> The cagey *may not* is because we may get lucky if
> the app server hasn't got around to serializing 'x'
> and broadcasting it, before the application invokes
> the setSomeValue method.
>  
> My question is: How is this any different if x were
> an immutable object -- such as a String?  Wouldn't
> we have the same problem?
>  
> Sri
> 

Home page :
  http://uk.geocities.com/matmsh/index.html

Send instant messages to your online friends http://uk.messenger.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to