服务器在使用spring transaction management后停止响应

时间:2017-07-07 08:25:17

标签: java spring-transactions

我配置了spring transaction management,它按预期工作。但是,当负载增加时,服务器停止响应。

我正在处理我在database.xml中配置的多模块项目,该项目位于DAO模块内

我项目的目录结构截图:

Screenshot of directory structure of my project

<?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/context
            http://www.springframework.org/schema/context/spring-context.xsd
            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">

        <context:property-placeholder location="classpath:jdbc.properties"/>
        <context:component-scan base-package="za.co.virginactive.dao" />
        <context:property-placeholder location="classpath:jdbc.properties"/>

        <tx:annotation-driven proxy-target-class="true" transaction-manager="transactionManager" />

        <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
            <property name="dataSource" ref="dataSource" />
        </bean>

        <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
            <property name="driverClass" value="${jdbc.driverClassName}" />
            <property name="jdbcUrl" value="${jdbc.url}" />
            <property name="user" value="${jdbc.username}" />
            <property name="password" value="${jdbc.password}" />
            <property name="testConnectionOnCheckout" value="true"/>
            <property name="testConnectionOnCheckin" value="true"/>
            <property name="preferredTestQuery" value="SELECT first 1 clubno from club"/>
        </bean>

        <bean id="imageDS" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
            <property name="driverClass" value="${image.jdbc.driverClassName}" />
            <property name="jdbcUrl" value="${image.jdbc.url}" />
            <property name="user" value="${image.jdbc.username}" />
            <property name="password" value="${image.jdbc.password}" />
            <property name="testConnectionOnCheckout" value="true"/>
            <property name="testConnectionOnCheckin" value="true"/>
            <property name="preferredTestQuery" value="SELECT first 1 clientno from images"/>
        </bean>

        <bean id="mdsDS" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
            <property name="driverClass" value="${mds.jdbc.driverClassName}" />
            <property name="jdbcUrl" value="${mds.jdbc.url}" />
            <property name="user" value="${mds.jdbc.username}" />
            <property name="password" value="${mds.jdbc.password}" />
            <property name="testConnectionOnCheckout" value="true"/>
            <property name="testConnectionOnCheckin" value="true"/>
            <property name="preferredTestQuery" value="SELECT top 1 id from mdm.club"/>
        </bean>

        <bean id="accessDS" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
            <property name="driverClass" value="${access.jdbc.driverClassName}" />
            <property name="jdbcUrl" value="${access.jdbc.url}" />
            <property name="user" value="${access.jdbc.username}" />
            <property name="password" value="${access.jdbc.password}" />
            <property name="testConnectionOnCheckout" value="true"/>
            <property name="testConnectionOnCheckin" value="true"/>
            <property name="preferredTestQuery" value="SELECT first 1 clubno from club"/>
        </bean>

        <bean id="archiveDS" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
            <property name="driverClass" value="${archive.jdbc.driverClassName}" />
            <property name="jdbcUrl" value="${archive.jdbc.url}" />
            <property name="user" value="${archive.jdbc.username}" />
            <property name="password" value="${archive.jdbc.password}" />
            <property name="testConnectionOnCheckout" value="true"/>
            <property name="testConnectionOnCheckin" value="true"/>
            <property name="preferredTestQuery" value="SELECT first 1 * from rdb$database"/>
        </bean>
        <!--<jdbc:initialize-database data-source="dataSource">-->
            <!--<jdbc:script location="classpath:ddl/db-schema.sql"/>-->
        <!--</jdbc:initialize-database>-->
    </beans>

0 个答案:

没有答案