use of java.rmi.registry.Registry in project jdk8u_jdk by JetBrains.
the class SelfTerminator method main.
public static void main(String[] args) {
try {
int registryPort = Integer.parseInt(System.getProperty("rmi.registry.port"));
Registry registry = LocateRegistry.getRegistry("", registryPort);
Remote stub = registry.lookup(LeaseCheckInterval.BINDING);
Runtime.getRuntime().halt(0);
} catch (Exception e) {
e.printStackTrace();
}
}
use of java.rmi.registry.Registry in project jdk8u_jdk by JetBrains.
the class KeepAliveDuringCall method main.
public static void main(String[] args) {
System.err.println("\nRegression test for bug 4308492\n");
KeepAliveDuringCall obj = new KeepAliveDuringCall();
try {
UnicastRemoteObject.exportObject(obj);
System.err.println("exported shutdown monitor");
Registry localRegistry = TestLibrary.createRegistryOnUnusedPort();
int registryPort = TestLibrary.getRegistryPort(localRegistry);
System.err.println("created local registry");
localRegistry.bind(BINDING, obj);
System.err.println("bound shutdown monitor in local registry");
System.err.println("starting remote ShutdownImpl VM...");
(new JavaVM("ShutdownImpl", "-Drmi.registry.port=" + registryPort, "")).start();
Shutdown s;
synchronized (obj.lock) {
System.err.println("waiting for submission of object to shutdown...");
while ((s = obj.shutdown) == null) {
obj.lock.wait(TIMEOUT);
}
if (s == null) {
throw new RuntimeException("TEST FAILED: timeout waiting for shutdown object " + "to make initial contact");
}
System.err.println("shutdown object submitted: " + s);
}
try {
s.shutdown();
} catch (RemoteException e) {
throw new RuntimeException("TEST FAILED: shutdown method threw remote exception", e);
}
synchronized (obj.lock) {
if (!obj.stillAlive) {
throw new RuntimeException("TEST FAILED: " + "shutdown object not detected alive after unexport");
}
}
System.err.println("TEST PASSED: " + "shutdown object detected still alive after unexport");
} catch (Exception e) {
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
} else {
throw new RuntimeException("TEST FAILED: unexpected exception", e);
}
} finally {
try {
UnicastRemoteObject.unexportObject(obj, true);
} catch (RemoteException e) {
}
}
}
use of java.rmi.registry.Registry in project Lucee by lucee.
the class CLIFactory method invoke.
private void invoke(final InetAddress current, final String name) throws RemoteException, NotBoundException {
final Registry registry = LocateRegistry.getRegistry(current.getHostAddress(), PORT);
final CLIInvoker invoker = (CLIInvoker) registry.lookup(name);
invoker.invoke(config);
}
use of java.rmi.registry.Registry in project Lucee by lucee.
the class CLIFactory method getRegistry.
public static Registry getRegistry(final int port) {
Registry registry = null;
try {
registry = LocateRegistry.createRegistry(port);
} catch (final RemoteException e) {
}
try {
if (registry == null)
registry = LocateRegistry.getRegistry(port);
} catch (final RemoteException e) {
}
RemoteServer.setLog(System.out);
return registry;
}
use of java.rmi.registry.Registry in project Lucee by lucee.
the class CLIFactory method startInvoker.
private void startInvoker(final String name) throws ServletException, RemoteException {
final Registry myReg = getRegistry(PORT);
final CLIInvokerImpl invoker = new CLIInvokerImpl(root, servletName);
final CLIInvoker stub = (CLIInvoker) UnicastRemoteObject.exportObject(invoker, 0);
myReg.rebind(name, stub);
if (idleTime > 0) {
final Closer closer = new Closer(myReg, invoker, name, idleTime);
closer.setDaemon(false);
closer.start();
}
}
Aggregations