Last modified 7 years ago
Last modified on 03/23/06 00:44:13
TracNav
JavaParty
- Overview
- Requirements
- Download

- Registration
- Setup
- Quick Tour
- Mailing Lists
- Command Reference
- Debugging
- OpenPBS
- API
- FAQ
- History
Language
- Syntax
- Object Model
- Transparent Threads
- Distributed Threads
- Remote Monitors
- Synchronization
- Object Location
- Object Migration
- Remote Threads
- Replicated Objects

- Multi-Application

Examples
uka.transport...
KaRMI...
See also
/* *************************************************************************** * JavaParty * * Copyright (C) 1996-2002 The JavaParty Team, University of Karlsruhe * * Permission is hereby granted to modify and use this software for research * and teaching purposes. Modification for commercial purposes requires * prior written permission by the author. * * The software, or modifications thereof, may be redistributed only * if this copyright notice stays attached. *****************************************************************************/ /* * $Revision: 1.3 $ * $Date: 2002/04/05 12:49:40 $ */ package examples; /** Instances of this class are used to test parameter passing */ class Param implements java.io.Serializable {} /** * @author Bernhard Haumacher <haui@haumacher.de> */ public remote class ObjectModel { Param p; public void foo(Param p) { this.p = p; } static Param q; public static void bar(Param q) { ObjectModel.q = q; } public void test() { Param a = new Param(); // invoke method of same object without a reference foo(a); if (this.p != a) throw new RuntimeException("(a)"); // invoke method of same object with this reference this.foo(a); if (this.p != a) throw new RuntimeException("(b)"); ObjectModel model = this; // invoke method of same object with arbitrary reference model.foo(a); if (this.p == a) throw new RuntimeException("(c)"); // invoke static method from instance method bar(a); if (ObjectModel.q == a) throw new RuntimeException("(d)"); // invoke static method from instance method with class name // reference ObjectModel.bar(a); if (ObjectModel.q == a) throw new RuntimeException("(e)"); } public static void testStatic() { Param a = new Param(); // invoke static method of same class bar(a); if (ObjectModel.q != a) throw new RuntimeException("(f)"); // invoke static method of same class with class name // reference // TBD: This does not work correctly and throws an exception // (see BUG/0061). // ObjectModel.bar(a); // if (ObjectModel.q != a) throw new RuntimeException("(g)"); } public static void main(String args[]) { new ObjectModel().test(); testStatic(); System.out.println("Test completed successfully."); } }

