⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adder.java

📁 《JAVA分布式程序设计》一书的源代码。
💻 JAVA
字号:
import java.io.*;import com.objectspace.lib.timer.*;import com.objectspace.voyager.*;import com.objectspace.voyager.agent.*;/** * @(#)Adder.java * @author Qusay H. Mahmoud */public class Adder implements IAdder, Serializable {   int a[] = {4, 4, 4, 4, 4, 4, 4, 4, 4, 4};   int b[] = {4, 4, 4, 4, 4, 4, 4, 4, 4, 4};   public Adder() {      System.out.println("constuct an array adder");   }      public void finalize() {      System.out.println("finalize array adder");   }   public void add(IArith arith) {      System.out.println("remote adder");      addAt(arith);      System.out.println("local adder");      try {        Agent.of(this).moveTo(arith, "atMachine");      } catch(Exception e) {        System.err.println(e);      }   }     public void atMachine(IArith arith) {      System.out.println("at remote machine, home = "+Agent.of(this).getHome());      addAt(arith);      Agent.of(this).setAutonomous(false);   }   public void addAt(IArith arith) {      int result[] = new int[10];      System.out.println("start adding");      result = arith.addArrays(a, b);      System.out.println("stop adding");      // print result      for(int i=0; i<10; i++) {        System.out.println(result[i]);      }   }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -