jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Short <...@benshort.co.uk>
Subject Re: FreeBSD indexing and lock file issues
Date Fri, 11 Dec 2009 10:33:53 GMT
I agree thats a bit tricky :)

You could try extending the JcrSessionFactory and overriding the
destroy method as follows:

public void destroy() throws Exception {
		super.destroy();
                if (repository instanceof JackrabbitRepository)
			((JackrabbitRepository) repository).shutdown();
	}

The destroy will be called by spring when you undeploy or shutdown
your webapp and there for the repository should be shut down.

Ben




2009/12/11 Sergey Podatelev <brightnesslevels@gmail.com>:
> On Fri, Dec 11, 2009 at 1:11 PM, Ben Short <ben@benshort.co.uk> wrote:
>> Sergey,
>>
>> Can I see your spring config that creates the repository?
>>
>
> Sure, but it's a bit tricky cause I had to configure distributed
> transactions for JCR and MySQL.
> Going with Jencks was the only way I managed to achieve it.
>
> applicationContext.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans ...>
>
>  <import resource="jdbc.xml" />
>  <import resource="jcr.xml" />
>
>  <bean id="jtaTransactionManager"
>      class="org.jencks.factory.TransactionManagerFactoryBean" />
> ...
> </beans>
>
> jcr.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans ...>
>
> <bean id="connectionTracker"
>    class="org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator"/>
>
>  <bean id="jrConnectionManager"
>      class="org.jencks.factory.ConnectionManagerFactoryBean">
>    <property name="transactionManager">
>      <ref bean="jtaTransactionManager" />
>    </property>
>    <property name="transaction" value="xa"/>
>    <property name="pooling" value="true" />
>    <property name="poolMinSize" value="5" />
>    <property name="poolMaxSize" value="100" />
>    <property name="connectionTracker" ref="connectionTracker" />
>  </bean>
>
>  <bean id="repository" class="org.jencks.factory.ConnectionFactoryFactoryBean">
>    <property name="managedConnectionFactory">
>      <ref local="repositoryManagedConnectionFactory"/>
>    </property>
>    <property name="connectionManager">
>      <ref local="jrConnectionManager"/>
>    </property>
>  </bean>
>
>  <bean id="repositoryManagedConnectionFactory"
>      class="org.apache.jackrabbit.jca.JCAManagedConnectionFactory">
>    <property name="homeDir" value="@repo.home@" />
>    <property name="configFile" value="@repo.config@" />
>  </bean>
>
>
>  <!-- SessionFactory -->
>  <bean id="jcrSessionFactory" class="org.springmodules.jcr.JcrSessionFactory">
>    <property name="repository">
>      <ref local="repository"/>
>    </property>
>    <property name="credentials">
>      <bean class="javax.jcr.SimpleCredentials">
>        <constructor-arg index="0" value="@repo.login@" />
>        <constructor-arg index="1" value="@repo.password@" />
>      </bean>
>    </property>
>  </bean>
>
>  <bean id="jcrTemplate" class="org.springmodules.jcr.JcrTemplate">
>    <property name="sessionFactory">
>      <ref local="jcrSessionFactory"/>
>    </property>
>    <property name="allowCreate" value="true"/>
>  </bean>
>
> </beans>
>
> jcbc.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <beans ...>
>
>  <bean id="jdbcConnectionManager"
>      class="org.jencks.factory.ConnectionManagerFactoryBean">
>    <property name="transactionManager">
>      <ref bean="jtaTransactionManager"/>
>    </property>
>    <property name="transaction" value="xa"/>
>  </bean>
>
>  <bean id="jdbcManagedConnectionFactory"
> class="org.jencks.tranql.DataSourceMCF">
>    <property name="driverName" value="com.mysql.jdbc.Driver" />
>    <property name="url" value="@mysql.url@" />
>    <property name="user" value="@mysql.login@" />
>    <property name="password" value="@mysql.password@" />
>  </bean>
>
>  <bean id="jdbcXaDataSource"
> class="org.jencks.factory.ConnectionFactoryFactoryBean">
>    <property name="managedConnectionFactory">
>      <ref local="jdbcManagedConnectionFactory"/>
>    </property>
>    <property name="connectionManager">
>      <ref local="jdbcConnectionManager" />
>    </property>
>  </bean>
>
> </beans>
>
> All the @...@ values are replaced at build time.
>
> --
> sp
>

Mime
View raw message