Here are the examples of the java api class java.util.concurrent.BlockingQueue taken from open source projects.
1. PriorityBlockingQueueTest#testRemainingCapacity()
Project: openjdk
File: PriorityBlockingQueueTest.java
File: PriorityBlockingQueueTest.java
/** * remainingCapacity() always returns Integer.MAX_VALUE */ public void testRemainingCapacity() { BlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(Integer.MAX_VALUE, q.remainingCapacity()); assertEquals(SIZE - i, q.size()); assertEquals(i, q.remove()); } for (int i = 0; i < SIZE; ++i) { assertEquals(Integer.MAX_VALUE, q.remainingCapacity()); assertEquals(i, q.size()); assertTrue(q.add(i)); } }
2. LinkedTransferQueueTest#testRemainingCapacity()
Project: openjdk
File: LinkedTransferQueueTest.java
File: LinkedTransferQueueTest.java
/** * remainingCapacity() always returns Integer.MAX_VALUE */ public void testRemainingCapacity() { BlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(Integer.MAX_VALUE, q.remainingCapacity()); assertEquals(SIZE - i, q.size()); assertEquals(i, q.remove()); } for (int i = 0; i < SIZE; ++i) { assertEquals(Integer.MAX_VALUE, q.remainingCapacity()); assertEquals(i, q.size()); assertTrue(q.add(i)); } }
3. LinkedBlockingQueueTest#testRemainingCapacity()
Project: openjdk
File: LinkedBlockingQueueTest.java
File: LinkedBlockingQueueTest.java
/** * remainingCapacity decreases on add, increases on remove */ public void testRemainingCapacity() { BlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.remainingCapacity()); assertEquals(SIZE, q.size() + q.remainingCapacity()); assertEquals(i, q.remove()); } for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE - i, q.remainingCapacity()); assertEquals(SIZE, q.size() + q.remainingCapacity()); assertTrue(q.add(i)); } }
4. LinkedBlockingDequeTest#testRemainingCapacity()
Project: openjdk
File: LinkedBlockingDequeTest.java
File: LinkedBlockingDequeTest.java
/** * remainingCapacity decreases on add, increases on remove */ public void testRemainingCapacity() { BlockingQueue q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.remainingCapacity()); assertEquals(SIZE, q.size() + q.remainingCapacity()); assertEquals(i, q.remove()); } for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE - i, q.remainingCapacity()); assertEquals(SIZE, q.size() + q.remainingCapacity()); assertTrue(q.add(i)); } }
5. DelayQueueTest#testRemainingCapacity()
Project: openjdk
File: DelayQueueTest.java
File: DelayQueueTest.java
/** * remainingCapacity() always returns Integer.MAX_VALUE */ public void testRemainingCapacity() { BlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(Integer.MAX_VALUE, q.remainingCapacity()); assertEquals(SIZE - i, q.size()); assertTrue(q.remove() instanceof PDelay); } for (int i = 0; i < SIZE; ++i) { assertEquals(Integer.MAX_VALUE, q.remainingCapacity()); assertEquals(i, q.size()); assertTrue(q.add(new PDelay(i))); } }
6. BlockingQueueTest#testTimedPollFromEmptyAfterInterrupt()
Project: openjdk
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * timed poll() throws InterruptedException immediately if * interrupted before waiting */ public void testTimedPollFromEmptyAfterInterrupt() { final BlockingQueue q = emptyCollection(); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { Thread.currentThread().interrupt(); try { q.poll(2 * LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); } }); awaitTermination(t); }
7. BlockingQueueTest#testTimedPollFromEmptyBlocksInterruptibly()
Project: openjdk
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * timed poll() blocks interruptibly when empty */ public void testTimedPollFromEmptyBlocksInterruptibly() { final BlockingQueue q = emptyCollection(); final CountDownLatch threadStarted = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { threadStarted.countDown(); try { q.poll(2 * LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); } }); await(threadStarted); assertThreadStaysAlive(t); t.interrupt(); awaitTermination(t); }
8. BlockingQueueTest#testTakeFromEmptyAfterInterrupt()
Project: openjdk
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * take() throws InterruptedException immediately if interrupted * before waiting */ public void testTakeFromEmptyAfterInterrupt() { final BlockingQueue q = emptyCollection(); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { Thread.currentThread().interrupt(); try { q.take(); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); } }); awaitTermination(t); }
9. BlockingQueueTest#testTakeFromEmptyBlocksInterruptibly()
Project: openjdk
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * take() blocks interruptibly when empty */ public void testTakeFromEmptyBlocksInterruptibly() { final BlockingQueue q = emptyCollection(); final CountDownLatch threadStarted = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { threadStarted.countDown(); try { q.take(); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); } }); await(threadStarted); assertThreadStaysAlive(t); t.interrupt(); awaitTermination(t); }
10. BlockingQueueTest#testDrainToNonPositiveMaxElements()
Project: openjdk
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * drainTo(c, n) returns 0 and does nothing when n <= 0 */ public void testDrainToNonPositiveMaxElements() { final BlockingQueue q = emptyCollection(); final int[] ns = { 0, -1, -42, Integer.MIN_VALUE }; for (int n : ns) assertEquals(0, q.drainTo(new ArrayList(), n)); if (q.remainingCapacity() > 0) { // Not SynchronousQueue, that is Object one = makeElement(1); q.add(one); ArrayList c = new ArrayList(); for (int n : ns) assertEquals(0, q.drainTo(new ArrayList(), n)); assertEquals(1, q.size()); assertSame(one, q.poll()); assertTrue(c.isEmpty()); } }
11. ArrayBlockingQueueTest#testRemainingCapacity()
Project: openjdk
File: ArrayBlockingQueueTest.java
File: ArrayBlockingQueueTest.java
/** * remainingCapacity decreases on add, increases on remove */ public void testRemainingCapacity() { BlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.remainingCapacity()); assertEquals(SIZE, q.size() + q.remainingCapacity()); assertEquals(i, q.remove()); } for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE - i, q.remainingCapacity()); assertEquals(SIZE, q.size() + q.remainingCapacity()); assertTrue(q.add(i)); } }
12. ZeroCoreThreads#test()
Project: openjdk
File: ZeroCoreThreads.java
File: ZeroCoreThreads.java
void test(ScheduledThreadPoolExecutor p) throws Throwable { Runnable dummy = new Runnable() { public void run() { throw new AssertionError("shouldn't get here"); } }; BlockingQueue q = p.getQueue(); ReentrantLock lock = getField(q, "lock"); Condition available = getField(q, "available"); equal(0, p.getPoolSize()); equal(0, p.getLargestPoolSize()); equal(0L, p.getTaskCount()); equal(0L, p.getCompletedTaskCount()); p.schedule(dummy, 1L, HOURS); // Ensure one pool thread actually waits in timed queue poll awaitHasWaiters(lock, available, LONG_DELAY_MS); equal(1, p.getPoolSize()); equal(1, p.getLargestPoolSize()); equal(1L, p.getTaskCount()); equal(0L, p.getCompletedTaskCount()); }
13. PollMemoryLeak#main()
Project: openjdk
File: PollMemoryLeak.java
File: PollMemoryLeak.java
public static void main(String[] args) throws InterruptedException { final BlockingQueue[] qs = { new LinkedBlockingQueue(10), new LinkedTransferQueue(), new ArrayBlockingQueue(10), new SynchronousQueue(), new SynchronousQueue(true) }; final long start = System.currentTimeMillis(); final long end = start + 10 * 1000; while (System.currentTimeMillis() < end) for (BlockingQueue q : qs) q.poll(1, TimeUnit.NANOSECONDS); }
14. LinkedTransferQueueTest#testRemainingCapacity()
Project: mapdb
File: LinkedTransferQueueTest.java
File: LinkedTransferQueueTest.java
/** * remainingCapacity() always returns Integer.MAX_VALUE */ public void testRemainingCapacity() { BlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(Integer.MAX_VALUE, q.remainingCapacity()); assertEquals(SIZE - i, q.size()); assertEquals(i, q.remove()); } for (int i = 0; i < SIZE; ++i) { assertEquals(Integer.MAX_VALUE, q.remainingCapacity()); assertEquals(i, q.size()); assertTrue(q.add(i)); } }
15. LinkedBlockingQueueTest#testRemainingCapacity()
Project: mapdb
File: LinkedBlockingQueueTest.java
File: LinkedBlockingQueueTest.java
/** * remainingCapacity decreases on add, increases on remove */ public void testRemainingCapacity() { BlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.remainingCapacity()); assertEquals(SIZE, q.size() + q.remainingCapacity()); assertEquals(i, q.remove()); } for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE - i, q.remainingCapacity()); assertEquals(SIZE, q.size() + q.remainingCapacity()); assertTrue(q.add(i)); } }
16. LinkedBlockingDequeTest#testRemainingCapacity()
Project: mapdb
File: LinkedBlockingDequeTest.java
File: LinkedBlockingDequeTest.java
/** * remainingCapacity decreases on add, increases on remove */ public void testRemainingCapacity() { BlockingQueue q = populatedDeque(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.remainingCapacity()); assertEquals(SIZE, q.size() + q.remainingCapacity()); assertEquals(i, q.remove()); } for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE - i, q.remainingCapacity()); assertEquals(SIZE, q.size() + q.remainingCapacity()); assertTrue(q.add(i)); } }
17. BlockingQueueTest#testTimedPollFromEmptyAfterInterrupt()
Project: mapdb
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * timed poll() throws InterruptedException immediately if * interrupted before waiting */ public void testTimedPollFromEmptyAfterInterrupt() { final BlockingQueue q = emptyCollection(); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { Thread.currentThread().interrupt(); try { q.poll(2 * LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); } }); awaitTermination(t); }
18. BlockingQueueTest#testTimedPollFromEmptyBlocksInterruptibly()
Project: mapdb
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * timed poll() blocks interruptibly when empty */ public void testTimedPollFromEmptyBlocksInterruptibly() { final BlockingQueue q = emptyCollection(); final CountDownLatch threadStarted = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { threadStarted.countDown(); try { q.poll(2 * LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); } }); await(threadStarted); assertThreadStaysAlive(t); t.interrupt(); awaitTermination(t); }
19. BlockingQueueTest#testTakeFromEmptyAfterInterrupt()
Project: mapdb
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * take() throws InterruptedException immediately if interrupted * before waiting */ public void testTakeFromEmptyAfterInterrupt() { final BlockingQueue q = emptyCollection(); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { Thread.currentThread().interrupt(); try { q.take(); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); } }); awaitTermination(t); }
20. BlockingQueueTest#testTakeFromEmptyBlocksInterruptibly()
Project: mapdb
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * take() blocks interruptibly when empty */ public void testTakeFromEmptyBlocksInterruptibly() { final BlockingQueue q = emptyCollection(); final CountDownLatch threadStarted = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { threadStarted.countDown(); try { q.take(); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); } }); await(threadStarted); assertThreadStaysAlive(t); t.interrupt(); awaitTermination(t); }
21. BlockingQueueTest#testDrainToNonPositiveMaxElements()
Project: mapdb
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/* * drainTo(c, n) returns 0 and does nothing when n <= 0 */ public void testDrainToNonPositiveMaxElements() { final BlockingQueue q = emptyCollection(); final int[] ns = { 0, -1, -42, Integer.MIN_VALUE }; for (int n : ns) assertEquals(0, q.drainTo(new ArrayList(), n)); if (q.remainingCapacity() > 0) { // Not SynchronousQueue, that is Object one = makeElement(1); q.add(one); ArrayList c = new ArrayList(); for (int n : ns) assertEquals(0, q.drainTo(new ArrayList(), n)); assertEquals(1, q.size()); assertSame(one, q.poll()); assertTrue(c.isEmpty()); } }
22. ArrayBlockingQueueTest#testRemainingCapacity()
Project: mapdb
File: ArrayBlockingQueueTest.java
File: ArrayBlockingQueueTest.java
/** * remainingCapacity decreases on add, increases on remove */ public void testRemainingCapacity() { BlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.remainingCapacity()); assertEquals(SIZE, q.size() + q.remainingCapacity()); assertEquals(i, q.remove()); } for (int i = 0; i < SIZE; ++i) { assertEquals(SIZE - i, q.remainingCapacity()); assertEquals(SIZE, q.size() + q.remainingCapacity()); assertTrue(q.add(i)); } }
23. SaslTransportPlugin#getServer()
Project: jstorm
File: SaslTransportPlugin.java
File: SaslTransportPlugin.java
@Override public TServer getServer(TProcessor processor) throws IOException, TTransportException { int port = type.getPort(storm_conf); TTransportFactory serverTransportFactory = getServerTransportFactory(); TServerSocket serverTransport = new TServerSocket(port); int numWorkerThreads = type.getNumThreads(storm_conf); Integer queueSize = type.getQueueSize(storm_conf); TThreadPoolServer.Args server_args = new TThreadPoolServer.Args(serverTransport).processor(new TUGIWrapProcessor(processor)).minWorkerThreads(numWorkerThreads).maxWorkerThreads(numWorkerThreads).protocolFactory(new TBinaryProtocol.Factory(false, true)); if (serverTransportFactory != null) { server_args.transportFactory(serverTransportFactory); } BlockingQueue workQueue = new SynchronousQueue(); if (queueSize != null) { workQueue = new ArrayBlockingQueue(queueSize); } ThreadPoolExecutor executorService = new ExtendedThreadPoolExecutor(numWorkerThreads, numWorkerThreads, 60, TimeUnit.SECONDS, workQueue); server_args.executorService(executorService); return new TThreadPoolServer(server_args); }
24. LinkedTransferQueueTest#testRemainingCapacity()
Project: j2objc
File: LinkedTransferQueueTest.java
File: LinkedTransferQueueTest.java
/** * remainingCapacity() always returns Integer.MAX_VALUE */ public void testRemainingCapacity() { BlockingQueue q = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { assertEquals(Integer.MAX_VALUE, q.remainingCapacity()); assertEquals(SIZE - i, q.size()); assertEquals(i, q.remove()); } for (int i = 0; i < SIZE; ++i) { assertEquals(Integer.MAX_VALUE, q.remainingCapacity()); assertEquals(i, q.size()); assertTrue(q.add(i)); } }
25. BlockingQueueTest#testTimedPollFromEmptyAfterInterrupt()
Project: j2objc
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * timed poll() throws InterruptedException immediately if * interrupted before waiting */ public void testTimedPollFromEmptyAfterInterrupt() { final BlockingQueue q = emptyCollection(); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { Thread.currentThread().interrupt(); try { q.poll(2 * LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); } }); awaitTermination(t); }
26. BlockingQueueTest#testTimedPollFromEmptyBlocksInterruptibly()
Project: j2objc
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * timed poll() blocks interruptibly when empty */ public void testTimedPollFromEmptyBlocksInterruptibly() { final BlockingQueue q = emptyCollection(); final CountDownLatch threadStarted = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { threadStarted.countDown(); try { q.poll(2 * LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); } }); await(threadStarted); assertThreadStaysAlive(t); t.interrupt(); awaitTermination(t); }
27. BlockingQueueTest#testTakeFromEmptyAfterInterrupt()
Project: j2objc
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * take() throws InterruptedException immediately if interrupted * before waiting */ public void testTakeFromEmptyAfterInterrupt() { final BlockingQueue q = emptyCollection(); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { Thread.currentThread().interrupt(); try { q.take(); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); } }); awaitTermination(t); }
28. BlockingQueueTest#testTakeFromEmptyBlocksInterruptibly()
Project: j2objc
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * take() blocks interruptibly when empty */ public void testTakeFromEmptyBlocksInterruptibly() { final BlockingQueue q = emptyCollection(); final CountDownLatch threadStarted = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() { threadStarted.countDown(); try { q.take(); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); } }); await(threadStarted); assertThreadStaysAlive(t); t.interrupt(); awaitTermination(t); }
29. BlockingQueueTest#testDrainToNonPositiveMaxElements()
Project: j2objc
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * drainTo(c, n) returns 0 and does nothing when n <= 0 */ public void testDrainToNonPositiveMaxElements() { final BlockingQueue q = emptyCollection(); final int[] ns = { 0, -1, -42, Integer.MIN_VALUE }; for (int n : ns) assertEquals(0, q.drainTo(new ArrayList(), n)); if (q.remainingCapacity() > 0) { // Not SynchronousQueue, that is Object one = makeElement(1); q.add(one); ArrayList c = new ArrayList(); for (int n : ns) assertEquals(0, q.drainTo(new ArrayList(), n)); assertEquals(1, q.size()); assertSame(one, q.poll()); assertTrue(c.isEmpty()); } }
30. ZkTestHelper#tryWaitZkEventsCleaned()
Project: helix
File: ZkTestHelper.java
File: ZkTestHelper.java
public static boolean tryWaitZkEventsCleaned(ZkClient zkclient) throws Exception { java.lang.reflect.Field field = getField(zkclient.getClass(), "_eventThread"); field.setAccessible(true); Object eventThread = field.get(zkclient); // System.out.println("field: " + eventThread); java.lang.reflect.Field field2 = getField(eventThread.getClass(), "_events"); field2.setAccessible(true); BlockingQueue queue = (BlockingQueue) field2.get(eventThread); if (queue == null) { LOG.error("fail to get event-queue from zkclient. skip waiting"); return false; } for (int i = 0; i < 20; i++) { if (queue.size() == 0) { return true; } Thread.sleep(100); System.out.println("pending zk-events in queue: " + queue); } return false; }
31. BytesBoundedLinkedQueueTest#testPoll()
Project: druid
File: BytesBoundedLinkedQueueTest.java
File: BytesBoundedLinkedQueueTest.java
@Test public void testPoll() throws InterruptedException { final BlockingQueue q = getQueue(10); long startTime = System.nanoTime(); Assert.assertNull(q.poll(delayMS, TimeUnit.MILLISECONDS)); Assert.assertTrue(TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime) >= delayMS); TestObject obj = new TestObject(2); Assert.assertTrue(q.offer(obj, delayMS, TimeUnit.MILLISECONDS)); Assert.assertSame(obj, q.poll(delayMS, TimeUnit.MILLISECONDS)); Thread.currentThread().interrupt(); try { q.poll(delayMS, TimeUnit.MILLISECONDS); throw new ISE("FAIL"); } catch (InterruptedException success) { } Assert.assertFalse(Thread.interrupted()); }
32. WaterMarkRejectionHandler#rejectedExecution()
Project: axis2-transports
File: WaterMarkRejectionHandler.java
File: WaterMarkRejectionHandler.java
public void rejectedExecution(Runnable runnable, ThreadPoolExecutor threadPoolExecutor) { BlockingQueue q = threadPoolExecutor.getQueue(); if (q instanceof WaterMarkQueue) { WaterMarkQueue wq = (WaterMarkQueue) q; if (!wq.offerAfter(runnable)) { if (rejectedExecutionHandler != null) { rejectedExecutionHandler.rejectedExecution(runnable, threadPoolExecutor); } } } }
33. WaterMarkRejectionHandler#rejectedExecution()
Project: axis2-java
File: WaterMarkRejectionHandler.java
File: WaterMarkRejectionHandler.java
public void rejectedExecution(Runnable runnable, ThreadPoolExecutor threadPoolExecutor) { BlockingQueue q = threadPoolExecutor.getQueue(); if (q instanceof WaterMarkQueue) { WaterMarkQueue wq = (WaterMarkQueue) q; if (!wq.offerAfter(runnable)) { if (rejectedExecutionHandler != null) { rejectedExecutionHandler.rejectedExecution(runnable, threadPoolExecutor); } } } }
34. RemoteClientDataTypesTest#testDataTypesMapAndEvents()
Project: Chronicle-Engine
File: RemoteClientDataTypesTest.java
File: RemoteClientDataTypesTest.java
@Test public void testDataTypesMapAndEvents() throws InterruptedException { YamlLogging.setAll(false); BlockingQueue valueSubscriptionQueue = new ArrayBlockingQueue<>(1); BlockingQueue eventSubscriptionQueue = new ArrayBlockingQueue<>(1); BlockingQueue topicSubscriptionQueue = new ArrayBlockingQueue<>(1); BlockingQueue topicOnlySubscriptionQueue = new ArrayBlockingQueue<>(1); Map testMap = _clientAssetTree.acquireMap(_mapUri, _keyClass, _valueClass); //Check that the store is empty int size = testMap.size(); Assert.assertEquals(0, size); String subscriberMapUri = _mapUri + "?bootstrap=false"; String valueOnlySubscriberUri = _mapUri + "/" + _key.toString() + "?bootstrap=false"; //Register all types of subscribers _clientAssetTree.registerTopicSubscriber(subscriberMapUri, _keyClass, _valueClass, ( t, v) -> topicSubscriptionQueue.add(v)); _clientAssetTree.registerSubscriber(subscriberMapUri, _keyClass, topicOnlySubscriptionQueue::add); _clientAssetTree.registerSubscriber(subscriberMapUri, MapEvent.class, mapEvent -> mapEvent.apply(( assetName, key, oldValue, newValue) -> eventSubscriptionQueue.add(newValue))); _clientAssetTree.registerSubscriber(valueOnlySubscriberUri, _valueClass, valueSubscriptionQueue::add); //put the kvp testMap.put(_key, _value); //Get the value back and check that it is the same Object valueGet = testMap.get(_key); Assert.assertEquals(_value, valueGet); int timeout = 200; Assert.assertEquals(_value, valueSubscriptionQueue.poll(timeout, TimeUnit.MILLISECONDS)); Assert.assertEquals(_value, eventSubscriptionQueue.poll(timeout, TimeUnit.MILLISECONDS)); Assert.assertEquals(_value, topicSubscriptionQueue.poll(timeout, TimeUnit.MILLISECONDS)); Assert.assertEquals(_key, topicOnlySubscriptionQueue.poll(timeout, TimeUnit.MILLISECONDS)); }
35. ExecutorImpl#size()
Project: servicemix-utils
File: ExecutorImpl.java
File: ExecutorImpl.java
public int size() { BlockingQueue queue = threadPool.getQueue(); return queue.size(); }
36. ExecutorImpl#capacity()
Project: servicemix-utils
File: ExecutorImpl.java
File: ExecutorImpl.java
public int capacity() { BlockingQueue queue = threadPool.getQueue(); return queue.remainingCapacity() + queue.size(); }
37. StreamTest#testStreamPersistence()
Project: orbit
File: StreamTest.java
File: StreamTest.java
@SuppressWarnings("Duplicates") @Test(timeout = 30_000L) public void testStreamPersistence() throws InterruptedException { final Stage stage1 = createStage(); // forces the stream to be created in the fist stage. AsyncStream.getStream(String.class, "test").publish("data").join(); // create a second stage from which the stream is going to be used createStage(); AsyncStream<String> test = AsyncStream.getStream(String.class, "test"); BlockingQueue queue = new LinkedBlockingQueue<>(); test.subscribe(( msg, t) -> { queue.add(msg); return Task.done(); }).join(); test.publish("hello"); assertEquals("hello", queue.poll(10, TimeUnit.SECONDS)); // Stopping the first stage, the stream should migrate on the next post. stage1.stop().join(); test.publish("hello2"); assertEquals("hello2", queue.poll(5, TimeUnit.SECONDS)); dumpMessages(); }
38. LinkedTransferQueueTest#testBlockingTake()
Project: openjdk
File: LinkedTransferQueueTest.java
File: LinkedTransferQueueTest.java
/** * take removes existing elements until empty, then blocks interruptibly */ public void testBlockingTake() throws InterruptedException { final BlockingQueue q = populatedQueue(SIZE); final CountDownLatch pleaseInterrupt = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.take()); } Thread.currentThread().interrupt(); try { q.take(); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); pleaseInterrupt.countDown(); try { q.take(); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); } }); await(pleaseInterrupt); assertThreadStaysAlive(t); t.interrupt(); awaitTermination(t); }
39. LinkedBlockingQueueTest#testBlockingTake()
Project: openjdk
File: LinkedBlockingQueueTest.java
File: LinkedBlockingQueueTest.java
/** * Take removes existing elements until empty, then blocks interruptibly */ public void testBlockingTake() throws InterruptedException { final BlockingQueue q = populatedQueue(SIZE); final CountDownLatch pleaseInterrupt = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.take()); } Thread.currentThread().interrupt(); try { q.take(); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); pleaseInterrupt.countDown(); try { q.take(); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); } }); await(pleaseInterrupt); assertThreadStaysAlive(t); t.interrupt(); awaitTermination(t); }
40. BlockingQueueTest#testRemoveElement()
Project: openjdk
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * remove(x) removes x and returns true if present * TODO: move to superclass CollectionTest.java */ public void testRemoveElement() { final BlockingQueue q = emptyCollection(); final int size = Math.min(q.remainingCapacity(), SIZE); final Object[] elts = new Object[size]; assertFalse(q.contains(makeElement(99))); assertFalse(q.remove(makeElement(99))); checkEmpty(q); for (int i = 0; i < size; i++) q.add(elts[i] = makeElement(i)); for (int i = 1; i < size; i += 2) { for (int pass = 0; pass < 2; pass++) { assertEquals((pass == 0), q.contains(elts[i])); assertEquals((pass == 0), q.remove(elts[i])); assertFalse(q.contains(elts[i])); assertTrue(q.contains(elts[i - 1])); if (i < size - 1) assertTrue(q.contains(elts[i + 1])); } } if (size > 0) assertTrue(q.contains(elts[0])); for (int i = size - 2; i >= 0; i -= 2) { assertTrue(q.contains(elts[i])); assertFalse(q.contains(elts[i + 1])); assertTrue(q.remove(elts[i])); assertFalse(q.contains(elts[i])); assertFalse(q.remove(elts[i + 1])); assertFalse(q.contains(elts[i + 1])); } checkEmpty(q); }
41. BlockingQueueTest#testTimedPollWithOffer()
Project: openjdk
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * timed poll before a delayed offer times out; after offer succeeds; * on interruption throws */ public void testTimedPollWithOffer() throws InterruptedException { final BlockingQueue q = emptyCollection(); final CheckedBarrier barrier = new CheckedBarrier(2); final Object zero = makeElement(0); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { long startTime = System.nanoTime(); assertNull(q.poll(timeoutMillis(), MILLISECONDS)); assertTrue(millisElapsedSince(startTime) >= timeoutMillis()); barrier.await(); assertSame(zero, q.poll(LONG_DELAY_MS, MILLISECONDS)); Thread.currentThread().interrupt(); try { q.poll(LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); barrier.await(); try { q.poll(LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); } }); barrier.await(); long startTime = System.nanoTime(); assertTrue(q.offer(zero, LONG_DELAY_MS, MILLISECONDS)); assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); barrier.await(); assertThreadStaysAlive(t); t.interrupt(); awaitTermination(t); }
42. BlockingQueueTest#testDrainToSelfN()
Project: openjdk
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * drainTo(this, n) throws IllegalArgumentException */ public void testDrainToSelfN() { final BlockingQueue q = emptyCollection(); try { q.drainTo(q, 0); shouldThrow(); } catch (IllegalArgumentException success) { } }
43. BlockingQueueTest#testDrainToNullN()
Project: openjdk
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * drainTo(null, n) throws NullPointerException */ public void testDrainToNullN() { final BlockingQueue q = emptyCollection(); try { q.drainTo(null, 0); shouldThrow(); } catch (NullPointerException success) { } }
44. BlockingQueueTest#testDrainToSelf()
Project: openjdk
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * drainTo(this) throws IllegalArgumentException */ public void testDrainToSelf() { final BlockingQueue q = emptyCollection(); try { q.drainTo(q); shouldThrow(); } catch (IllegalArgumentException success) { } }
45. BlockingQueueTest#testDrainToNull()
Project: openjdk
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * drainTo(null) throws NullPointerException */ public void testDrainToNull() { final BlockingQueue q = emptyCollection(); try { q.drainTo(null); shouldThrow(); } catch (NullPointerException success) { } }
46. BlockingQueueTest#testPutNull()
Project: openjdk
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * put(null) throws NullPointerException */ public void testPutNull() throws InterruptedException { final BlockingQueue q = emptyCollection(); try { q.put(null); shouldThrow(); } catch (NullPointerException success) { } }
47. BlockingQueueTest#testTimedOfferNull()
Project: openjdk
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * timed offer(null) throws NullPointerException */ public void testTimedOfferNull() throws InterruptedException { final BlockingQueue q = emptyCollection(); long startTime = System.nanoTime(); try { q.offer(null, LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); }
48. LinkedTransferQueueTest#testBlockingTake()
Project: mapdb
File: LinkedTransferQueueTest.java
File: LinkedTransferQueueTest.java
/** * take removes existing elements until empty, then blocks interruptibly */ public void testBlockingTake() throws InterruptedException { final BlockingQueue q = populatedQueue(SIZE); final CountDownLatch pleaseInterrupt = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.take()); } Thread.currentThread().interrupt(); try { q.take(); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); pleaseInterrupt.countDown(); try { q.take(); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); } }); await(pleaseInterrupt); assertThreadStaysAlive(t); t.interrupt(); awaitTermination(t); }
49. LinkedBlockingQueueTest#testBlockingTake()
Project: mapdb
File: LinkedBlockingQueueTest.java
File: LinkedBlockingQueueTest.java
/** * Take removes existing elements until empty, then blocks interruptibly */ public void testBlockingTake() throws InterruptedException { final BlockingQueue q = populatedQueue(SIZE); final CountDownLatch pleaseInterrupt = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.take()); } Thread.currentThread().interrupt(); try { q.take(); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); pleaseInterrupt.countDown(); try { q.take(); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); } }); await(pleaseInterrupt); assertThreadStaysAlive(t); t.interrupt(); awaitTermination(t); }
50. BlockingQueueTest#testRemoveElement()
Project: mapdb
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * remove(x) removes x and returns true if present * */ public void testRemoveElement() { final BlockingQueue q = emptyCollection(); final int size = Math.min(q.remainingCapacity(), SIZE); final Object[] elts = new Object[size]; assertFalse(q.contains(makeElement(99))); assertFalse(q.remove(makeElement(99))); checkEmpty(q); for (int i = 0; i < size; i++) q.add(elts[i] = makeElement(i)); for (int i = 1; i < size; i += 2) { for (int pass = 0; pass < 2; pass++) { assertEquals((pass == 0), q.contains(elts[i])); assertEquals((pass == 0), q.remove(elts[i])); assertFalse(q.contains(elts[i])); assertTrue(q.contains(elts[i - 1])); if (i < size - 1) assertTrue(q.contains(elts[i + 1])); } } if (size > 0) assertTrue(q.contains(elts[0])); for (int i = size - 2; i >= 0; i -= 2) { assertTrue(q.contains(elts[i])); assertFalse(q.contains(elts[i + 1])); assertTrue(q.remove(elts[i])); assertFalse(q.contains(elts[i])); assertFalse(q.remove(elts[i + 1])); assertFalse(q.contains(elts[i + 1])); } checkEmpty(q); }
51. BlockingQueueTest#testTimedPollWithOffer()
Project: mapdb
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * timed poll before a delayed offer times out; after offer succeeds; * on interruption throws */ public void testTimedPollWithOffer() throws InterruptedException { final BlockingQueue q = emptyCollection(); final CheckedBarrier barrier = new CheckedBarrier(2); final Object zero = makeElement(0); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { long startTime = System.nanoTime(); assertNull(q.poll(timeoutMillis(), MILLISECONDS)); assertTrue(millisElapsedSince(startTime) >= timeoutMillis()); barrier.await(); assertSame(zero, q.poll(LONG_DELAY_MS, MILLISECONDS)); Thread.currentThread().interrupt(); try { q.poll(LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); barrier.await(); try { q.poll(LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); } }); barrier.await(); long startTime = System.nanoTime(); assertTrue(q.offer(zero, LONG_DELAY_MS, MILLISECONDS)); assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); barrier.await(); assertThreadStaysAlive(t); t.interrupt(); awaitTermination(t); }
52. BlockingQueueTest#testDrainToSelfN()
Project: mapdb
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * drainTo(this, n) throws IllegalArgumentException */ public void testDrainToSelfN() { final BlockingQueue q = emptyCollection(); try { q.drainTo(q, 0); shouldThrow(); } catch (IllegalArgumentException success) { } }
53. BlockingQueueTest#testDrainToNullN()
Project: mapdb
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * drainTo(null, n) throws NullPointerException */ public void testDrainToNullN() { final BlockingQueue q = emptyCollection(); try { q.drainTo(null, 0); shouldThrow(); } catch (NullPointerException success) { } }
54. BlockingQueueTest#testDrainToSelf()
Project: mapdb
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * drainTo(this) throws IllegalArgumentException */ public void testDrainToSelf() { final BlockingQueue q = emptyCollection(); try { q.drainTo(q); shouldThrow(); } catch (IllegalArgumentException success) { } }
55. BlockingQueueTest#testDrainToNull()
Project: mapdb
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * drainTo(null) throws NullPointerException */ public void testDrainToNull() { final BlockingQueue q = emptyCollection(); try { q.drainTo(null); shouldThrow(); } catch (NullPointerException success) { } }
56. BlockingQueueTest#testPutNull()
Project: mapdb
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * put(null) throws NullPointerException */ public void testPutNull() throws InterruptedException { final BlockingQueue q = emptyCollection(); try { q.put(null); shouldThrow(); } catch (NullPointerException success) { } }
57. BlockingQueueTest#testTimedOfferNull()
Project: mapdb
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * timed offer(null) throws NullPointerException */ public void testTimedOfferNull() throws InterruptedException { final BlockingQueue q = emptyCollection(); long startTime = System.nanoTime(); try { q.offer(null, LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); }
58. LinkedTransferQueueTest#testBlockingTake()
Project: j2objc
File: LinkedTransferQueueTest.java
File: LinkedTransferQueueTest.java
/** * take removes existing elements until empty, then blocks interruptibly */ public void testBlockingTake() throws InterruptedException { final BlockingQueue q = populatedQueue(SIZE); final CountDownLatch pleaseInterrupt = new CountDownLatch(1); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { for (int i = 0; i < SIZE; ++i) { assertEquals(i, q.take()); } Thread.currentThread().interrupt(); try { q.take(); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); pleaseInterrupt.countDown(); try { q.take(); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); } }); await(pleaseInterrupt); assertThreadStaysAlive(t); t.interrupt(); awaitTermination(t); }
59. BlockingQueueTest#testRemoveElement()
Project: j2objc
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * remove(x) removes x and returns true if present * TODO: move to superclass CollectionTest.java */ public void testRemoveElement() { final BlockingQueue q = emptyCollection(); final int size = Math.min(q.remainingCapacity(), SIZE); final Object[] elts = new Object[size]; assertFalse(q.contains(makeElement(99))); assertFalse(q.remove(makeElement(99))); checkEmpty(q); for (int i = 0; i < size; i++) q.add(elts[i] = makeElement(i)); for (int i = 1; i < size; i += 2) { for (int pass = 0; pass < 2; pass++) { assertEquals((pass == 0), q.contains(elts[i])); assertEquals((pass == 0), q.remove(elts[i])); assertFalse(q.contains(elts[i])); assertTrue(q.contains(elts[i - 1])); if (i < size - 1) assertTrue(q.contains(elts[i + 1])); } } if (size > 0) assertTrue(q.contains(elts[0])); for (int i = size - 2; i >= 0; i -= 2) { assertTrue(q.contains(elts[i])); assertFalse(q.contains(elts[i + 1])); assertTrue(q.remove(elts[i])); assertFalse(q.contains(elts[i])); assertFalse(q.remove(elts[i + 1])); assertFalse(q.contains(elts[i + 1])); } checkEmpty(q); }
60. BlockingQueueTest#testTimedPollWithOffer()
Project: j2objc
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * timed poll before a delayed offer times out; after offer succeeds; * on interruption throws */ public void testTimedPollWithOffer() throws InterruptedException { final BlockingQueue q = emptyCollection(); final CheckedBarrier barrier = new CheckedBarrier(2); final Object zero = makeElement(0); Thread t = newStartedThread(new CheckedRunnable() { public void realRun() throws InterruptedException { long startTime = System.nanoTime(); assertNull(q.poll(timeoutMillis(), MILLISECONDS)); assertTrue(millisElapsedSince(startTime) >= timeoutMillis()); barrier.await(); assertSame(zero, q.poll(LONG_DELAY_MS, MILLISECONDS)); Thread.currentThread().interrupt(); try { q.poll(LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); barrier.await(); try { q.poll(LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (InterruptedException success) { } assertFalse(Thread.interrupted()); } }); barrier.await(); long startTime = System.nanoTime(); assertTrue(q.offer(zero, LONG_DELAY_MS, MILLISECONDS)); assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); barrier.await(); assertThreadStaysAlive(t); t.interrupt(); awaitTermination(t); }
61. BlockingQueueTest#testDrainToSelfN()
Project: j2objc
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * drainTo(this, n) throws IllegalArgumentException */ public void testDrainToSelfN() { final BlockingQueue q = emptyCollection(); try { q.drainTo(q, 0); shouldThrow(); } catch (IllegalArgumentException success) { } }
62. BlockingQueueTest#testDrainToNullN()
Project: j2objc
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * drainTo(null, n) throws NullPointerException */ public void testDrainToNullN() { final BlockingQueue q = emptyCollection(); try { q.drainTo(null, 0); shouldThrow(); } catch (NullPointerException success) { } }
63. BlockingQueueTest#testDrainToSelf()
Project: j2objc
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * drainTo(this) throws IllegalArgumentException */ public void testDrainToSelf() { final BlockingQueue q = emptyCollection(); try { q.drainTo(q); shouldThrow(); } catch (IllegalArgumentException success) { } }
64. BlockingQueueTest#testDrainToNull()
Project: j2objc
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * drainTo(null) throws NullPointerException */ public void testDrainToNull() { final BlockingQueue q = emptyCollection(); try { q.drainTo(null); shouldThrow(); } catch (NullPointerException success) { } }
65. BlockingQueueTest#testPutNull()
Project: j2objc
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * put(null) throws NullPointerException */ public void testPutNull() throws InterruptedException { final BlockingQueue q = emptyCollection(); try { q.put(null); shouldThrow(); } catch (NullPointerException success) { } }
66. BlockingQueueTest#testTimedOfferNull()
Project: j2objc
File: BlockingQueueTest.java
File: BlockingQueueTest.java
/** * timed offer(null) throws NullPointerException */ public void testTimedOfferNull() throws InterruptedException { final BlockingQueue q = emptyCollection(); long startTime = System.nanoTime(); try { q.offer(null, LONG_DELAY_MS, MILLISECONDS); shouldThrow(); } catch (NullPointerException success) { } assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); }
67. SaslTransportPlugin#getServer()
Project: apache-storm-test
File: SaslTransportPlugin.java
File: SaslTransportPlugin.java
@Override public TServer getServer(TProcessor processor) throws IOException, TTransportException { int port = type.getPort(storm_conf); TTransportFactory serverTransportFactory = getServerTransportFactory(); TServerSocket serverTransport = new TServerSocket(port); int numWorkerThreads = type.getNumThreads(storm_conf); Integer queueSize = type.getQueueSize(storm_conf); TThreadPoolServer.Args server_args = new TThreadPoolServer.Args(serverTransport).processor(new TUGIWrapProcessor(processor)).minWorkerThreads(numWorkerThreads).maxWorkerThreads(numWorkerThreads).protocolFactory(new TBinaryProtocol.Factory(false, true)); if (serverTransportFactory != null) { server_args.transportFactory(serverTransportFactory); } BlockingQueue workQueue = new SynchronousQueue(); if (queueSize != null) { workQueue = new ArrayBlockingQueue(queueSize); } ThreadPoolExecutor executorService = new ExtendedThreadPoolExecutor(numWorkerThreads, numWorkerThreads, 60, TimeUnit.SECONDS, workQueue); server_args.executorService(executorService); return new TThreadPoolServer(server_args); }