Home
last modified time | relevance | path

Searched refs:task (Results 1 – 25 of 50) 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 …]
/libcore/ojluni/src/test/java/util/concurrent/tck/
DFutureTaskTest.java282 PublicFutureTask task = new PublicFutureTask(new NoOpCallable()); in testIsDone() local
283 assertFalse(task.isDone()); in testIsDone()
284 task.run(); in testIsDone()
285 assertTrue(task.isDone()); in testIsDone()
286 checkCompletedNormally(task, Boolean.TRUE); in testIsDone()
287 assertEquals(1, task.runCount()); in testIsDone()
294 PublicFutureTask task = new PublicFutureTask(new NoOpCallable()); in testRunAndReset() local
296 assertTrue(task.runAndReset()); in testRunAndReset()
297 checkNotDone(task); in testRunAndReset()
298 assertEquals(i + 1, task.runCount()); in testRunAndReset()
[all …]
DScheduledExecutorSubclassTest.java75 private final RunnableScheduledFuture<V> task; field in ScheduledExecutorSubclassTest.CustomTask
77 CustomTask(RunnableScheduledFuture<V> task) { this.task = task; } in CustomTask() argument
78 public boolean isPeriodic() { return task.isPeriodic(); } in isPeriodic()
81 task.run(); in run()
83 public long getDelay(TimeUnit unit) { return task.getDelay(unit); } in getDelay()
85 return task.compareTo(((CustomTask)t).task); in compareTo()
88 return task.cancel(mayInterruptIfRunning); in cancel()
90 public boolean isCancelled() { return task.isCancelled(); } in isCancelled()
91 public boolean isDone() { return task.isDone(); } in isDone()
93 V v = task.get(); in get()
[all …]
DScheduledExecutorTest.java78 final Runnable task = new CheckedRunnable() { in testExecute() local
80 p.execute(task); in testExecute()
93 Callable task = new CheckedCallable<Boolean>() { in testSchedule1() local
99 Future f = p.schedule(task, timeoutMillis(), MILLISECONDS); in testSchedule1()
114 Runnable task = new CheckedRunnable() { in testSchedule3() local
119 Future f = p.schedule(task, timeoutMillis(), MILLISECONDS); in testSchedule3()
134 Runnable task = new CheckedRunnable() { in testSchedule4() local
140 p.scheduleAtFixedRate(task, timeoutMillis(), in testSchedule4()
156 Runnable task = new CheckedRunnable() { in testSchedule5() local
162 p.scheduleWithFixedDelay(task, timeoutMillis(), in testSchedule5()
[all …]
/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/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
/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()
/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()
/libcore/luni/src/test/java/libcore/java/util/concurrent/
DForkJoinTaskTest.java42 final ForkJoinTask task = ForkJoinTask.adapt(() -> result.addAndGet(42), result); in testAdaptToRunnableWithResult() local
45 pool.execute(task); in testAdaptToRunnableWithResult()
46 assertSame(result, task.join()); in testAdaptToRunnableWithResult()
61 final ForkJoinTask task = ForkJoinTask.adapt(callable); in testAdaptToCallable() local
64 pool.execute(task); in testAdaptToCallable()
65 Integer result = (Integer)task.join(); in testAdaptToCallable()
80 final ForkJoinTask task = ForkJoinTask.adapt(callable); in testAdaptToCallableThrowsException() local
83 pool.execute(task); in testAdaptToCallableThrowsException()
84 Integer result = (Integer)task.join(); in testAdaptToCallableThrowsException()
DRecursiveTaskTest.java63 SumTask task = new SumTask(10); in testSetRawResult() local
65 task.fork(); in testSetRawResult()
66 task.waitForCompletion(expected); in testSetRawResult()
67 Integer result = task.join(); in testSetRawResult()
DForkJoinPoolTest.java40 ForkJoinTask task = pool.submit(() -> result.addAndGet(42), result); in testSubmit() local
41 assertSame(result, task.get()); in testSubmit()
56 ForkJoinTask task = pool.submit(new Runnable() { in testGetRunningThreadCount() local
66 task.join(); in testGetRunningThreadCount()
/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/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 …]
/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()

12