jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting" <jukka.zitt...@gmail.com>
Subject Re: Jackrabbit 1.3.1 Cache Management, some questions
Date Fri, 07 Sep 2007 21:00:21 GMT
Hi,

On 9/7/07, Clark Chang <clark.chang@thomson.com> wrote:
> Hi, We are using jackrabbit as the server mode accessing through RMI,
> The standard way to acces it:
>
> ClientRepositoryFactory factory = new ClientRepositoryFactory();
> Repository repository = factory.getRepository(name);
> Credentials credentials = new SimpleCredentials("user",
> "pass".toCharArray());
> Session session = repository.login(credentials);
> try {
> //do stuff
> }finally{
>  session.logout();
> }

Perfect, looks nice!

> The questions is if I forget to call session.logout(), I notice the
> CacheManager size get increased and after running this main routine several
> times, eventually performance will degrade and will cause out of the memory
> error.
> This case is intentional, of course is the application developer's fault.
> But in case there are RMI clients die without any chance to call the clean
> up code, would have the same effect. Does jackrabbit have any defensive
> mechnism, at least something like timeout to prevent this?

The RMI layer itself doesn't protect against that, as the case is
pretty much equivalent to a local client forgetting to close a
session.

A session timeout was suggested some time ago, but it's not
implemented and I'm not too convinced that adding one would be a good
idea (though won't object if someone submits a patch :-). A better
approach would probably be to detect when a Session instance gets
garbage collected and make sure that any associated resources are
properly released. I don't know if such cleanup is currently happening
or even if there aren't any internal hard references to created
sessions or resources like the item state caches that would prevent
them from being garbage collected...

BR,

Jukka Zitting

Mime
View raw message