jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Slater <li...@humanesoftware.com>
Subject Re: Model-2 Deployment example and test app [Fixed, with suggestions for updated docs]
Date Wed, 15 Feb 2006 09:52:53 GMT
I spoke too soon. The repository is, in fact, shut down when the web  
app is undeployed or redeployed while Tomcat is running. However it  
cannot be started again without restarting Tomcat entirely. I'm not  
sure what kind of data corruption risks are being run by not shutting  
it down nicely, but I know having to restart Tomcat to redeploy a  
webapp is onerous.

Looks like I may have to wait until the transient capabilities are  
merged into the BindableRepository.

Mark

On Feb 15, 2006, at 1:39 AM, Mark Slater wrote:

>
> On Feb 14, 2006, at 5:23 AM, Jukka Zitting wrote:
>
>>> I did find one other potential documentation bug in the howto-
>>> model1.xml page. The text says
>>> [...]
>>> I set up a model 1 repository in the same servlet (but with  
>>> different
>>> repository settings) and tried to follow these directions. The
>>> problem that I ran into is that the shutdown() method is not in the
>>> javax.jcr.Repository interface, and BindableRepository is package
>>> protected so I can't even cast the object returned by the Context to
>>> a BindableRepository. Without that, I wasn't able to see how the
>>> shutdown() method could be called from my servlet's destroy()  
>>> method.
>>
>> Good point. Nowadays there's an alternative Repository frontend  
>> called
>> TransientRepository that solves the shutdown problem by automatically
>> closing the repository when all the sessions are closed, but it  
>> hasn't
>> yet been integrated with BindableRepository. I'll take a look at
>> fixing this.
>
> It seems there's an interface in org.apache.jackrabbit.api called  
> JackrabbitRepository. Its only method is the prototype for the  
> shutdown() method that needs to be called. I tried changing  
> BindableRepository implement that, and made the method made public.  
> When I did my web app could cast the object it got from the JNDI  
> context to a JackrabbitRepository and things worked just fine.
>
> Mark
>
> Index: src/main/java/org/apache/jackrabbit/core/jndi/ 
> BindableRepository.java
> ===================================================================
> --- src/main/java/org/apache/jackrabbit/core/jndi/ 
> BindableRepository.java       (revision 377972)
> +++ src/main/java/org/apache/jackrabbit/core/jndi/ 
> BindableRepository.java       (working copy)
> @@ -16,6 +16,7 @@
>   */
> package org.apache.jackrabbit.core.jndi;
> +import org.apache.jackrabbit.api.JackrabbitRepository;
> import org.apache.jackrabbit.core.RepositoryImpl;
> import org.apache.jackrabbit.core.config.RepositoryConfig;
> @@ -59,7 +60,7 @@
>   * method should be used to explicitly close the repository if
>   * needed.
>   */
> -class BindableRepository implements Repository, Referenceable,  
> Serializable {
> +class BindableRepository implements Repository,  
> JackrabbitRepository, Referenceable, Serializable {
>      /** The serialization UID of this class. */
>      static final long serialVersionUID = -2298220550793843166L;
> @@ -253,7 +254,7 @@
>      /**
>       * Delegated to the underlying repository instance.
>       */
> -    void shutdown() {
> +    public void shutdown() {
>          ((RepositoryImpl) delegatee).shutdown();
>          try {
>              Runtime.getRuntime().removeShutdownHook(hook);
>
>


Mime
View raw message