List of usage examples for java.util.concurrent ConcurrentLinkedQueue ConcurrentLinkedQueue
public ConcurrentLinkedQueue()
From source file:org.ramidore.logic.system.GuildBattleLogLogic.java
/** * . */ public GuildBattleLogLogic() { logDataQ = new ConcurrentLinkedQueue<>(); }
From source file:org.geowebcache.seed.JobMonitorTask.java
public JobMonitorTask(JobStore js, TileBreeder seeder, long updateFrequency, String purgeJobTaskSchedule) { this.jobStore = js; this.seeder = seeder; this.updateFrequency = updateFrequency; this.purgeJobTaskSchedule = purgeJobTaskSchedule; this.finishedTasks = new ConcurrentLinkedQueue<GWCTask>(); super.taskType = GWCTask.TYPE.JOB_MONITOR; }
From source file:org.apache.streams.kafka.KafkaPersistWriter.java
public KafkaPersistWriter() { Config config = StreamsConfigurator.config.getConfig("kafka"); this.config = KafkaConfigurator.detectConfiguration(config); this.persistQueue = new ConcurrentLinkedQueue<StreamsDatum>(); }
From source file:raptor.speech.ProcessSpeech.java
public ProcessSpeech(String command) { this.command = command; speakQueue = new ConcurrentLinkedQueue<String>(); }
From source file:org.apache.hadoop.hbase.io.hfile.slab.Slab.java
Slab(int blockSize, int numBlocks) { buffers = new LinkedBlockingQueue<ByteBuffer>(); slabs = new ConcurrentLinkedQueue<ByteBuffer>(); this.blockSize = blockSize; this.numBlocks = numBlocks; this.heapSize = ClassSize.estimateBase(this.getClass(), false); int maxBlocksPerSlab = Integer.MAX_VALUE / blockSize; int maxSlabSize = maxBlocksPerSlab * blockSize; int numFullSlabs = numBlocks / maxBlocksPerSlab; int partialSlabSize = (numBlocks % maxBlocksPerSlab) * blockSize; for (int i = 0; i < numFullSlabs; i++) { allocateAndSlice(maxSlabSize, blockSize); }//from w w w.j av a2s . c o m if (partialSlabSize > 0) { allocateAndSlice(partialSlabSize, blockSize); } }
From source file:com.siemens.sw360.fossology.ssh.JSchSessionProvider.java
@Autowired public JSchSessionProvider(FossologySettings fossologySettings, FossologyHostKeyRepository fossologyHostKeyRepository) { this.fossologyHostKeyRepository = fossologyHostKeyRepository; userName = fossologySettings.getFossologySshUsername(); hostName = fossologySettings.getFossologyHost(); hostPort = fossologySettings.getFossologyPort(); addIdentity(userName, fossologySettings.getFossologyPrivateKey()); sessions = new ConcurrentLinkedQueue<>(); }
From source file:org.panbox.desktop.common.vfs.backend.VirtualMultiuserRootFile.java
VirtualMultiuserRootFile(String sid) { super(File.separator + sid, null); this.sid = sid; this.userShares = new ConcurrentLinkedQueue<>(); }
From source file:de.ep3.ftpc.model.CrawlerThread.java
public CrawlerThread(Crawler crawler, I18nManager i18n) { this.crawler = crawler; this.i18n = i18n; crawlerResults = new Vector<>(); messageQueue = new ConcurrentLinkedQueue<>(); setDaemon(true);/*from ww w .j a v a 2 s .c o m*/ start(); }
From source file:org.nuxeo.ecm.core.event.pipe.QueueBaseEventBundlePipe.java
@Override public void initPipe(String name, Map<String, String> params) { super.initPipe(name, params); stop = false;/*from w w w. j a va 2 s.co m*/ if (params.containsKey("batchSize")) { try { batchSize = Integer.parseInt(params.get(batchSize)); } catch (NumberFormatException e) { log.error("Unable to read batchSize parameter", e); } } queue = new ConcurrentLinkedQueue<>(); consumerTPE = new ThreadPoolExecutor(1, 1, 60, TimeUnit.MINUTES, new LinkedBlockingQueue<>()); consumerTPE.prestartCoreThread(); consumerTPE.execute(new Runnable() { private boolean send(List<EventBundle> messages) { if (consumer.receiveMessage(messages)) { messages.clear(); return true; } // keep the events that can not be processed ? queue.addAll(messages); return false; } @Override public void run() { consumer = new LocalEventBundlePipeConsumer(); consumer.initConsumer(getName(), getParameters()); boolean interrupted = false; try { while (!stop) { List<EventBundle> messages = new ArrayList<>(); EventBundle message; while ((message = queue.poll()) != null) { messages.add(message); if (messages.size() >= batchSize) { send(messages); } } if (messages.size() > 0) { send(messages); } // XXX this is a hack ! TODO: find a better approach try { if (Framework.isTestModeSet()) { Thread.sleep(5); } else { Thread.sleep(200); } } catch (InterruptedException e) { interrupted = true; } } } finally { if (interrupted) { Thread.currentThread().interrupt(); } } } }); consumerTPE.shutdown(); }