wiki:Examples/HelloJP

/* ***************************************************************************
 * JavaParty
 *
 * Copyright (C) 1996-2007 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.
 *****************************************************************************/

package examples;

import jp.lang.DistributedRuntime;

/** Distributed Hello World in JavaParty
 *
 * $Revision: 1.5 $
 * $Date: 2007/05/04 21:08:00 $
 * $Revision: 1.4 $
 * $Date: 2002/04/05 12:49:41 $
 *
 *  @author Bernhard Haumacher <haui@haumacher.de>
 */
public remote class HelloJP {
    public void hello() {
        // Print on the console of the virtual machine where the
        // object lives
        System.out.println("Hello JavaParty!");
        System.out.println("I am on machine number: "+DistributedRuntime.getMachineID());
    }

    public static void main(String[] args) {
        for (int n = 0; n < 10; n++) {
            // Create a remote object on some node
            HelloJP world = new HelloJP();

            // Remotely invoke a method
            world.hello();
        }
    }
}
Last modified 10 years ago Last modified on Jun 4, 2007 9:09:04 PM