private void addPendingMessage(@Nullable Message message, long when) { pendingMessages.put(new PendingMessage(message, when)); }
/** * Asynchronously decompresses WAL segment which is present only in .zip file. * * @return Future which is completed once file is decompressed. */ synchronized IgniteInternalFuture<Void> decompressFile(long idx) { if (decompressionFutures.containsKey(idx)) return decompressionFutures.get(idx); File f = new File(walArchiveDir, FileDescriptor.fileName(idx)); if (f.exists()) return new GridFinishedFuture<>(); segmentsQueue.put(idx); GridFutureAdapter<Void> res = new GridFutureAdapter<>(); decompressionFutures.put(idx, res); return res; }
/** */ private void shutdown() { synchronized (this) { U.cancel(this); // Put fake -1 to wake thread from queue.take() segmentsQueue.put(-1L); } U.join(this, log); }
private void addPendingMessage(@Nullable Message message, long when) { pendingMessages.put(new PendingMessage(message, when)); }
@Override public void enqueueLog(Path log) { String logPrefix = AbstractFSWALProvider.getWALPrefixFromWALName(log.getName()); PriorityBlockingQueue<Path> queue = queues.get(logPrefix); if (queue == null) { queue = new PriorityBlockingQueue<>(queueSizePerGroup, new LogsComparator()); // make sure that we do not use an empty queue when setting up a ReplicationSource, otherwise // the shipper may quit immediately queue.put(log); queues.put(logPrefix, queue); if (this.isSourceActive() && this.walEntryFilter != null) { // new wal group observed after source startup, start a new worker thread to track it // notice: it's possible that log enqueued when this.running is set but worker thread // still not launched, so it's necessary to check workerThreads before start the worker tryStartNewShipper(logPrefix, queue); } } else { queue.put(log); } this.metrics.incrSizeOfLogQueue(); // This will log a warning for each new log that gets created above the warn threshold int queueSize = queue.size(); if (queueSize > this.logQueueWarnThreshold) { LOG.warn("WAL group " + logPrefix + " queue size: " + queueSize + " exceeds value of replication.source.log.queue.warn: " + logQueueWarnThreshold); } }
@Test public void testRecoveredReplicationSourceShipperGetPosition() throws Exception { String walGroupId = "fake-wal-group-id"; ServerName serverName = ServerName.valueOf("www.example.com", 12006, 1524679704418L); ServerName deadServer = ServerName.valueOf("www.deadServer.com", 12006, 1524679704419L); PriorityBlockingQueue<Path> queue = new PriorityBlockingQueue<>(); queue.put(new Path("/www/html/test")); RecoveredReplicationSource source = Mockito.mock(RecoveredReplicationSource.class); Server server = Mockito.mock(Server.class); Mockito.when(server.getServerName()).thenReturn(serverName); Mockito.when(source.getServer()).thenReturn(server); Mockito.when(source.getServerWALsBelongTo()).thenReturn(deadServer); ReplicationQueueStorage storage = Mockito.mock(ReplicationQueueStorage.class); Mockito.when(storage.getWALPosition(Mockito.eq(serverName), Mockito.any(), Mockito.any())) .thenReturn(1001L); Mockito.when(storage.getWALPosition(Mockito.eq(deadServer), Mockito.any(), Mockito.any())) .thenReturn(-1L); conf.setInt("replication.source.maxretriesmultiplier", -1); RecoveredReplicationSourceShipper shipper = new RecoveredReplicationSourceShipper(conf, walGroupId, queue, source, storage); Assert.assertEquals(1001L, shipper.getStartPosition()); conf.unset("replication.source.maxretriesmultiplier"); } }
/** * OpenJDK put(o) calls offer(o), so use offer(o) to avoid dup stamping. * Non blocking. Does not add if full. * @deprecated use offer(o) */ @Deprecated @Override public void put(E o) { timestamp(o); super.put(o); }
public void enqueue(StreamMessage message) { messageQueue.put(message); }
public void enqueue(StreamMessage message) { messageQueue.put(message); }
private synchronized void startSplit(PrioritizedSplitRunner split) { allSplits.add(split); pendingSplits.put(split); }
public void watch(MailActivation activation) throws InterruptedException { long now = System.currentTimeMillis(); activation.updateNextNewMsgCheckTime(now); pollQueue.put(activation); }
@Override public void run() { blockedSplits.remove(split); split.updatePriorityLevel(); pendingSplits.put(split); } }, executor);
@Override public void put(T e) { this.delegate.put(this.wrap(e)); }
public void put(E e) { queue.put(new QueueEntry<E>(e)); }
@Override public void run() { try { container = CramSerilization.convert(records, samFileHeader, source, lossyOptions); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ContainerIO.writeContainer(cramVersion, container, baos); bytes = baos.toByteArray(); batchResultQueue.put(this); } catch (Exception e) { exceptionInWorker(e); } }
@Override public void enqueueLog(Path log) { this.queue.put(log); this.metrics.sizeOfLogQueue.set(queue.size()); }
/** */ private void shutdown() { synchronized (this) { U.cancel(this); // Put fake -1 to wake thread from queue.take() segmentsQueue.put(-1L); } U.join(this, log); } }
/** */ private void shutdown() { synchronized (this) { U.cancel(this); // Put fake -1 to wake thread from queue.take() segmentsQueue.put(-1L); } U.join(this, log); } }