Results 1 to 2 of 2

Thread: Question regarding Transaction Interceptor and Pointcut.

  1. #1

    Default Question regarding Transaction Interceptor and Pointcut.

    Currently I am using the following and everything works fine and fast and everybody is happy. However, when I change the PointCut list value to something that does not exists. Like currently, getUser() exists and if I change it to blah*, still it is working. But it taking way long time to retrieve the data.

    What is the reason for that? The reason being the difference in time is immense. When the actual method reg expression is given ( getUser* ) the time taken
    is 656 milliseconds. When the blah* is given in the pointcut, the time is 5100 seconds. Please explain.

    pointCut
    ~~~~~~~~
    <list>
    <value>blah*</value>
    </list>

    The working fast code is listed below:

    Code:
      
      <bean id="dataSource1" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
            <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
            <property name="url" value="*"/>
            <property name="username" value="*"/>
            <property name="password" value="*"/>
        </bean>
    
        <bean id="transactionManager1" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
            <property name="dataSource"><ref local="dataSource1"/></property>
        </bean>
    
    	<bean id="accountmapper" class="com.AccountRowMapper"/>
    	<bean id="usermapper" class="com.UserRowMapper"/>
    	
        <bean id="userDAO" class="com.UserJdbcDAO">
            <property name="dataSource"><ref local="dataSource1"/></property>
            <property name="rowMapper"><ref local="usermapper"/></property>
        </bean>    
    
        <bean id="userManagerTarget" class="com.UserManagerImpl">
            <property name="userDAO"><ref local="userDAO"/></property>
        </bean>
        
         <bean id="testAutoProxyCreator"
    		class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
    		<property name="interceptorNames">
    			<list>
    				<idref bean="transactionAdvisor" />
    				<idref bean="frontendloggingAdvisor" />
    			</list>
    		</property>
    		<property name="beanNames">
    			<list>
    				<idref local="userManagerTarget" />
    			</list>
    		</property>
    	</bean>
    
     
        <bean id="transactionAdvisor" class="org.springframework.aop.support.DefaultPointcutAdvisor">
    	    <property name="pointcut" ref="pointCut"/>  
            <property name="advice" ref="transactionInterceptor"/>
        </bean>
    
        <bean id="transactionInterceptor"
              class="org.springframework.transaction.interceptor.TransactionInterceptor">
            <property name="transactionManager" ref="transactionManager1"/>
            <property name="transactionAttributes">
                <props>
                    <prop key="getUser*">PROPAGATION_REQUIRED, readOnly</prop>
                </props>
            </property>
        </bean>
    
        <bean id="pointCut" class="org.springframework.aop.support.NameMatchMethodPointcut">
            <property name="mappedNames">
                <list>
                    <value>getUser*</value>
                </list>
                </property>
        </bean>
        
        <bean id="frontendloggingAdvisor" class="org.springframework.aop.support.DefaultPointcutAdvisor">
            <property name="advice" ref="frontendloggingInterceptor" />
            <property name="pointcut" ref="pointCut" />
        </bean>
    
        <bean id="frontendloggingInterceptor" class="com.LoggingInterceptor">
            <property name="application" value="UserAppl" />
        </bean>

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    No transaction, no reuse of connection so each query needs a new connection. This can add up quite easily.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •