On 12/2/2017 8:23 AM, Richard Eckart de Castilho wrote: > On 02.12.2017, at 04:06, Marshall Schor <[email protected]> wrote: >>> WebAnno doesn't make use of the unreferenced FSes - there is no problem >>> if they are GCed. However, WebAnno relies on the fact that for v2 CASes >>> stored/loaded using CasCompleteSerializer have stable addresses/IDs. >>> >>> The following should be possible: >>> >>> * create a FS in the CAS >>> * let X be the ID of the FS >>> * save CAS to file >>> * load CAS to memory >>> * get the FS from the CAS via X >> This could be made to work, but as I've said before, it would prevent future >> GC's from happening on the loaded FSs, should some updates occur which made >> them >> unreachable. >> >> Is this acceptable? > 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? -Marshall > >> 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? -M > > Cheers, > > -- Richard
