本文整理汇总了Java中java.rmi.registry.Registry.unbind方法的典型用法代码示例。如果您正苦于以下问题:Java Registry.unbind方法的具体用法?Java Registry.unbind怎么用?Java Registry.unbind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.rmi.registry.Registry
的用法示例。
在下文中一共展示了Registry.unbind方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: unBind
import java.rmi.registry.Registry; //导入方法依赖的package包/类
/**
* <p>
* Un-bind the scheduler from an RMI registry.
* </p>
*/
private void unBind() throws RemoteException {
String host = resources.getRMIRegistryHost();
// don't un-export if we're not configured to do so...
if (host == null || host.length() == 0) {
return;
}
Registry registry = LocateRegistry.getRegistry(resources
.getRMIRegistryHost(), resources.getRMIRegistryPort());
String bindName = resources.getRMIBindName();
try {
registry.unbind(bindName);
UnicastRemoteObject.unexportObject(this, true);
} catch (java.rmi.NotBoundException nbe) {
}
getLog().info("Scheduler un-bound from name '" + bindName + "' in RMI registry");
}
示例2: vaciarRegistroRMI
import java.rmi.registry.Registry; //导入方法依赖的package包/类
public static boolean vaciarRegistroRMI (Registry regtr) {
if (regtr == null) return true;
// ItfUsoRecursoTrazas trazas = Directorio.getRecursoTrazas();
// NombresPredefinidos.REPOSITORIO_INTERFACES_OBJ = repositorioInterfaces;
try {
trazas.aceptaNuevaTraza(new InfoTraza ("AdaptadorRegRMI", "Vaciando registro RMI", NivelTraza.info));
String [] listaRemotos = regtr.list();
for (String obj : listaRemotos) regtr.unbind(obj);
return true;
} catch (Exception e) {
trazas.aceptaNuevaTraza(new InfoTraza("AdaptadorRegRMI", "Fallo al vaciar registro RMI", NivelTraza.error));
return false;
}
}
示例3: main
import java.rmi.registry.Registry; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
Registry impl = TestLibrary.createRegistryOnUnusedPort();
Registry stub = (Registry) RemoteObject.toStub(impl);
stub.bind("", stub);
stub.lookup("");
stub.rebind("", stub);
stub.lookup("");
stub.unbind("");
}
示例4: main
import java.rmi.registry.Registry; //导入方法依赖的package包/类
public static void main(String args[]) throws Exception {
try {
testPkg.Server obj = new testPkg.Server();
testPkg.Hello stub = (testPkg.Hello) UnicastRemoteObject.exportObject(obj, 0);
// Bind the remote object's stub in the registry
Registry registry =
LocateRegistry.getRegistry(TestLibrary.READTEST_REGISTRY_PORT);
registry.bind("Hello", stub);
System.err.println("Server ready");
// now, let's test client
testPkg.Client client =
new testPkg.Client(TestLibrary.READTEST_REGISTRY_PORT);
String testStubReturn = client.testStub();
if(!testStubReturn.equals(obj.hello)) {
throw new RuntimeException("Test Fails : unexpected string from stub call");
} else {
System.out.println("Test passed");
}
registry.unbind("Hello");
} catch (Exception e) {
System.err.println("Server exception: " + e.toString());
e.printStackTrace();
}
}
示例5: main
import java.rmi.registry.Registry; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
Registry impl = TestLibrary.createRegistryOnEphemeralPort();
Registry stub = (Registry) RemoteObject.toStub(impl);
stub.bind("", stub);
stub.lookup("");
stub.rebind("", stub);
stub.lookup("");
stub.unbind("");
}
示例6: main
import java.rmi.registry.Registry; //导入方法依赖的package包/类
public static void main(String args[]) throws Exception {
Registry registry = null;
int exit = 0;
try {
int port = Integer.valueOf(args[0]);
testPkg.Server obj = new testPkg.Server();
testPkg.Hello stub =
(testPkg.Hello) UnicastRemoteObject.exportObject(obj, 0);
// Bind the remote object's stub in the registry
registry = LocateRegistry.getRegistry(port);
registry.bind("Hello", stub);
System.err.println("Server ready");
testPkg.Client client = new testPkg.Client(port);
String testStubReturn = client.testStub();
if(!testStubReturn.equals(obj.hello)) {
throw new RuntimeException("Test Fails : "
+ "unexpected string from stub call");
}
registry.unbind("Hello");
System.out.println("Test passed");
} catch (Exception ex) {
exit = EXIT_FAIL;
ex.printStackTrace();
}
// need to exit explicitly, and parent process uses exit value
// to tell if the test passed.
System.exit(exit);
}