+ // SERVICE METHODS
+ //
+
+ /**
+ * {@inheritdoc}
+ *
+ * @see de.ina.util.service.AbstractService#serviceRun()
+ */
+ @Override
+ protected void serviceRun() {
+ while (!shouldStop()) {
+ Page nextPage = null;
+ synchronized (syncObject) {
+ while (!shouldStop() && pages.isEmpty()) {
+ try {
+ syncObject.wait();
+ } catch (InterruptedException ie1) {
+ /* ignore. */
+ }
+ }
+ if (!shouldStop()) {
+ nextPage = pages.remove(0);
+ }
+ }
+ if (shouldStop()) {
+ break;
+ }
+ URL nextURL = createURL(nextPage);
+ if (nextURL == null) {
+ logger.log(Level.INFO, "Skipping “" + nextPage + "”.");
+ continue;
+ }
+ URLFetcher urlFetcher = new URLFetcher(this, nextURL);
+ urlFetcherExecutor.execute(urlFetcher);
+ }
+ }
+
+ //