My IDE is complaining that "NCM_Callable cannot be converted to Callable<ReturnInterface<? extends Object>>
on this line this.ph.submitCallable(new NCM_Callable(this, new DeviceGroup(this.deviceGroupNames.get(i)), ph)); In the "fetchDevices()" method
I just want to be able to pass Callables to my ecs that returns a ReturnInterface containing any type of object.
I suspect there is something wrong with my usage of <> generic definitions, but I can't seem to figure out what it is. Any help would be appreciated.
@Override
public void fetchDevices() throws Exception {
System.out.println("[NCM_Fetcher]fetchingDevices()");
for (int i = 0; i < this.deviceGroupNames.size(); i++) {
System.out.println("[NCM_Fetcher]fetchingDevices().submitting DeviceGroup Callable " + i+ " of "+this.deviceGroupNames.size());
this.ph.submitCallable(new NCM_Callable(this, new DeviceGroup(this.deviceGroupNames.get(i)), ph));
}
this.ph.execute();//See progressBarhelper below
}
ProgressBarHelper: I have a strange error at "ecs.submit()". From what I've read, it seems like I may need a helper method? How do I fix?
public class ProgressBarHelper extends SwingWorker<Void, ReturnInterface> implements ActionListener {
ExecutorService pool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
protected CompletionService<ReturnInterface<?>> ecs;
public final void submitCallable(Callable<? extends ReturnInterface<?>> c) {
//create a map for this future
ecs.submit(c);
this.callables.add(c);//Error here is Callable<CAP#1 cannot be converted to Callable<ReturnInterface<?>>
System.out.println("[ProgressBarHelper]submitted");
}
}
And Finally, the NCM_Callable class with its Generics.
public class NCM_Callable implements Callable<ReturnInterface<ResultSet>>, ReturnInterface<ResultSet> {