You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Benoit Hudzia <be...@gmail.com> on 2006/09/01 15:55:44 UTC

vm-pipe and object reference passing

I am currently implementing a p2p grid system (Dget). In this system I have
entity moving from one peers to another ( to simplify entity = agent on
steroid).
 
Since I can have multiple entities on one local system, I use the vmpipe
from mina to provide a uniform communication model for theses entities. When
two entity communicate with each other remotely, they both go through the
encoder decoder layer (serialization, or custom binary encoding etc ..)  .
But when they are both hosted on the same peers we simply forward the
object/ message directly using vmpipe.
 
One problem arises at that level because the message and the instance of
objects within are passed as reference. This means that when one entity is
modifying the object passed it is also modifying the object on the other
entity (since they share the same reference). It might be useful in some
case (actually its very useful in most of my internal communication/routing
within the peer), but its not really consistent with communication
abstraction because when you are communicating you should not share message
/ objects . 
 
To go around such problem I used deep cloning technique of the object
(custom fast serialization / de-serialization during the routing of the
message within the peers) . But it might useful to enable/disable such
behaviour at the vmpipe level. Or maybe proposing a deep cloning filter for
people that want it?
If people are interested I can donate the code for deep cloning filter. 
 
Benoit Hudzia
Parallel Computing Research Group
School of Computer Science & Informatics
University College Dublin
Ireland

Tel: +353 1 716 2403
Fax: +353 1 269 7262
E-mail: benoit [dot] hudzia [at] ucd [dot] ie
Web: <http://benoit.hudzia.googlepages.com/>  Personnal Web Page,
<http://voidreflections.blogspot.com> Blog 
 

Re: vm-pipe and object reference passing

Posted by Trustin Lee <tr...@gmail.com>.
Hi Benoit,

On 9/1/06, Benoit Hudzia <be...@gmail.com> wrote:
>
> One problem arises at that level because the message and the instance of
> objects within are passed as reference. This means that when one entity is
> modifying the object passed it is also modifying the object on the other
> entity (since they share the same reference). It might be useful in some
> case (actually its very useful in most of my internal
> communication/routing
> within the peer), but its not really consistent with communication
> abstraction because when you are communicating you should not share
> message
> / objects .


I see.

To go around such problem I used deep cloning technique of the object
> (custom fast serialization / de-serialization during the routing of the
> message within the peers) . But it might useful to enable/disable such
> behaviour at the vmpipe level. Or maybe proposing a deep cloning filter
> for
> people that want it?


The best solution would be using an immutable objects, but it isn't
sometimes easy as I say.  Deep cloning filter would be a nice idea.

If people are interested I can donate the code for deep cloning filter.


Sure.  I am interested and will be looking forware to your donation.  Please
create a JIRA issue and attach the patch file to the issue.  Please don't
forget to mark a checkbox that your attachment will belong to the ASF, which
takes care of license stuff.

Thank you,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6