> I am trying to use JavaParty for a class project and have several
> ideas in mind (like implementing a distributed image processing
> algorithm, etc.) and wondering to what extent (if at all) the
> existing API classes can shared between nodes... I posted a question
> on the benchmark project forum, which doesn't seem to be alive
> though. I would greatly appreicate if someone answered it, probably
> it's very simple for a JavaParty user; maybe this'll help revive that
> forum too.
First of all, sorry for ignoring your request, I basically did not get a
notification about it - probably, because I forgot monitoring this
forum. Anyway, a better communication means is the newly revived
JavaParty-users mailing list. Please subscribe to "javaparty-users". For
details see:
Forum post:
> Hi! I am trying to use JavaParty for a class project and hoping
> someone could help me with understanding the object model a little
> better before jumping into a lot of coding... A couple of questions:
>
> - a "remote" class has a "static" member which should probably called
> local (a child of an API class, which cannot be remote, if i'm
> guessing right). Once several instances of the remote class exist on
> different nodes, are they allowed to reference the the static
> member?
I do not understand well "which should probably called local". You think
of something like that:
remote class R {
static String member;
void foo() {
System.out.println(member);
}
}
This is allowed, yes. But since the access to "member" is remote in
"foo()", and "String" is no remote class, "member" is copied upon
access. For strings this is irrelevant, since they are immutable. If you
reference another object in that way, make sure, you do not modify it,
or write it back after modification:
Note that this is inefficient, because the whole vector is copied back
and forth. A better solution would be to call a static method of class R
which does the modification on v locally.
> - if not, is it possible to somehow pull the data out of the static
> class into a "remote" custom-built data structure and then put them
> back? Which part of the environment can this member be referenced
> from anyway? The idea is to make several nodes that operate on the
> same data structure.
You can encapsulate each local data structure within a remote class.
Assume you would like to create a remote vector that encapsulates a
local one you could just do the following:
remote class RVector {
private Vector v = new Vector();
void addElement(Object x) {
v.addElement(x);
}
...
}
Now you can use RVector like Vector, but you can access its instances
from everywhere in the distributed environment.
If this was not exactly what you wanted to know, please keep asking -
I've got the feeling that I did not exactly understand your questions,
but tried to do my best to give an answer :-).
BTW.: Object replication for JavaParty is underway. This will greatly
ease the task of operating on a shared data structure in parallel.
Best regards, Bernhard Haumacher.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Grigoryev,
> I am trying to use JavaParty for a class project and have several
> ideas in mind (like implementing a distributed image processing
> algorithm, etc.) and wondering to what extent (if at all) the
> existing API classes can shared between nodes... I posted a question
> on the benchmark project forum, which doesn't seem to be alive
> though. I would greatly appreicate if someone answered it, probably
> it's very simple for a JavaParty user; maybe this'll help revive that
> forum too.
First of all, sorry for ignoring your request, I basically did not get a
notification about it - probably, because I forgot monitoring this
forum. Anyway, a better communication means is the newly revived
JavaParty-users mailing list. Please subscribe to "javaparty-users". For
details see:
http://www.ipd.uka.de/JavaParty/mailing.html
Forum post:
> Hi! I am trying to use JavaParty for a class project and hoping
> someone could help me with understanding the object model a little
> better before jumping into a lot of coding... A couple of questions:
>
> - a "remote" class has a "static" member which should probably called
> local (a child of an API class, which cannot be remote, if i'm
> guessing right). Once several instances of the remote class exist on
> different nodes, are they allowed to reference the the static
> member?
I do not understand well "which should probably called local". You think
of something like that:
remote class R {
static String member;
void foo() {
System.out.println(member);
}
}
This is allowed, yes. But since the access to "member" is remote in
"foo()", and "String" is no remote class, "member" is copied upon
access. For strings this is irrelevant, since they are immutable. If you
reference another object in that way, make sure, you do not modify it,
or write it back after modification:
static Vector v;
void anotherFoo() {
Vector tmp = v;
tmp.addElement(...);
v = tmp;
}
Note that this is inefficient, because the whole vector is copied back
and forth. A better solution would be to call a static method of class R
which does the modification on v locally.
> - if not, is it possible to somehow pull the data out of the static
> class into a "remote" custom-built data structure and then put them
> back? Which part of the environment can this member be referenced
> from anyway? The idea is to make several nodes that operate on the
> same data structure.
You can encapsulate each local data structure within a remote class.
Assume you would like to create a remote vector that encapsulates a
local one you could just do the following:
remote class RVector {
private Vector v = new Vector();
void addElement(Object x) {
v.addElement(x);
}
...
}
Now you can use RVector like Vector, but you can access its instances
from everywhere in the distributed environment.
If this was not exactly what you wanted to know, please keep asking -
I've got the feeling that I did not exactly understand your questions,
but tried to do my best to give an answer :-).
BTW.: Object replication for JavaParty is underway. This will greatly
ease the task of operating on a shared data structure in parallel.
Best regards, Bernhard Haumacher.