All Downloads are FREE. Search and download functionalities are using the official Maven repository.

us.codecraft.webmagic.scripts.ScriptEnginePool Maven / Gradle / Ivy

There is a newer version: 1.0.1
Show newest version
package us.codecraft.webmagic.scripts;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author [email protected]
 * @since 0.4.1
 */
public class ScriptEnginePool {

    private final int size;

    private final AtomicInteger availableCount;

    private final LinkedBlockingQueue scriptEngines = new LinkedBlockingQueue();

    public ScriptEnginePool(Language language,int size) {
        this.size = size;
        this.availableCount = new AtomicInteger(size);
        for (int i=0;i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy