public void stopServer() { try { registry.unbind(SERVICE_NAME); UnicastRemoteObject.unexportObject(registry, true); } catch (Exception e) { e.printStackTrace(); } }
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(); } }
protected void disable() { try { registry.unbind("Server"); } catch (RemoteException | NotBoundException e) { catcher.catchException(e); } }
public void stop() { try { registry.unbind("RemoteBindingObject"); } catch (Exception ex) { log.error("Could not unbind RemoteBindingObject", ex); } log.info("stopped"); }
/* (non-Javadoc) * @see org.objectweb.proactive.core.remoteobject.RemoteObjectFactory#unregister(java.net.URI) */ public void unregister(URI url) throws ProActiveException { try { Registry reg = getRegistry(url); reg.unbind(URIBuilder.getNameFromURI(url)); LOGGER_RO.debug(url + " unbound in registry"); } catch (IOException e) { // No need to throw an exception if an object is already unregistered LOGGER_RO.warn(url + " is not bound in the registry "); } catch (Exception e) { throw new ProActiveException(e); } }
/** Stops the server. */ @CommandArgument public void stop() { try { Registry registry = getRegistry(); registry.unbind("AuthenticationService"); this.jobProgressStates = null; System.out.println("Server stopped"); } catch (Exception e) { logger.error("An error occurred while stopping the server", e); System.err.println("Server did not shut down cleanly, see log for details."); } }
public void run() { // idle do { sleepEL(idleTime); } while (invoker.lastAccess() + idleTime > System.currentTimeMillis()); try { reg.unbind(name); UnicastRemoteObject.unexportObject(invoker, true); } catch (Throwable t) { t.printStackTrace(); } }
/* * Called by: * - ClientJMeterEngine.exe() which is called on remoteStop */ @Override public void rexit() throws RemoteException { log.info("Exitting"); backingEngine.exit(); // Tidy up any objects we created Registry reg = LocateRegistry.getRegistry(this.rmiPort); try { reg.unbind(JMETER_ENGINE_RMI_NAME); } catch (NotBoundException e) { log.warn(JMETER_ENGINE_RMI_NAME + " is not bound", e); } log.info("Unbound from registry"); // Help with garbage control JMeterUtils.helpGC(); }