JavaParty Logo

JavaParty

A distributed companion to Java
Current release 1.9.5

Bernhard Haumacher, Thomas Moschny and Michael Philippsen

Contents
General
 Features
 Requirements
 DownloadNew!
 Mailing ListsNew!
 Setup
 Quick Tour
 Command Reference
 API
Language
 Syntax
 Object Model
 Transparent Threads
 Distributed ThreadsCool!
 RMACool!
 Synchronization
 Object Location
 Migration
 Remote Threads
 Replicated ObjectsCool!
 Multi-Application
Tuning
 Debugging
 uka.transport
 KaRMICool!
 KaRMI API
 Myrinet/GM
 OpenPBS
Examples
 Hello JavaParty
displayed pageObjectModel
 BenchmarksNew!
Other info
 Papers
 Trouble Shooting
 History


See also
 CJ
 Generic Java


Powered by
Apache Ant
SourceForge
Subversion

Example for the JavaParty Object Model

Source code

/* *************************************************************************** * 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: 3190 $ * $Date: 2007-03-27 21:49:37 +0200 (Tue, 27 Mar 2007) $ */ 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."); } }


For comments and bug reports please use the JavaParty users mailing list.
Page design & maintenance: Bernhard Haumacher.
Last update: Fri Mar 30 18:46:00 GMT+01:00 2007
Java is a trademark of Sun Microsystems.