Home » Archived » EMF-IncQuery » Get notified when index is ready
|
Re: Get notified when index is ready [message #1560550 is a reply to message #1560492] |
Mon, 12 January 2015 17:19 |
Gabor Bergmann Messages: 36 Registered: July 2009 |
Member |
|
|
Hi Ali,
First of all, I would like to note that EMF-IncQuery is single-threaded at the moment. In fact, I think EMF itself is not thread-safe. So you should be using an EMF model (and a corresponding EMF-IncQuery engine) from a single thread only. This also means that there is no "waiting" involved. If the user invokes getAllMatches() etc., then by the time that invocation returns results, you can be sure that any underlying index has finished building or updating.
At least that is the behaviour we are trying to create. So if you have observed EMF-IncQuery to behave differently, that is probably a bug. In that case, we would very much like to hear about it, of course
This was the short version. Internal details follow.
For the two fields you have mentioned, they keep track of internal TODOs of the EMF Base Index - proxy references that should be resolved, but the resolution is deferred because some of the Resources in the ResourceSet have not finished loading yet. You may know that EMF supports cross-references between Resources; by default (i.e. without EMF-IncQuery), these cross-references have lazy loading: they are only resolved when first accessed (and this resolution may imply loading the referenced Resource). Now EMF-IncQuery indexes the whole model, so it will try to resolve all references; but some references cannot be resolved while the target Resource is being loaded, so this resolution may be deferred for a short while. Once the last Resource finishes loading, EMF-IncQuery will try to resolve outstanding proxies.
However, all of the stuff described in previous paragraph happens during the time EMF-IncQuery is first initialized on the model (or an EMF update notification is handled by the indexer). The first paragraph still applies here: by the time you see results, they should be in a consistent state.
If I have misunderstood your motives for asking this question, please explain
Cheers,
Gábor
|
|
| |
Re: Get notified when index is ready [message #1565486 is a reply to message #1560550] |
Thu, 15 January 2015 09:56 |
Ali AKAR Messages: 31 Registered: July 2009 |
Member |
|
|
Hi Gabor,
Thank you for your answer.
EMF-IncQuery works fine :)
In my use case, I use EMF-IncQuery for proxy resolution in very large
models and I wanted some how that other thread wait until the index get
initialized. I needed this in a very specific EObjectResolvingElist
extension and I found a way using a flag.
Also, it's import in some UI components, which use the index, to display
to the end-user some information telling that we are indexing and how
much work left... otherwise you have the impression that the tool is not
responding.
Due to cross references, proxy resolution is delayed in my case until
the end of loading.
I start to use EMF-IncQuery recently and I'll play with it more in the
upcoming weeks ;)
Regards,
Ali
Le 12/01/2015 18:19, Gabor Bergmann a écrit :
> Hi Ali,
>
> First of all, I would like to note that EMF-IncQuery is single-threaded
> at the moment. In fact, I think EMF itself is not thread-safe. So you
> should be using an EMF model (and a corresponding EMF-IncQuery engine)
> from a single thread only. This also means that there is no "waiting"
> involved. If the user invokes getAllMatches() etc., then by the time
> that invocation returns results, you can be sure that any underlying
> index has finished building or updating.
>
> At least that is the behaviour we are trying to create. So if you have
> observed EMF-IncQuery to behave differently, that is probably a bug. In
> that case, we would very much like to hear about it, of course :)
>
> This was the short version. Internal details follow.
>
> For the two fields you have mentioned, they keep track of internal TODOs
> of the EMF Base Index - proxy references that should be resolved, but
> the resolution is deferred because some of the Resources in the
> ResourceSet have not finished loading yet. You may know that EMF
> supports cross-references between Resources; by default (i.e. without
> EMF-IncQuery), these cross-references have lazy loading: they are only
> resolved when first accessed (and this resolution may imply loading the
> referenced Resource). Now EMF-IncQuery indexes the whole model, so it
> will try to resolve all references; but some references cannot be
> resolved while the target Resource is being loaded, so this resolution
> may be deferred for a short while. Once the last Resource finishes
> loading, EMF-IncQuery will try to resolve outstanding proxies.
> However, all of the stuff described in previous paragraph happens during
> the time EMF-IncQuery is first initialized on the model (or an EMF
> update notification is handled by the indexer). The first paragraph
> still applies here: by the time you see results, they should be in a
> consistent state.
>
> If I have misunderstood your motives for asking this question, please
> explain :)
>
> Cheers,
> Gábor
|
|
| |
Goto Forum:
Current Time: Sun Oct 13 00:32:31 GMT 2024
Powered by FUDForum. Page generated in 0.04205 seconds
|