Changes between Version 3 and Version 4 of JavaParty/RemoteThread


Ignore:
Timestamp:
08/30/06 17:34:15 (7 years ago)
Author:
moschny
Comment:

Re-added images, minor cleanups.

Legend:

Unmodified
Added
Removed
Modified
  • JavaParty/RemoteThread

    v3 v4  
    22[[TracNav]] 
    33 
    4 Because the regular Java class java.lang.Thread is non-remote, it can only be allocated on the current node. To make allocation of activities on remote nodes more convenient, JavaParty declares a simple wrapper class for remote threads. The class jp.lang.RemoteThread itself is a remote class that allows a regular Java thread being controlled from a remote node. jp.lang.RemoteThread provides basically the same interface as java.lang.Tread. 
     4Because the regular Java class `java.lang.Thread` is non-remote, it can only be allocated on the current node. To make allocation of activities on remote nodes more convenient, JavaParty declares a simple wrapper class for remote threads. The class `jp.lang.RemoteThread` itself is a remote class that allows a regular Java thread being controlled from a remote node. `jp.lang.RemoteThread` provides basically the same interface as `java.lang.Tread`. 
    55 
    6 Figure 1 shows the situation, where the application creates a new RemoteThread and passes a local Runnable object as argument. The remote thread is allocated in another virtual machine and the local argument is passes as argument to the same virtual machine as the remote thread is allocated in. 
     6Figure 1 shows the situation, where the application creates a new `RemoteThread` and passes a local `Runnable` object as argument. The remote thread is allocated in another virtual machine and the local argument is passes as argument to the same virtual machine as the remote thread is allocated in. 
    77 
    8   || source:trunk/jp/src/doc/image/distributed-threads-remotethread2.png || 
    9   || Figure 1. Using a RemoteThread to create activities on remote nodes. || 
     8  || [[Image(source:trunk/jp/src/doc/image/distributed-threads-remotethread2.png)]] || 
     9  || Figure 1. Using a `RemoteThread` to create activities on remote nodes. || 
    1010 
    11 The invocation of the start() method is a remote method call to the RemoteThread object. When the remote thread is started, it spawns a newly allocated local Java thread that executes the run() method of the associated Runnable object. All methods for controlling the activity of the remote thread are remote invocations to the RemoteThread object, where they are forwarded to the local Java thread executing on behalf of the remote thread. The RemoteThread objects itself has no activity. This is indicated in the above diagram with missing color in the bar representing the RemoteThread object. 
     11The invocation of the `start()` method is a remote method call to the `RemoteThread` object. When the remote thread is started, it spawns a newly allocated local Java thread that executes the `run()` method of the associated `Runnable` object. All methods for controlling the activity of the remote thread are remote invocations to the `RemoteThread` object, where they are forwarded to the local Java thread executing on behalf of the remote thread. The `RemoteThread` objects itself has no activity. This is indicated in the above diagram with missing color in the bar representing the `RemoteThread` object. 
    1212 
    13 There is another possibility to create activities on far nodes, without using the RemoteThread class as shown in figure 2. Here the runnable object is declared remote and allocated on a far node. This remote runnable object is passes to the constructor of a local Java thread. 
     13There is another possibility to create activities on far nodes, without using the `RemoteThread` class as shown in figure 2. Here the runnable object is declared `remote` and allocated on a far node. This remote runnable object is passed to the constructor of a local Java thread. 
    1414 
    15   || source:trunk/jp/src/doc/image/distributed-threads-remotethread1.png || 
     15  || [[Image(source:trunk/jp/src/doc/image/distributed-threads-remotethread1.png)]] || 
    1616  || Figure 2. Using a local thread to create activities on remote nodes. || 
    1717 
    18 When starting the local Java thread, it immediately performs a remote method invocation to the run() method of its associated runnable object. The remote method is executed on the far node in a thread belonging to the communication subsystem. If the remote method run() returns, the locally created Java thread terminates. 
     18When starting the local Java thread, it immediately performs a remote method invocation to the `run()` method of its associated runnable object. The remote method is executed on the far node in a thread belonging to the communication subsystem. If the remote method `run()` returns, the locally created Java thread terminates. 
    1919 
    2020With JavaParty's Transparent Threads, both approaches are functionally equivalent. The first one might consume slightly less resources, because there exist one activity less than in the second approach. The second one is slightly more convenient, because starting the activity is indistinguishable from regular Java.