jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexander Klimetschek" <aklim...@day.com>
Subject Re: Repository Locking Problem for Two Processes.
Date Tue, 06 Jan 2009 11:16:43 GMT
On Tue, Jan 6, 2009 at 10:47 AM, Nilshan <nilshan.parmar@indralok.com> wrote:
> I am using Jackrabbit 1.4. I have made an application in which two processes
> simultaneously access Repository. In my application when multiple threads
> within single process accesses Repository,  It doesn't create any
> problem.However, when another process tries to access repository it throws
> exception. This is
> because first process acquired a lock on repository and second process tries
> to lock repository. I want to
> share my repository between two processes so that my application can work
> smoothly. Is there any solution
> or way to resolve such problem?.

Only one Jackrabbit instance (or server) can access the repository
data, eg. the home directory plus the index files and the persistence
manager's data (whether it is directly on the filesystem or in a
database), at the same time. This is because a) Jackrabbit itself has
some in-memory caches that would have to be invalidated if something
changes on the filesystem and b) someone must synchronize the access
to nodes and properties and throw exceptions if there is a conflict
(as per the JCR specification). That's why there is the lock-file
mechansim that prevents two Jackrabbit instances to access the same
repository home.

The solution if you need access from multiple JVMs is to use either
RMI (deplyoment model 3 under [1]) or maybe to setup clustering [2]
(clustering is most useful if the processes are spread on multiple
machines and you want an automatic "replication" of the data).

[1] http://jackrabbit.apache.org/deployment-models.html
[2] http://wiki.apache.org/jackrabbit/Clustering


Alexander Klimetschek

View raw message