當前位置: 首頁>>代碼示例>>Java>>正文


Java Naming.list方法代碼示例

本文整理匯總了Java中java.rmi.Naming.list方法的典型用法代碼示例。如果您正苦於以下問題:Java Naming.list方法的具體用法?Java Naming.list怎麽用?Java Naming.list使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.rmi.Naming的用法示例。


在下文中一共展示了Naming.list方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import java.rmi.Naming; //導入方法依賴的package包/類
public static void main(String[] args) {
    if (args.length == 0) {
        System.err.println("usage: RegistryInspector [registry url]");
        System.exit(-1);
    }

    String registry = args[0];
    try {
        String[] names = Naming.list(registry);
        for (String name : names) {
            Remote remoteObject = Naming.lookup(name);
            if (remoteObject != null) {
                System.out.println("name[" + name + "] class=" + remoteObject.getClass().getCanonicalName());
            } else {
                System.out.println("name[" + name + "] is null.");
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
開發者ID:openNaEF,項目名稱:openNaEF,代碼行數:22,代碼來源:RegistryInspector.java

示例2: main

import java.rmi.Naming; //導入方法依賴的package包/類
public static void main(String[] args) {

		try {

			// BusinessDataService businessData = new BusinessData();
			// LocateRegistry.createRegistry(7777);
			// Naming.rebind("rmi://172.25.133.95:7777/BusinessDataService",
			// businessData);

			// System.setProperty("java.rmi.server.hostname", "172.25.133.95");
			String[] list = Naming.list("rmi://localhost:8888");
			
			ExpressDataService expressData = (ExpressDataService) Naming
					.lookup(list[0]);
			ExpressPO vo = (ExpressPO)expressData.getExpressInfo(null,"kdy-00001");
			System.out.println(vo.getName());

			
//			AccountDataService accountData =(AccountDataService) Naming.lookup(list[2]);
			System.out.println("successful");

		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}
 
開發者ID:Disguiser-w,項目名稱:SE2,代碼行數:28,代碼來源:TestClient.java

示例3: main

import java.rmi.Naming; //導入方法依賴的package包/類
public static void main(String[] args) {
	try {
		String[] list = Naming.list("rmi://localhost:8888");
		
		UserDataService userData = (UserDataService) Naming.lookup(list[1]);
		
		System.out.println("successful");

	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

}
 
開發者ID:Disguiser-w,項目名稱:SE2,代碼行數:15,代碼來源:LiziTestClient.java

示例4: checkServerCallLog

import java.rmi.Naming; //導入方法依賴的package包/類
/**
 * Check serverCallLog output
 */
private static void checkServerCallLog() throws Exception {
    ByteArrayOutputStream serverCallLog = new ByteArrayOutputStream();
    RemoteServer.setLog(serverCallLog);
    Naming.list(LOCATION);
    verifyLog(serverCallLog, "list");

    serverCallLog.reset();
    RemoteServer.setLog(null);
    PrintStream callStream = RemoteServer.getLog();
    if (callStream != null) {
        TestLibrary.bomb("call stream not null after calling " +
                         "setLog(null)");
    } else {
        System.err.println("call stream should be null and it is");
    }
    Naming.list(LOCATION);

    if (usingOld) {
        if (serverCallLog.toString().indexOf("UnicastServerRef") >= 0) {
            TestLibrary.bomb("server call logging not turned off");
        }
    } else if (serverCallLog.toByteArray().length != 0) {
        TestLibrary.bomb("call log contains output but it " +
                         "should be empty");
    }

    serverCallLog.reset();
    RemoteServer.setLog(serverCallLog);
    try {
        // generates a notbound exception
        Naming.lookup(LOCATION + "notthere");
    } catch (Exception e) {
    }
    verifyLog(serverCallLog, "exception");

    serverCallLog.reset();
    RemoteServer.setLog(serverCallLog);
    callStream = RemoteServer.getLog();
    callStream.println("bingo, this is a getLog test");
    verifyLog(serverCallLog, "bingo");
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:45,代碼來源:CheckLogging.java


注:本文中的java.rmi.Naming.list方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。