Search in sources :

Example 1 with DummyClientNodeImpl

use of org.evosuite.rmi.service.DummyClientNodeImpl in project evosuite by EvoSuite.

the class ClientServices method stopServices.

public void stopServices() {
    if (clientNode != null) {
        clientNode.stop();
        int i = 0;
        final int tries = 10;
        boolean done = false;
        try {
            while (!done) {
                /*
					 * A call from Master could still be active on this node. so we cannot
					 * forcely stop the client, we need to wait
					 */
                done = UnicastRemoteObject.unexportObject(clientNode, false);
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    break;
                }
                i++;
                if (i >= tries) {
                    logger.error("Tried " + tries + " times to stop RMI ClientNode, giving up");
                    break;
                }
            }
        } catch (NoSuchObjectException e) {
            // this could happen if Master has removed the registry
            logger.debug("Failed to delete ClientNode RMI instance", e);
        }
        clientNode = new DummyClientNodeImpl();
    }
}
Also used : DummyClientNodeImpl(org.evosuite.rmi.service.DummyClientNodeImpl) NoSuchObjectException(java.rmi.NoSuchObjectException)

Aggregations

NoSuchObjectException (java.rmi.NoSuchObjectException)1 DummyClientNodeImpl (org.evosuite.rmi.service.DummyClientNodeImpl)1