Reputation: 424
If I submit task, and futureTask.get() returns null, I would like to process what I sent in the Callable object another way. When debugging, I can see that my Future has a private final member called "sync". "sync" contains my callable, which has the original data that I sent in the Callable. Unfortunately, I can't get to it.
In pseudocode...
Callable callable = new Callable(myData);
Future future = executor.submit(callable);
if (future.get() == null)
{
//what I would like to have if the "sync" member was available..
String alreadySubmittedData = future.sync.callable.myData;
}
It seems like there should be a way to do this? Thanks.
Upvotes: 0
Views: 2164
Reputation: 7400
Callable
and Future
are just interfaces anyway, so I guess you have to keep that info around yourself (e.g. associating futures to callables in a map).
Upvotes: 1