Contents
See also
Powered by
|
Object Location
An object layout with good locality is critical for a JavaParty
application to achieve good performance. The initial location of a
remote object allocated with the new statement is
determined in one of the following ways:
-
If the programmer does not care about object placement,
it is determined by a distributor class that may be specified
when executing the JavaParty application. For detailed
information about the distributor objects
please refer to the JavaParty API documentation.
Because the concept of object and class distributors does
not require the mixing of application code with distribution
code, this approach is very attractive. The application
continues to look like regular non-distributed Java and the
allocation decisions are made transparent to the application
code by the runtime system. Unfortunately, the information
that can be passed to the distributor object only consists of
the name of the class that is instantiated and may not suffice
to make a well-informed decision.
-
The object layout can also be specified directly at the
statement where the allocation occurs. JavaPary uses a
program annotation in form of a Java documentation comment
specifying the node of the object to be allocated with the
tag @at.
The following code snippet allocates an object of remote
class R on each node of the distributed
environment.
import jp.lang.DistributedRuntime;
public void foo() {
int cnt = DistributedRuntime.getMachineCnt();
for (int n = 0; n < cnt; n++) {
/** @at n */
R r = new R();
}
}
Since good object locality is important, please also read the
sections about Object migration and Remote Threads.
|