2

我的方面流程有问题。我已经安排了我在方面包裹的石英工作女巫。当我在没有方面的情况下这样做时,我没有问题,但是当我在进程执行多次后将其包装在方面时,应用程序在尝试连接到数据库时似乎处于挂起状态。日志显示由于 ConnectionWaitTimeoutExceptions 导致的几个 J2CA0045E 错误,以及涉及从池中获取空闲连接的问题的其他错误。当我寻找我的免费连接时,没有可用的连接。似乎我的方面没有关闭连接。我不明白为什么会发生这种情况,因为当我不使用方面时,一切都运行良好并且连接已关闭。

我在 applicationContext.xml 中的方面配置是这样的:

<!-- Aspect -->
<bean id="logAspect" class="hr.kket.cscada.web.util.aspect.LoggingAspect" />
<aop:config proxy-target-class="true">
    <aop:aspect id="aspectLoggging" ref="logAspect" >
        <aop:pointcut id="syncUdwAspect"
        expression="execution(* hr.kket.cscada.services.balancing.BalancingService.syncAllUdwForGasDay(..))" />
        <!-- @Around -->
        <aop:around method="logProcess" pointcut-ref="syncUdwAspect" />
    </aop:aspect>
</aop:config>

我的 loggingAspect 类是这样的:

@Aspect
public class LoggingAspect {
    public Object logProcess(ProceedingJoinPoint joinPoint) throws Throwable {
        <!-- some code before -->
    int br = dbparameter;//

    if(br == 0) {
        log.error('some message');
    } else {
        insertSomethingInDB();//inside I open and close connection, this works well.
        try {
            Object result = joinPoint.proceed();// connection of this job is not closing with aspect
            <!-- some code after -->
            insertSomethingInDB();//inside I open and close connection, this works well.
            return result;
        } catch (Exception e) {
            log.info(e.getMessage());
            <!-- some code here -->     
            throw e;
        }   
    }
    return null;
    }
}

有谁知道可能是什么问题?提前致谢!

4

0 回答 0