import java.rmi.*;

public class HelloC extends Thread {

	int id;

public HelloC(int id)
{
	this.id = id;
}

public void run () {
	String message = "";
	try {
		System.out.println("	" + id + " is in run.");
		Hello obj =
			 (Hello)Naming.lookup("//yps/HelloServer");

		if ( id % 2 == 0 )
			message = obj.sayHelloAndWait();
		else
			message = obj.synchronizedSayHelloAndWait();

		System.out.println(id + ": " + message);

	} catch (Exception e) {
		System.out.println("HelloC exception: " +
		e.getMessage());
		e.printStackTrace();
	}
}

public static void main(String args[] ) {
	for ( int i = 0; i < 10; i ++ )
		new HelloC(i).start();
  }
}

