Trying to avoid thread deadlock when testing

This commit is contained in:
4pr0n 2015-02-06 10:01:03 -08:00
parent 9967332057
commit c2bb65bc60
4 changed files with 7 additions and 10 deletions

View File

@ -1,4 +1,3 @@
language: java language: java
jdk: jdk:
- oraclejdk8
- oraclejdk7 - oraclejdk7

View File

@ -52,7 +52,6 @@ public abstract class AbstractRipper
} }
protected void stopCheck() throws IOException { protected void stopCheck() throws IOException {
if (shouldStop) { if (shouldStop) {
threadPool.waitForThreads();
throw new IOException("Ripping interrupted"); throw new IOException("Ripping interrupted");
} }
} }

View File

@ -148,17 +148,16 @@ public class VkRipper extends AlbumRipper {
} }
String url = photoIDsToURLs.get(photoID); String url = photoIDsToURLs.get(photoID);
addURLToDownload(new URL(url)); addURLToDownload(new URL(url));
}
logger.info("Received " + elements.size() + " elements");
if (elements.size() < 40) {
break;
}
offset += elements.size();
if (isStopped() || isThisATest()) { if (isStopped() || isThisATest()) {
break; break;
} }
} }
if (elements.size() < 40 || isStopped() || isThisATest()) {
break;
}
offset += elements.size();
}
waitForThreads(); waitForThreads();
} }

View File

@ -15,8 +15,8 @@ public class VkRipperTest extends RippersTest {
} }
List<URL> contentURLs = new ArrayList<URL>(); List<URL> contentURLs = new ArrayList<URL>();
contentURLs.add(new URL("https://vk.com/album45506334_172415053")); contentURLs.add(new URL("https://vk.com/album45506334_172415053"));
//contentURLs.add(new URL("https://vk.com/album45506334_0")); contentURLs.add(new URL("https://vk.com/album45506334_0"));
//contentURLs.add(new URL("https://vk.com/photos45506334")); contentURLs.add(new URL("https://vk.com/photos45506334"));
for (URL url : contentURLs) { for (URL url : contentURLs) {
VkRipper ripper = new VkRipper(url); VkRipper ripper = new VkRipper(url);
testRipper(ripper); testRipper(ripper);