Home
last modified time | relevance | path

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

123

/libcore/ojluni/src/main/java/java/util/
DTimer.java103 private final TaskQueue queue = new TaskQueue(); field in Timer
110 private final TimerThread thread = new TimerThread(queue);
119 private final TaskQueue queue; field in Timer.ThreadReaper
122 ThreadReaper(TaskQueue queue, TimerThread thread) { in ThreadReaper() argument
123 this.queue = queue; in ThreadReaper()
128 synchronized(queue) { in run()
130 queue.notify(); // In case queue is empty. in run()
191 var threadReaper = new ThreadReaper(queue, thread); in Timer()
414 synchronized(queue) { in sched()
427 queue.add(task); in sched()
[all …]
DPriorityQueue.java110 transient Object[] queue; // non-private to simplify nested class access field in PriorityQueue
182 this.queue = new Object[initialCapacity]; in PriorityQueue()
263 this.queue = ensureNonEmpty(c.toArray()); in initFromPriorityQueue()
279 this.queue = ensureNonEmpty(es); in initElementsFromCollection()
299 int oldCapacity = queue.length; in grow()
305 queue = Arrays.copyOf(queue, newCapacity); in grow()
335 if (i >= queue.length) in offer()
342 queue[0] = e; in offer()
354 return (E) queue[0];
359 final Object[] es = queue;
[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.java201 PriorityQueue<Object> queue = new PriorityQueue<Object>(); in test_Constructor() local
202 assertNotNull(queue); in test_Constructor()
203 assertEquals(0, queue.size()); in test_Constructor()
204 assertNull(queue.comparator()); in test_Constructor()
211 PriorityQueue<Object> queue = new PriorityQueue<Object>(100); in test_ConstructorI() local
212 assertNotNull(queue); in test_ConstructorI()
213 assertEquals(0, queue.size()); in test_ConstructorI()
214 assertNull(queue.comparator()); in test_ConstructorI()
221 PriorityQueue<Object> queue = new PriorityQueue<Object>(100, in test_ConstructorILjava_util_Comparator() local
223 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()
227 Reference(T referent, ReferenceQueue<? super T> queue) { in Reference() argument
229 this.queue = queue; in Reference()
DReferenceQueue.java239 ReferenceQueue queue = list.queue; in enqueuePending() local
240 if (queue == null || sun.misc.Cleaner.isCleanerQueue(queue)) { in enqueuePending()
246 if (queue != null) { in enqueuePending()
256 currentTarget = queue; in enqueuePending()
264 synchronized (queue.lock) { in enqueuePending()
269 queue.enqueueLocked(list); in enqueuePending()
271 } while (list != start && list.queue == queue && ++i < MAX_ITERS); in enqueuePending()
272 queue.lock.notifyAll(); in enqueuePending()
DCleaner.java153 private Cleaner(ReferenceQueue queue) { in Cleaner() argument
154 impl = new CleanerImpl(queue); in Cleaner()
219 Cleaner cleaner = new Cleaner(FinalizerReference.queue); in createSystemCleaner()
/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.java148 private transient Object[] queue; field in PriorityBlockingQueue
223 this.queue = new Object[Math.max(1, initialCapacity)]; in PriorityBlockingQueue()
270 this.queue = ensureNonEmpty(es); in PriorityBlockingQueue()
300 if (queue == array) in tryGrow()
309 if (newArray != null && queue == array) { in tryGrow()
310 queue = newArray; in tryGrow()
323 if ((result = (E) ((es = queue)[0])) != null) { in dequeue()
430 final Object[] es = queue; in heapify()
473 while ((n = size) >= (cap = (es = queue).length)) in offer()
563 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()
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()
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()
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()
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()
/libcore/ojluni/src/main/java/sun/util/locale/
DLocaleObjectCache.java41 private final ReferenceQueue<V> queue = new ReferenceQueue<>(); field in LocaleObjectCache
67 CacheEntry<K, V> newEntry = new CacheEntry<>(key, newVal, queue); in get()
83 CacheEntry<K, V> entry = new CacheEntry<>(key, value, queue); in put()
92 while ((entry = (CacheEntry<K, V>)queue.poll()) != null) { in cleanStaleEntries()
106 CacheEntry(K key, V value, ReferenceQueue<V> queue) { in CacheEntry() argument
107 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/jdk/internal/ref/
DCleanerImpl.java63 final ReferenceQueue<Object> queue; field in CleanerImpl
91 queue = new ReferenceQueue<>(); in CleanerImpl()
101 public CleanerImpl(ReferenceQueue<Object> queue) { in CleanerImpl() argument
102 this.queue = queue; in CleanerImpl()
174 Cleanable ref = (Cleanable) queue.remove(60 * 1000L); in run()
/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/src/main/java/sun/security/util/
DCache.java264 private final ReferenceQueue<V> queue; field in MemoryCache
274 this.queue = new ReferenceQueue<>(); in MemoryCache()
276 this.queue = null; in MemoryCache()
289 if (queue == null) { in emptyQueue()
295 CacheEntry<K,V> entry = (CacheEntry<K,V>)queue.poll(); in emptyQueue()
358 if (queue != null) { in clear()
364 while (queue.poll() != null) { in clear()
378 CacheEntry<K,V> newEntry = newEntry(key, value, expirationTime, queue); in put()
494 long expirationTime, ReferenceQueue<V> queue) { in newEntry() argument
495 if (queue != null) { in newEntry()
[all …]
/libcore/ojluni/src/test/java/util/Timer/
DNameConstructors.java47 LinkedTransferQueue<String> queue = new LinkedTransferQueue<>(); in test() local
51 queue.put(Thread.currentThread().getName()); in test()
56 String actual = queue.take(); in test()
/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;

123