On 02.12.2017, at 20:03, Marshall Schor <[email protected]> wrote:
> 
>> That is completely acceptable. Although, wouldn't the use of weak references
>> be a way to allow the FSes to be looked up by ID and still be GCed?
> Yes, the weak ref would allow the FS to be GC'd. 
> 
> But here's a use case which fails with this design:
> 1) the original CAS,  is created.  It has a bunch of FSs, whose IDs are 
> written
> out into a database somewhere.
> 1a) some of the FSs become unreachable. 
> 2) The CAS is serialized by V2, and includes the unreachables.
> 
> 3) the FSs are deserialized
> 4) the database of ids is used to "look up" these FSs - it may fail to find 
> the
> unreachable ones, because they may be GC'd.
> 
> I assume the intent is to have the FSs be found?

Well, as long as the FSes are indexed in the CAS, they are reachable, right? So 
they
wouldn't be GCed. When FSes are removed from indexes and also no longer 
reachable via
other FSes, then it should be ok to GC them. I guess in v2 even FSes that were 
removed
from indexes and were no longer reachable could be retrieved via their 
addresses - but
at least in my context, I consider non-indexed and non-reachable FSes to be 
actually
non-existent. I don't think it would cause a problem in WebAnno if such FSes 
were GCed.

>>> I don't think I'd want this as the "normal" mode of deserialization.  
>>> Perhaps we
>>> could have some kind of a -Duima.xxxx flag that turned on this mode for 
>>> those
>>> cases which needed it. 
>> That would be an option. Personally, I'd favor a local configuration option 
>> for
>> this in the deserializer, but the default value of that could be controlled
>> via a global property.
> 
> Would just a local config option be OK?

That should be sufficient for my case, yes.

-- Richard

Reply via email to