/** * Runs this {@link Robot} by checking its queue for a new wavelet and then * processing this wavelet. In the end the {@link Robot} will check whether it * needs to requeue itself in the RobotGateway or that no further actions need * to be taken. */ @Override public void run() { try { LOG.fine(robotName + " called for processing"); WaveletAndDeltas wavelet = dequeueWavelet(); if (wavelet == null) { gateway.doneRunning(this); return; } process(wavelet); } catch (RuntimeException e) { LOG.severe("Unexpected error occurred when robot " + robotName + " was called", e); } // Requeue since we either had an exception or we processed a wavelet. gateway.doneRunning(this); gateway.ensureScheduled(this); }