List of usage examples for java.util.concurrent ArrayBlockingQueue ArrayBlockingQueue
public ArrayBlockingQueue(int capacity)
From source file:com.predic8.membrane.core.interceptor.xslt.XSLTTransformer.java
public XSLTTransformer(String styleSheet, final Router router, final int concurrency) throws Exception { this.styleSheet = styleSheet; log.debug("using " + concurrency + " parallel transformer instances for " + styleSheet); transformers = new ArrayBlockingQueue<Transformer>(concurrency); createOneTransformer(router.getResolverMap(), router.getBaseLocation()); router.getBackgroundInitializator().execute(new Runnable() { @Override//from w w w .j a v a 2 s . com public void run() { try { for (int i = 1; i < concurrency; i++) createOneTransformer(router.getResolverMap(), router.getBaseLocation()); } catch (Exception e) { log.error("Error creating XSLT transformer:", e); } } }); }
From source file:com.moilioncircle.redis.replicator.RedisAofReplicator.java
public RedisAofReplicator(InputStream in, Configuration configuration) { this.configuration = configuration; this.inputStream = new RedisInputStream(in, this.configuration.getBufferSize()); this.eventQueue = new ArrayBlockingQueue<>(this.configuration.getEventQueueSize()); this.replyParser = new ReplyParser(inputStream); builtInCommandParserRegister();/* w w w .j a v a 2 s.c o m*/ addExceptionListener(new DefaultExceptionListener()); }
From source file:edu.buffalo.fusim.BackgroundSelector.java
public BackgroundSelector(File backgroundFile, double rpkmCutoff, int threads) { this.queue = new ArrayBlockingQueue<TranscriptRecord>(1000); this.backgroundFile = backgroundFile; this.rpkmCutoff = rpkmCutoff; this.threads = threads; }
From source file:org.programmatori.domotica.own.emulator.SCSBus.java
public SCSBus() { setName("SCS Bus"); setDaemon(true);//from w ww .ja v a 2 s.c o m Config.getInstance().addThread(this); components = new ArrayList<SCSComponent>(); msgQueue = new ArrayBlockingQueue<MsgBus>(1); // On the bus only 1 msg can go //cmdQuit = false; ready = true; }
From source file:com.adobe.ags.curly.controller.BatchRunner.java
public BatchRunner(AuthHandler auth, int concurrency, List<Action> actions, List<Map<String, String>> batchData, Map<String, StringProperty> defaultValues, Set<String> displayColumns) { clientThread = ThreadLocal.withInitial(auth::getAuthenticatedClient); result = new BatchRunnerResult(); tasks = new ArrayBlockingQueue<>(batchData.size()); this.concurrency = concurrency; defaultValues.put("server", new ReadOnlyStringWrapper(auth.getUrlBase())); buildWorkerPool = () -> buildTasks(actions, batchData, defaultValues, displayColumns); }
From source file:org.apache.camel.impl.EventDrivenPollingConsumer.java
public EventDrivenPollingConsumer(Endpoint endpoint) { this(endpoint, new ArrayBlockingQueue<Exchange>(1000)); }
From source file:com.mapr.synth.drive.Trails.java
@Override public void setup() { ExecutorService pool = Executors.newFixedThreadPool(1); BlockingQueue<State> q = new ArrayBlockingQueue<>(2000); input = q;/* ww w.j a v a 2 s . co m*/ pool.submit(new Producer(q)); speedDistribution = new AVLTreeDigest(300); noise = new Random(); speed = new Stripchart(10, 430, 460, 80, 1, 0, 0, 90); rpm = new Stripchart(10, 520, 460, 80, 1, 0, 0, 2200); throttle = new Stripchart(10, 610, 460, 80, 1, 0, 0, 100); frameRate(15); }
From source file:com.streamsets.datacollector.event.handler.remote.RemoteStateEventListener.java
public void init() { pipelineStateQueue = new ArrayBlockingQueue<>(capacity); }
From source file:org.apache.drill.exec.ref.rse.QueueRSE.java
public QueueRSE(QueueRSEConfig engineConfig, DrillConfig dConfig) throws SetupException { this.dConfig = dConfig; sinkQueues = Collections.singletonList((Queue<Object>) (new ArrayBlockingQueue<Object>(100))); }
From source file:ai.susi.geo.GeoJsonReader.java
public GeoJsonReader(final InputStream is, final int concurrency) throws JsonParseException, IOException { this.concurrency = concurrency; this.featureQueue = new ArrayBlockingQueue<Feature>(Runtime.getRuntime().availableProcessors() * 2 + 1); JsonFactory factory = new JsonFactory(); this.parser = factory.createParser(is); }