| Author |
java.util.concurrent.Future<capture#293 of ?>
|
Steven Rodeo
Ranch Hand
Joined: Mar 06, 2008
Posts: 69
|
|
Apologies if this may be too basic, not sure even if this question belongs here, but when I am trying to submit a Runnable Task, I am not sure what should be the return value.
The following code snippet, gives the following error.
found : java.util.concurrent.Future<capture#293 of ?>
required: java.util.concurrent.Future<java.lang.Runnable>
Future<Runnable> ldkdl = def.submit(new runnables(3838));
1 error
-SM
|
 |
Ireneusz Kordal
Ranch Hand
Joined: Jun 21, 2008
Posts: 423
|
|
This compiles:
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 14606
|
|
Basically, the generic type of the future object is the type to be returned from the callable (or runnable). In the case of runnable, which doesn't have a return type, you can either use the submit() method that specifies the type, or assign it to an unknown type.... ie. Future<?>.
Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
 |
|
|
subject: java.util.concurrent.Future<capture#293 of ?>
|
|
|