Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   RMI conundrum (http://www.velocityreviews.com/forums/t148793-rmi-conundrum.html)

VisionSet 12-23-2005 05:25 PM

RMI conundrum
 
I send an object over RMI

myRemoteMethod(myObject);

But I want to do something to myObject after it has been safely serialised
(ie I don't want the server to know of the change I want to make). I don't
want to have to wait until the remote method returns. If I fire the method
off in its own thread then I can ascertain when that thread is running, but
I can't be sure when myObject has been serialised.
I realise I can get round this by cloning myObject but is there an
alternative. Seems a pain to have to implement cloning throughout my object
tree just for this, especially when serialisation is going to do it for me -
just that I can't get at it - or can I?

--
Mike W




Mandar Amdekar 01-02-2006 10:29 PM

Re: RMI conundrum
 
No automatic way as near as I can tell.

However, you could override the serialization / externalization method
in the class that is the root of your complex data structure, and as
part of it, implement the observer pattern. Then you simply hook up
one or more observers to all root objects on creation (for simplicity)
and in the observer, use some sort of a delay before triggering the
change logic.


VisionSet 01-02-2006 10:42 PM

Re: RMI conundrum
 

"Mandar Amdekar" <mandar.amdekar@gmail.com> wrote in message
news:1136240973.118573.211260@g14g2000cwa.googlegr oups.com...
> No automatic way as near as I can tell.
>
> However, you could override the serialization / externalization method
> in the class that is the root of your complex data structure, and as
> part of it, implement the observer pattern. Then you simply hook up
> one or more observers to all root objects on creation (for simplicity)
> and in the observer, use some sort of a delay before triggering the
> change logic.


Good idea, I may well do that.
I'll have to check that the order of serialisation runs children first, root
last though.

--
Mike W




All times are GMT. The time now is 11:48 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.