About Question enthuware.ocejws.v6.2.278 :
Posted: Thu Jun 14, 2018 9:09 am
Hello, I have questions about answer:
and comment:
This gives a compile error which can be fixed like this: Future<GetResultKmPerHourResponse> asyncResult = (Future<GetResultKmPerHourResponse>) port.getResultKmPerHourAsync(r, callbackHandler);
I think it is correct, because Response implements Future
and about first (correct) answer:
callbackHandler don`t have to have getOutput() method so this code could be incorrect?
Code: Select all
Future<GetResultKmPerHourResponse> result = port.getResultKmPerHourAsync(r);
while (!result.isDone()) {
System.out.println(".");
}
GetResultKmPerHourResponse km = (GetResultKmPerHourResponse) result.get();
This gives a compile error which can be fixed like this: Future<GetResultKmPerHourResponse> asyncResult = (Future<GetResultKmPerHourResponse>) port.getResultKmPerHourAsync(r, callbackHandler);
I think it is correct, because Response implements Future
and about first (correct) answer:
Code: Select all
MyCallBackHandler<GetResultKmPerHourResponse> callbackHandler = new MyCallBackHandler<GetResultKmPerHourResponse>();
Future<?> asyncResult = port.getResultKmPerHourAsync(r, callbackHandler);
GetResultKmPerHourResponse res = callbackHandler.getOutput();