org.jbehave.web.selenium.DisplayIdPool Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jbehave-web-selenium Show documentation
Show all versions of jbehave-web-selenium Show documentation
Selenium and WebDriver API bindings for JBehave
The newest version!
package org.jbehave.web.selenium;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import static java.util.Arrays.asList;
public class DisplayIdPool {
private BlockingQueue queue;
public DisplayIdPool(String... displays) {
queue = new ArrayBlockingQueue(displays.length, false, asList(displays));
}
public String get() {
try {
return queue.take();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
public void returnToPool(String displayId) {
try {
queue.put(displayId);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}