180 RunnableFuture<V> f = newTaskFor(task);
181 executor.execute(new QueueingFuture(f));
182 return f;
183 }
184
185 public Future<V> submit(Runnable task, V result) {
186 if (task == null) throw new NullPointerException();
187 RunnableFuture<V> f = newTaskFor(task, result);
188 executor.execute(new QueueingFuture(f));
189 return f;
190 }
191
192 public Future<V> take() throws InterruptedException {
193 return completionQueue.take();
194 }
195
196 public Future<V> poll() {
197 return completionQueue.poll();
198 }
199
200 public Future<V> poll(long timeout, TimeUnit unit) throws InterruptedException {
201 return completionQueue.poll(timeout, unit);
202 }
203
204 }
|
180 RunnableFuture<V> f = newTaskFor(task);
181 executor.execute(new QueueingFuture(f));
182 return f;
183 }
184
185 public Future<V> submit(Runnable task, V result) {
186 if (task == null) throw new NullPointerException();
187 RunnableFuture<V> f = newTaskFor(task, result);
188 executor.execute(new QueueingFuture(f));
189 return f;
190 }
191
192 public Future<V> take() throws InterruptedException {
193 return completionQueue.take();
194 }
195
196 public Future<V> poll() {
197 return completionQueue.poll();
198 }
199
200 public Future<V> poll(long timeout, TimeUnit unit)
201 throws InterruptedException {
202 return completionQueue.poll(timeout, unit);
203 }
204
205 }
|