You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Filip Defoort <fi...@cirquedigital.com> on 2006/07/21 02:08:13 UTC

[VFS] FileObject.close rules

Hi VFS/Mario,

I'm digging through some older VFS based code, and I used to plaster
FileObject.close() through the code (essentially after each resolve) to
make sure I had current information.

With the new ON_RESOLVE cache strategy, is that still the recommended
way of doing things ?

Or can I just leave the FileObjects I need often open, do a 
resolveFile() before
I use them. Will they still get kicked out of the cache this way ? (or does
leaving a FileObject open lock it in memory)

It'd be great if someone could give some general guidelines on what the
intended usage patterns are with the new caching system...

Thanks in advance,
- Filip

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [VFS] FileObject.close rules

Posted by Filip Defoort <fi...@cirquedigital.com>.
Thanks, Mario, that'll simplify things!

Cheers,
- Filip
PS: thanks for applying the other fix as well.

Mario Ivankovits wrote:
> Hi!
>   
>> I'm digging through some older VFS based code, and I used to plaster
>> FileObject.close() through the code (essentially after each resolve) to
>> make sure I had current information.
>>
>> With the new ON_RESOLVE cache strategy, is that still the recommended
>> way of doing things ?
>>     
> No, you can remove these lines of code - as you mentioned ON_RESOLVE
> will refresh the file-informations on each resolveFile()
>
>   
>> Or can I just leave the FileObjects I need often open, do a
>> resolveFile() before
>> I use them. Will they still get kicked out of the cache this way ? (or
>> does
>> leaving a FileObject open lock it in memory)
>>     
> No, should not be the case, as soon as you have no reference to the
> object (and the JVM needs memory) it will be garbage collected.
>
>   
>> It'd be great if someone could give some general guidelines on what the
>> intended usage patterns are with the new caching system...
>>     
> No other guideline then before, just, you do not need to call close() to
> refresh the file informations (=cacheStrategy) and - if you still would
> like to do it manually there is not a method called "refresh()" on the
> FileObject interface.
>
> Ciao,
> Mario
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [VFS] FileObject.close rules

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
> I'm digging through some older VFS based code, and I used to plaster
> FileObject.close() through the code (essentially after each resolve) to
> make sure I had current information.
>
> With the new ON_RESOLVE cache strategy, is that still the recommended
> way of doing things ?
No, you can remove these lines of code - as you mentioned ON_RESOLVE
will refresh the file-informations on each resolveFile()

> Or can I just leave the FileObjects I need often open, do a
> resolveFile() before
> I use them. Will they still get kicked out of the cache this way ? (or
> does
> leaving a FileObject open lock it in memory)
No, should not be the case, as soon as you have no reference to the
object (and the JVM needs memory) it will be garbage collected.

> It'd be great if someone could give some general guidelines on what the
> intended usage patterns are with the new caching system...
No other guideline then before, just, you do not need to call close() to
refresh the file informations (=cacheStrategy) and - if you still would
like to do it manually there is not a method called "refresh()" on the
FileObject interface.

Ciao,
Mario


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org