Home
last modified time | relevance | path

Searched refs:queue (Results 1 – 25 of 45) sorted by relevance

12

/libcore/ojluni/src/main/java/java/util/
DTimer.java101 private final TaskQueue queue = new TaskQueue(); field in Timer
108 private final TimerThread thread = new TimerThread(queue);
120 synchronized(queue) {
122 queue.notify(); // In case queue is empty.
403 synchronized(queue) { in sched()
416 queue.add(task); in sched()
417 if (queue.getMin() == task) in sched()
418 queue.notify(); in sched()
437 synchronized(queue) { in cancel()
439 queue.clear(); in cancel()
[all …]
DPriorityQueue.java97 transient Object[] queue; // non-private to simplify nested class access field in PriorityQueue
168 this.queue = new Object[initialCapacity]; in PriorityQueue()
247 this.queue = c.toArray(); in initFromPriorityQueue()
264 this.queue = a; in initElementsFromCollection()
292 int oldCapacity = queue.length; in grow()
300 queue = Arrays.copyOf(queue, newCapacity); in grow()
338 if (i >= queue.length) in offer()
342 queue[0] = e; in offer()
350 return (size == 0) ? null : (E) queue[0]; in peek()
356 if (o.equals(queue[i])) in indexOf()
[all …]
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/
DAbstractQueueTest.java31 private MockAbstractQueue<Object> queue; field in AbstractQueueTest
113 queue.add(null); in test_addLE_null()
127 queue.add(o); in test_addLE_Full()
131 queue.add(o); in test_addLE_Full()
145 queue.add(o); in test_addLE()
148 queue.add(I); in test_addLE()
149 assertTrue(queue.contains(I)); in test_addLE()
150 Iterator iter = queue.iterator(); in test_addLE()
162 queue.addAll(null); in test_addAllLE_null()
175 queue.addAll(list); in test_addAllLE_with_null()
[all …]
DPriorityQueueTest.java198 PriorityQueue<Object> queue = new PriorityQueue<Object>(); in test_Constructor() local
199 assertNotNull(queue); in test_Constructor()
200 assertEquals(0, queue.size()); in test_Constructor()
201 assertNull(queue.comparator()); in test_Constructor()
208 PriorityQueue<Object> queue = new PriorityQueue<Object>(100); in test_ConstructorI() local
209 assertNotNull(queue); in test_ConstructorI()
210 assertEquals(0, queue.size()); in test_ConstructorI()
211 assertNull(queue.comparator()); in test_ConstructorI()
218 PriorityQueue<Object> queue = new PriorityQueue<Object>(100, in test_ConstructorILjava_util_Comparator() local
220 assertNotNull(queue); in test_ConstructorILjava_util_Comparator()
[all …]
/libcore/benchmarks/src/benchmarks/
DReferenceBenchmark.java34 ReferenceQueue<Object> queue = new ReferenceQueue<Object>(); in timeAlloc() local
36 new PhantomReference(object, queue); in timeAlloc()
42 ReferenceQueue<Object> queue = new ReferenceQueue<Object>(); in timeAllocAndEnqueue() local
44 (new PhantomReference<Object>(object, queue)).enqueue(); in timeAllocAndEnqueue()
50 ReferenceQueue<Object> queue = new ReferenceQueue<Object>(); in timeAllocEnqueueAndPoll() local
52 (new PhantomReference<Object>(object, queue)).enqueue(); in timeAllocEnqueueAndPoll()
55 queue.poll(); in timeAllocEnqueueAndPoll()
61 ReferenceQueue<Object> queue = new ReferenceQueue<Object>(); in timeAllocEnqueueAndRemove() local
63 (new PhantomReference<Object>(object, queue)).enqueue(); in timeAllocEnqueueAndRemove()
67 queue.remove(); in timeAllocEnqueueAndRemove()
[all …]
/libcore/ojluni/src/main/java/java/lang/ref/
DReference.java73 final ReferenceQueue<? super T> queue; field in Reference
189 return queue != null && queue.isEnqueued(this); in isEnqueued()
204 return queue != null && queue.enqueue(this); in enqueue()
213 Reference(T referent, ReferenceQueue<? super T> queue) { in Reference() argument
215 this.queue = queue; in Reference()
DReferenceQueue.java235 ReferenceQueue queue = list.queue; in enqueuePending() local
236 currentQueue = queue; in enqueuePending()
237 if (queue == null) { in enqueuePending()
253 synchronized (queue.lock) { in enqueuePending()
262 queue.enqueueLocked(list); in enqueuePending()
264 } while (list != start && list.queue == queue && ++i <= MAX_ITERS); in enqueuePending()
265 queue.lock.notifyAll(); in enqueuePending()
/libcore/ojluni/src/main/java/java/util/concurrent/
DScheduledThreadPoolExecutor.java932 private RunnableScheduledFuture<?>[] queue = field in ScheduledThreadPoolExecutor.DelayedWorkQueue
976 RunnableScheduledFuture<?> e = queue[parent]; in siftUp()
979 queue[k] = e; in siftUp()
983 queue[k] = key; in siftUp()
995 RunnableScheduledFuture<?> c = queue[child]; in siftDown()
997 if (right < size && c.compareTo(queue[right]) > 0) in siftDown()
998 c = queue[child = right]; in siftDown()
1001 queue[k] = c; in siftDown()
1005 queue[k] = key; in siftDown()
1013 int oldCapacity = queue.length; in grow()
[all …]
DPriorityBlockingQueue.java155 private transient Object[] queue; field in PriorityBlockingQueue
229 this.queue = new Object[Math.max(1, initialCapacity)]; in PriorityBlockingQueue()
276 this.queue = ensureNonEmpty(es); in PriorityBlockingQueue()
311 if (newCap > oldCap && queue == array) in tryGrow()
320 if (newArray != null && queue == array) { in tryGrow()
321 queue = newArray; in tryGrow()
334 if ((result = (E) ((es = queue)[0])) != null) { in dequeue()
441 final Object[] es = queue; in heapify()
484 while ((n = size) >= (cap = (es = queue).length)) in offer()
574 return (E) queue[0]; in peek()
[all …]
/libcore/luni/src/test/java/libcore/java/util/
DOldPriorityQueueTest.java28 PriorityQueue<Object> queue = new PriorityQueue<Object>(100); in test_ConstructorI() local
29 assertNotNull(queue); in test_ConstructorI()
30 assertEquals(0, queue.size()); in test_ConstructorI()
31 assertNull(queue.comparator()); in test_ConstructorI()
42 PriorityQueue<String> queue = new PriorityQueue<String>(10, in test_remove_Ljava_lang_Object_using_comparator() local
46 queue.offer(array[i]); in test_remove_Ljava_lang_Object_using_comparator()
48 assertFalse(queue.contains("BB")); in test_remove_Ljava_lang_Object_using_comparator()
51 assertFalse(queue.remove("BB")); in test_remove_Ljava_lang_Object_using_comparator()
52 assertTrue(queue.remove("AA")); in test_remove_Ljava_lang_Object_using_comparator()
/libcore/luni/src/test/java/libcore/java/util/concurrent/
DLinkedTransferQueueTest.java33 LinkedTransferQueue<Integer> queue = new LinkedTransferQueue<>(); in testForEach() local
35 queue.add(Integer.valueOf(i+1)); in testForEach()
38 queue.forEach((Integer x) -> adder.add(x.longValue())); in testForEach()
40 assertEquals(queue.size() * (queue.size() + 1) / 2, adder.sum()); in testForEach()
DConcurrentLinkedQueueTest.java33 ConcurrentLinkedQueue<Integer> queue = new ConcurrentLinkedQueue<>(); in testForEach() local
35 queue.add(Integer.valueOf(i+1)); in testForEach()
38 queue.forEach((Integer x) -> adder.add(x.longValue())); in testForEach()
40 assertEquals(queue.size() * (queue.size() + 1) / 2, adder.sum()); in testForEach()
DPriorityBlockingQueueTest.java33 PriorityBlockingQueue<Integer> queue = new PriorityBlockingQueue<>(capacity); in testForEach() local
35 queue.add(Integer.valueOf(i+1)); in testForEach()
38 queue.forEach((Integer x) -> adder.add(x.longValue())); in testForEach()
40 assertEquals(queue.size() * (queue.size() + 1) / 2, adder.sum()); in testForEach()
DLinkedBlockingQueueTest.java33 LinkedBlockingQueue<Integer> queue = new LinkedBlockingQueue<>(); in testForEach() local
35 queue.add(Integer.valueOf(i+1)); in testForEach()
38 queue.forEach((Integer x) -> adder.add(x.longValue())); in testForEach()
40 assertEquals(queue.size() * (queue.size() + 1) / 2, adder.sum()); in testForEach()
DArrayBlockingQueueTest.java33 ArrayBlockingQueue<Integer> queue = new ArrayBlockingQueue<>(capacity); in testForEach() local
35 queue.add(Integer.valueOf(i+1)); in testForEach()
38 queue.forEach((Integer x) -> adder.add(x.longValue())); in testForEach()
40 assertEquals(queue.size() * (queue.size() + 1) / 2, adder.sum()); in testForEach()
/libcore/ojluni/src/main/java/sun/util/locale/
DLocaleObjectCache.java41 private ReferenceQueue<V> queue = new ReferenceQueue<>(); field in LocaleObjectCache
69 CacheEntry<K, V> newEntry = new CacheEntry<>(key, newVal, queue); in get()
86 CacheEntry<K, V> entry = new CacheEntry<>(key, value, queue); in put()
95 while ((entry = (CacheEntry<K, V>)queue.poll()) != null) { in cleanStaleEntries()
109 CacheEntry(K key, V value, ReferenceQueue<V> queue) { in CacheEntry() argument
110 super(value, queue); in CacheEntry()
/libcore/ojluni/src/test/java/lang/ref/
DEnqueuePollRaceTest.java45 ReferenceQueue<Object> queue = new ReferenceQueue<Object>(); field in EnqueuePollRaceTest.WeakRef
52 queue = new ReferenceQueue<Object>(); in run()
55 refs[j] = new WeakReference(new Object(), queue); in run()
67 while (queue.poll() != null) { in run()
DReferenceEnqueuePendingTest.java121 private static NumberedWeakReference waitForReference(ReferenceQueue<Integer> queue) { in waitForReference() argument
123 return (NumberedWeakReference) queue.remove(30000); // 30sec in waitForReference()
129 private static void checkResult(ReferenceQueue<Integer> queue, in checkResult() argument
136 NumberedWeakReference weakRead = waitForReference(queue); in checkResult()
141 weakRead = waitForReference(queue); in checkResult()
143 weakRead = (NumberedWeakReference) queue.poll(); in checkResult()
/libcore/ojluni/src/main/java/sun/security/util/
DCache.java258 private final ReferenceQueue<V> queue; field in MemoryCache
268 this.queue = new ReferenceQueue<>(); in MemoryCache()
270 this.queue = null; in MemoryCache()
284 if (queue == null) { in emptyQueue()
290 CacheEntry<K,V> entry = (CacheEntry<K,V>)queue.poll(); in emptyQueue()
347 if (queue != null) { in clear()
353 while (queue.poll() != null) { in clear()
364 CacheEntry<K,V> newEntry = newEntry(key, value, expirationTime, queue); in put()
460 long expirationTime, ReferenceQueue<V> queue) { in newEntry() argument
461 if (queue != null) { in newEntry()
[all …]
/libcore/ojluni/src/main/java/sun/nio/ch/
DEPollPort.java79 private final ArrayBlockingQueue<Event> queue; field in EPollPort
108 this.queue = new ArrayBlockingQueue<Event>(MAX_EPOLL_EVENTS); in EPollPort()
109 this.queue.offer(NEED_TO_POLL); in EPollPort()
217 queue.offer(EXECUTE_TASK_OR_SHUTDOWN); in poll()
231 queue.offer(ev); in poll()
244 queue.offer(NEED_TO_POLL); in poll()
262 ev = queue.take(); in run()
DFileLockTable.java92 ReferenceQueue<FileLock> queue, in FileLockReference() argument
94 super(referent, queue); in FileLockReference()
110 private static ReferenceQueue<FileLock> queue = new ReferenceQueue<FileLock>(); field in SharedFileLockTable
137 list.add(new FileLockReference(fl, queue, fileKey)); in add()
153 list.add(new FileLockReference(fl, queue, fileKey)); in add()
240 list.set(index, new FileLockReference(toLock, queue, fileKey)); in replace()
262 while ((ref = (FileLockReference)queue.poll()) != null) { in removeStaleEntries()
/libcore/ojluni/annotations/hiddenapi/java/lang/ref/
DReference.java38 Reference(T referent, java.lang.ref.ReferenceQueue<? super T> queue) { in Reference() argument
71 final java.lang.ref.ReferenceQueue<? super T> queue; field in Reference
74 queue = null;
/libcore/ojluni/annotations/hiddenapi/sun/security/util/
DMemoryCache.java77 K key, V value, long expirationTime, java.lang.ref.ReferenceQueue<V> queue) { in newEntry() argument
95 private final java.lang.ref.ReferenceQueue<V> queue; field in MemoryCache
98 queue = null;
150 SoftCacheEntry(K key, V value, long expirationTime, java.lang.ref.ReferenceQueue<V> queue) { in SoftCacheEntry() argument
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ref/
DReferenceTest.java181 ReferenceQueue<Object> queue = new ReferenceQueue<Object>(); in test_get_WeakReference() local
183 r = newWeakReference(queue); in test_get_WeakReference()
185 Reference ref = queue.remove(); in test_get_WeakReference()
190 r = newWeakReference(queue); in test_get_WeakReference()
197 ref = queue.poll(); in test_get_WeakReference()
288 private WeakReference<Object> newWeakReference(ReferenceQueue<Object> queue) { in newWeakReference() argument
290 WeakReference<Object> ref = new WeakReference<Object>(o, queue); in newWeakReference()
/libcore/luni/src/test/java/libcore/java/lang/ref/
DReferenceQueueTest.java151 private void enqueueLater(final ReferenceQueue<Object> queue, long delayMillis) { in enqueueLater() argument
154 enqueue(queue); in enqueueLater()
159 private void enqueue(ReferenceQueue<Object> queue) { in enqueue() argument
160 new WeakReference<Object>(new Object(), queue).enqueue(); in enqueue()

12