On Mon, 19 Feb 2001, you wrote:
> hiya,
> 
> i'll try posting this question again - just subscribed, don't know if it
> missed the list somehow first time.
> 
> i understand that with the in-VM tomcat/jboss integration method calls
> will not lead to objects being serialized.
> does that imply passing args by reference, not by value?
> i'm assuming this applies to remote interface method invocations, where
> args and return values are usually serialized.
> 
> surely this means that beans will behave differently if the client is
> running in the same VM - at least beans that modifies the objects they get
> passed in some way?
> how does this comply with the spec?

If I have two methods on an entity bean,

String getName()
void setName( String name )

with fairly obvious meaning, then it is possible that a call to getName will
return a reference to the cmp-field 'name', which is then modified by the
servlet and persisted by the persistence manager without calling setName().

Is that what you're on about?  If so, I can see how it would be a problem. 
Another problem you will run in to is if two clients are accessing the same
bean sequentially, then one might get a reference to some bean internals, then
the other one might update that internal.  This change will be *immediately*
reflected in the first client, which is probably not what was intended, and
differs from remote behaviour, as you point out.

So what solutions are there for this?  Require that all getXxx methods return a
clone of any internal data?  That's not exactly portable... Could this be done
in one of the interceptors?  This may well require that Cloneable() be
implemented by bean implementations, which again is not portable.  Does the
spec cater for this in some way?  I guess you could just serialize/deserialize
returned objects, but that kinda defeats the purpose of it all...

Anyone with a clue want to comment on this?

Tom


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
List Help?:          [EMAIL PROTECTED]

Reply via email to