Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/javax/rmi/PortableRemoteObject/HelloServer.java
38839 views
import javax.naming.InitialContext;1import javax.naming.Context;23public class HelloServer {45static final int MAX_RETRY = 10;6static final int ONE_SECOND = 1000;78public static void main(String[] args) {9int retryCount = 0;10while (retryCount < MAX_RETRY) {11try {12//HelloServer.set("SETTING TEST ITL");13// Step 1: Instantiate the Hello servant14HelloImpl helloRef = new HelloImpl();1516// Step 2: Publish the reference in the Naming Service17// using JNDI API18Context initialNamingContext = new InitialContext();19initialNamingContext.rebind("HelloService", helloRef);2021System.out.println("Hello Server: Ready...");22break;23} catch (Exception e) {24System.out.println("Server initialization problem: " + e);25e.printStackTrace();26retryCount++;27try {28Thread.sleep(ONE_SECOND);29} catch (InterruptedException e1) {30e1.printStackTrace();31}32}33}34}35}363738