Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] Async-Methods

Hi Eugen,

Yes, that is correct. But you can show a never ending progress in a job.

Alternatively you can make a remote ProgressService that gets a ping every 1000 kunden-objects. 

Regards,

Wim



On Tue, Nov 23, 2010 at 2:49 PM, Eugen Reiswich <ereiswich@xxxxxxxxxxxxxx> wrote:
Hi Markus, 

taking the example below: say I have 10000 Kunden-objects which I need to read from e.g. a database. This might take a while therefore I would like to use an async-method to avoid time out exceptions. But in addition to that I would like to send say each 100 found Kunden-objects a progress update to the client so he knows something is happening on the server side. The example below will only inform when the job is done without any steps in between, right? 

final IFuture kunden = serviceAsync.listKundenAsync();
try {
// do something else here before kunden gets used
// doSomeHeavyComputation();

if(kunden.isDone()) {
setInput((Kunde[])kunden.get());
}
// finally wait for 1000ms to set the input and fail otherwise
setInput((Kunde[]) kunden.get(1000));
} catch (OperationCanceledException e) {
//TODO handle e somehow, but how?
e.printStackTrace();
} catch (InterruptedException e) {
//TODO handle e somehow, but how?
e.printStackTrace();
} catch (TimeoutException e) {
//TODO handle e somehow, but how?
e.printStackTrace();
}


Regards,
Eugen

Am 23.11.2010 um 13:45 schrieb Markus Alexander Kuppe:

On 11/23/2010 01:42 PM, Markus Alexander Kuppe wrote:
Hi Eugen,

check my slides (and code examples [0]) from the OSGi summer school. It
shows how to use an IFuture.

Markus

One more source for an example is the demo code that we used for ESE2010
[0].

Markus

[0]
https://github.com/lemmy/de.c1wps.winterschool/blob/master/de.c1wps.winterschool.ui.kundenauflister/src/de/c1wps/winterschool/ui/kundenlister/KundenListerView.java
_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev


_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev



Back to the top