@Override public void run() { executeReturnCode = execute(masterUri, hostName, nodeName, remappingArguments); if (executeReturnCode != SUCCESS) { onError(connectedNode, new Throwable(nodeName + " execution error code " + executeReturnCode)); } // node execution has finished so we propagate the shutdown sequence only if we aren't already shutting down for other reasons if (!shuttingDown) { connectedNode.shutdown(); } } }.start();
@Override public void onStart(final ConnectedNode connectedNode) { // retain important ROS info masterUri = connectedNode.getMasterUri().toString(); hostName = connectedNode.getUri().getHost(); nodeName = getDefaultNodeName().toString(); // create a new thread to execute the native code. new Thread() { @Override public void run() { executeReturnCode = execute(masterUri, hostName, nodeName, remappingArguments); if (executeReturnCode != SUCCESS) { onError(connectedNode, new Throwable(nodeName + " execution error code " + executeReturnCode)); } // node execution has finished so we propagate the shutdown sequence only if we aren't already shutting down for other reasons if (!shuttingDown) { connectedNode.shutdown(); } } }.start(); }