Home
last modified time | relevance | path

Searched refs:task (Results 1 – 25 of 37) sorted by relevance

12

/libcore/jsr166-tests/src/test/java/jsr166/
DFutureTaskTest.java259 PublicFutureTask task = new PublicFutureTask(new NoOpCallable()); in testIsDone() local
260 assertFalse(task.isDone()); in testIsDone()
261 task.run(); in testIsDone()
262 assertTrue(task.isDone()); in testIsDone()
263 checkCompletedNormally(task, Boolean.TRUE); in testIsDone()
264 assertEquals(1, task.runCount()); in testIsDone()
271 PublicFutureTask task = new PublicFutureTask(new NoOpCallable()); in testRunAndReset() local
273 assertTrue(task.runAndReset()); in testRunAndReset()
274 checkNotDone(task); in testRunAndReset()
275 assertEquals(i + 1, task.runCount()); in testRunAndReset()
[all …]
DScheduledExecutorSubclassTest.java53 RunnableScheduledFuture<V> task; field in ScheduledExecutorSubclassTest.CustomTask
55 CustomTask(RunnableScheduledFuture<V> t) { task = t; } in CustomTask()
56 public boolean isPeriodic() { return task.isPeriodic(); } in isPeriodic()
59 task.run(); in run()
61 public long getDelay(TimeUnit unit) { return task.getDelay(unit); } in getDelay()
63 return task.compareTo(((CustomTask)t).task); in compareTo()
66 return task.cancel(mayInterruptIfRunning); in cancel()
68 public boolean isCancelled() { return task.isCancelled(); } in isCancelled()
69 public boolean isDone() { return task.isDone(); } in isDone()
71 V v = task.get(); in get()
[all …]
DScheduledExecutorTest.java56 final Runnable task = new CheckedRunnable() { in testExecute() local
58 p.execute(task); in testExecute()
71 Callable task = new CheckedCallable<Boolean>() { in testSchedule1() local
77 Future f = p.schedule(task, timeoutMillis(), MILLISECONDS); in testSchedule1()
92 Runnable task = new CheckedRunnable() { in testSchedule3() local
97 Future f = p.schedule(task, timeoutMillis(), MILLISECONDS); in testSchedule3()
112 Runnable task = new CheckedRunnable() { in testSchedule4() local
118 p.scheduleAtFixedRate(task, timeoutMillis(), in testSchedule4()
134 Runnable task = new CheckedRunnable() { in testSchedule5() local
140 p.scheduleWithFixedDelay(task, timeoutMillis(), in testSchedule5()
[all …]
DExecutorsTest.java206 final Runnable task = new CheckedRunnable() { in testNewSingleThreadScheduledExecutor() local
211 Future f = p.schedule(Executors.callable(task, Boolean.TRUE), in testNewSingleThreadScheduledExecutor()
230 final Runnable task = new CheckedRunnable() { in testNewScheduledThreadPool() local
235 Future f = p.schedule(Executors.callable(task, Boolean.TRUE), in testNewScheduledThreadPool()
256 final Runnable task = new CheckedRunnable() { in testUnconfigurableScheduledExecutorService() local
261 Future f = p.schedule(Executors.callable(task, Boolean.TRUE), in testUnconfigurableScheduledExecutorService()
453 Callable task = Executors.privilegedCallable(new CheckCCL()); in testPrivilegedCallableWithNoPrivs()
455 task.call(); in testPrivilegedCallableWithNoPrivs()
/libcore/ojluni/src/main/java/java/util/concurrent/
DExecutorCompletionService.java115 QueueingFuture(RunnableFuture<V> task, in QueueingFuture() argument
117 super(task, null); in QueueingFuture()
118 this.task = task; in QueueingFuture()
121 private final Future<V> task; field in ExecutorCompletionService.QueueingFuture
123 protected void done() { completionQueue.add(task); } in done()
126 private RunnableFuture<V> newTaskFor(Callable<V> task) { in newTaskFor() argument
128 return new FutureTask<V>(task); in newTaskFor()
130 return aes.newTaskFor(task); in newTaskFor()
133 private RunnableFuture<V> newTaskFor(Runnable task, V result) { in newTaskFor() argument
135 return new FutureTask<V>(task, result); in newTaskFor()
[all …]
DExecutors.java381 public static <T> Callable<T> callable(Runnable task, T result) { in callable() argument
382 if (task == null) in callable()
384 return new RunnableAdapter<T>(task, result); in callable()
394 public static Callable<Object> callable(Runnable task) { in callable() argument
395 if (task == null) in callable()
397 return new RunnableAdapter<Object>(task, null); in callable()
455 private final Runnable task;
457 RunnableAdapter(Runnable task, T result) {
458 this.task = task;
462 task.run();
[all …]
DForkJoinPool.java870 final void push(ForkJoinTask<?> task) { in push() argument
874 a[(al - 1) & s] = task; // relaxed writes OK in push()
1004 final boolean tryUnpush(ForkJoinTask<?> task) { in tryUnpush() argument
1009 if (U.compareAndSwapObject(a, offset, task, null)) { in tryUnpush()
1022 final int sharedPush(ForkJoinTask<?> task) { in sharedPush() argument
1028 a[(al - 1) & s] = task; in sharedPush()
1034 growAndSharedPush(task); in sharedPush()
1047 private void growAndSharedPush(ForkJoinTask<?> task) { in growAndSharedPush() argument
1052 a[(al - 1) & s] = task; in growAndSharedPush()
1063 final boolean trySharedUnpush(ForkJoinTask<?> task) { in trySharedUnpush() argument
[all …]
DAbstractExecutorService.java115 public Future<?> submit(Runnable task) { in submit() argument
116 if (task == null) throw new NullPointerException(); in submit()
117 RunnableFuture<Void> ftask = newTaskFor(task, null); in submit()
126 public <T> Future<T> submit(Runnable task, T result) { in submit() argument
127 if (task == null) throw new NullPointerException(); in submit()
128 RunnableFuture<T> ftask = newTaskFor(task, result); in submit()
137 public <T> Future<T> submit(Callable<T> task) { in submit() argument
138 if (task == null) throw new NullPointerException(); in submit()
139 RunnableFuture<T> ftask = newTaskFor(task); in submit()
DScheduledThreadPoolExecutor.java332 private void delayedExecute(RunnableScheduledFuture<?> task) { in delayedExecute() argument
334 reject(task); in delayedExecute()
336 super.getQueue().add(task); in delayedExecute()
338 !canRunInCurrentRunState(task.isPeriodic()) && in delayedExecute()
339 remove(task)) in delayedExecute()
340 task.cancel(false); in delayedExecute()
352 void reExecutePeriodic(RunnableScheduledFuture<?> task) { in reExecutePeriodic() argument
354 super.getQueue().add(task); in reExecutePeriodic()
355 if (!canRunInCurrentRunState(true) && remove(task)) in reExecutePeriodic()
356 task.cancel(false); in reExecutePeriodic()
[all …]
DExecutorService.java226 <T> Future<T> submit(Callable<T> task); in submit() argument
241 <T> Future<T> submit(Runnable task, T result); in submit() argument
254 Future<?> submit(Runnable task); in submit() argument
DCompletionService.java73 Future<V> submit(Callable<V> task); in submit() argument
89 Future<V> submit(Runnable task, V result); in submit() argument
DThreadPoolExecutor.java1147 Runnable task = w.firstTask; in runWorker() local
1152 while (task != null || (task = getTask()) != null) { in runWorker()
1164 beforeExecute(wt, task); in runWorker()
1167 task.run(); in runWorker()
1175 afterExecute(task, thrown); in runWorker()
1178 task = null; in runWorker()
1784 public boolean remove(Runnable task) { in remove() argument
1785 boolean removed = workQueue.remove(task); in remove()
/libcore/ojluni/src/main/java/java/util/
DTimer.java197 public void schedule(TimerTask task, long delay) { in schedule() argument
200 sched(task, System.currentTimeMillis()+delay, 0); in schedule()
214 public void schedule(TimerTask task, Date time) { in schedule() argument
215 sched(task, time.getTime(), 0); in schedule()
250 public void schedule(TimerTask task, long delay, long period) { in schedule() argument
255 sched(task, System.currentTimeMillis()+delay, -period); in schedule()
291 public void schedule(TimerTask task, Date firstTime, long period) { in schedule() argument
294 sched(task, firstTime.getTime(), -period); in schedule()
330 public void scheduleAtFixedRate(TimerTask task, long delay, long period) { in scheduleAtFixedRate() argument
335 sched(task, System.currentTimeMillis()+delay, period); in scheduleAtFixedRate()
[all …]
/libcore/ojluni/src/main/java/sun/nio/ch/
DAsynchronousChannelGroupImpl.java107 private Runnable bindToGroup(final Runnable task) { in bindToGroup() argument
112 task.run(); in bindToGroup()
117 private void startInternalThread(final Runnable task) {
123 ThreadPool.defaultThreadFactory().newThread(task).start();
129 protected final void startThreads(Runnable task) {
132 startInternalThread(task);
137 task = bindToGroup(task);
140 pool.executor().execute(task);
156 final int threadExit(Runnable task, boolean replaceMe) {
161 pool.executor().execute(bindToGroup(task));
[all …]
DEPollPort.java144 void executeOnHandlerTask(Runnable task) { in executeOnHandlerTask() argument
148 offerTask(task); in executeOnHandlerTask()
280 Runnable task = pollTask(); in run() local
281 if (task == null) { in run()
287 task.run(); in run()
DSimpleAsynchronousFileChannelImpl.java196 Runnable task = new Runnable() { in implLock() local
231 executor.execute(task); in implLock()
311 Runnable task = new Runnable() { in implRead() local
339 executor.execute(task); in implRead()
365 Runnable task = new Runnable() { in implWrite() local
393 executor.execute(task); in implWrite()
DCancellable.java38 void onCancel(PendingFuture<?,?> task); in onCancel() argument
DPendingFuture.java107 void setTimeoutTask(Future<?> task) { in setTimeoutTask() argument
110 task.cancel(false); in setTimeoutTask()
112 this.timeoutTask = task; in setTimeoutTask()
/libcore/ojluni/src/main/java/java/util/stream/
DForEachOps.java287 ForEachTask<S, T> task = this; in compute() local
291 task.helper.copyInto(taskSink, rightSplit); in compute()
294 ForEachTask<S, T> leftTask = new ForEachTask<>(task, leftSplit); in compute()
295 task.addToPendingCount(1); in compute()
300 taskToFork = task; in compute()
301 task = leftTask; in compute()
310 task.spliterator = null; in compute()
311 task.propagateCompletion(); in compute()
403 private static <S, T> void doCompute(ForEachOrderedTask<S, T> task) { in doCompute() argument
404 Spliterator<S> rightSplit = task.spliterator, leftSplit; in doCompute()
[all …]
DAbstractShortCircuitTask.java106 @SuppressWarnings("unchecked") K task = (K) this; in compute() local
110 if (task.taskCanceled()) { in compute()
111 result = task.getEmptyResult(); in compute()
115 result = task.doLeaf(); in compute()
119 task.leftChild = leftChild = task.makeChild(ls); in compute()
120 task.rightChild = rightChild = task.makeChild(rs); in compute()
121 task.setPendingCount(1); in compute()
125 task = leftChild; in compute()
130 task = rightChild; in compute()
136 task.setLocalResult(result); in compute()
[all …]
DAbstractTask.java296 @SuppressWarnings("unchecked") K task = (K) this; in compute() local
299 task.leftChild = leftChild = task.makeChild(ls); in compute()
300 task.rightChild = rightChild = task.makeChild(rs); in compute()
301 task.setPendingCount(1); in compute()
305 task = leftChild; in compute()
310 task = rightChild; in compute()
316 task.setLocalResult(task.doLeaf()); in compute()
317 task.tryComplete(); in compute()
DNodes.java1864 SizedCollectorTask<P_IN, P_OUT, T_SINK, K> task = this;
1866 while (rightSplit.estimateSize() > task.targetSize &&
1868 task.setPendingCount(1);
1870 task.makeChild(leftSplit, task.offset, leftSplitSize).fork();
1871 task = task.makeChild(rightSplit, task.offset + leftSplitSize,
1872 task.length - leftSplitSize);
1875 assert task.offset + task.length < MAX_ARRAY_SIZE;
1877 T_SINK sink = (T_SINK) task;
1878 task.helper.wrapAndCopyInto(sink, rightSplit);
1879 task.propagateCompletion();
[all …]
/libcore/luni/src/test/java/tests/support/
DThreadPool.java44 public synchronized void runTask(Runnable task) { in runTask() argument
48 if (task != null) { in runTask()
49 taskQueue.add(task); in runTask()
99 Runnable task = null; in run() local
101 task = getTask(); in run()
106 if (task == null) { in run()
112 task.run(); in run()
/libcore/ojluni/src/main/java/sun/nio/fs/
DCancellable.java119 static void runInterruptibly(Cancellable task) throws ExecutionException { in runInterruptibly() argument
120 Thread t = new Thread(task); in runInterruptibly()
128 task.cancel(); in runInterruptibly()
133 Throwable exc = task.exception(); in runInterruptibly()
/libcore/ojluni/annotations/hiddenapi/java/util/concurrent/
DExecutors.java120 public static <T> java.util.concurrent.Callable<T> callable(java.lang.Runnable task, T result) { in callable() argument
125 java.lang.Runnable task) { in callable() argument
218 public java.util.concurrent.Future<?> submit(java.lang.Runnable task) { in submit() argument
222 public <T> java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> task) { in submit() argument
226 public <T> java.util.concurrent.Future<T> submit(java.lang.Runnable task, T result) { in submit() argument
328 PrivilegedCallable(java.util.concurrent.Callable<T> task) { in PrivilegedCallable() argument
342 final java.util.concurrent.Callable<T> task; field in Executors.PrivilegedCallable
345 task = null;
353 PrivilegedCallableUsingCurrentClassLoader(java.util.concurrent.Callable<T> task) { in PrivilegedCallableUsingCurrentClassLoader() argument
373 final java.util.concurrent.Callable<T> task; field in Executors.PrivilegedCallableUsingCurrentClassLoader
[all …]

12