quartz 定时任务被挂起问题

问题描述

场景: 一个quartz定时任务,定时调用一个方法,方法里面通过多数据源从三个数据源ds1, ds2, ds3,获取数据,然后将这批数据插入另一个数据源 ds4的表中,再将这批数据从 ds4中查出来进行业务分析, 用的c3p0 连接池, 报错:【下面有贴出来】 同时 数据源 ds1 数据库出现异常, 报错后,数据源 ds1, ds2, ds3 的数据不能同步到 ds4 了,ds4的业务也不在执行,定时任务被挂起.. 这种场景 有可能是什么原因 引起定时任务被挂起的啊? WARN [com.mchange.v2.async.ThreadPoolAsynchronousRunner] - com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@3ee2b918 -- APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks! [com.mchange.v2.async.ThreadPoolAsynchronousRunner] - com.mchange.v2.async.ThreadPoolAsynchronousRunner$DeadlockDetector@3ee2b918 -- APPARENT DEADLOCK!!! Complete Status: Managed Threads: 3 Active Threads: 3 Active Tasks: com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask@16e5f6e9 (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0) com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask@53b546bd (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2) com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@22374d3a (com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1) Pending Tasks: com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask@5caf2c62 com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@708b0577 com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@3714015a Pool thread stack traces: Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0,5,main] java.net.SocketInputStream.socketRead0(Native Method) java.net.SocketInputStream.read(SocketInputStream.java:129) oracle.net.ns.Packet.receive(Unknown Source) oracle.net.ns.DataPacket.receive(Unknown Source) oracle.net.ns.NetInputStream.getNextPacket(Unknown Source) oracle.net.ns.NetInputStream.read(Unknown Source) oracle.net.ns.NetInputStream.read(Unknown Source) oracle.net.ns.NetInputStream.read(Unknown Source) oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1099) oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1070) oracle.jdbc.driver.T4C7Ocommoncall.receive(T4C7Ocommoncall.java:106) oracle.jdbc.driver.T4CConnection.logoff(T4CConnection.java:489) oracle.jdbc.driver.PhysicalConnection.close(PhysicalConnection.java:1446) com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:549) com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:234) com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:470)com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:964)com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2,5,main] java.net.SocketInputStream.socketRead0(Native Method) java.net.SocketInputStream.read(SocketInputStream.java:129) oracle.net.ns.Packet.receive(Unknown Source) oracle.net.ns.DataPacket.receive(Unknown Source) oracle.net.ns.NetInputStream.getNextPacket(Unknown Source) oracle.net.ns.NetInputStream.read(Unknown Source) oracle.net.ns.NetInputStream.read(Unknown Source) oracle.net.ns.NetInputStream.read(Unknown Source) oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1099) oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1070) oracle.jdbc.driver.T4C7Ocommoncall.receive(T4C7Ocommoncall.java:106) oracle.jdbc.driver.T4CConnection.logoff(T4CConnection.java:489) oracle.jdbc.driver.PhysicalConnection.close(PhysicalConnection.java:1446) com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:549) com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:234) com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:470)com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:964)com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)Thread[com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1,5,main] java.net.SocketInputStream.socketRead0(Native Method) java.net.SocketInputStream.read(SocketInputStream.java:129) oracle.net.ns.Packet.receive(Unknown Source) oracle.net.ns.NSProtocol.connect(Unknown Source) oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1023) oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:282) oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:447) oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165) oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35) oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:839) com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134) com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014) com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32) com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810) com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunn 问题补充:MyEyeOfJava 写道

解决方案

然后将这批数据插入另一个数据源 ds4的表中,再将这批数据从 ds4中查出来进行业务分析, 用的c3p0 连接池DS4内存在读写不分离,导致读的时候可能在写,任务挂起

时间: 2024-11-04 17:22:22

quartz 定时任务被挂起问题的相关文章

Spring+Quartz定时任务

最近研究站内搜索,因为要定时的更新索引库,看了看Spring+Quartz定时任务,用它完成,定时创建索引的任务!! 给大家分享一下helloworld的简单例子,大家可以根据实际情况变化使用 业务方法类 Java代码 package com.task; /** * 业务方法 * */ public class TestJob { public void execute() { try { System.out.println("我的业务方法被调用了---------!"); } ca

关于spring+quartz定时任务问题!!

问题描述 关于spring+quartz定时任务问题!! 怎么把定时任务写在表中,项目启动加载表数据,一个定时任务对应一个时间,在类中该怎么调用?数据写在一张表中.有人做过这种项目吗?求教啊.. 解决方案 关于spring和quartz的使用,可参考:http://git.oschina.net/wangkang/llsfw 希望能够帮到你.

khj-spring整合quartz定时任务报错,请大神们解救

问题描述 spring整合quartz定时任务报错,请大神们解救 web.xml中的配置 spring_mvcorg.springframework.web.servlet.DispatcherServlet contextConfigLocationclasspath:applicationContext spring_mvc/ applicationContext.xml的配置 <!-- 要调用的工作类 --> <!-- 定义调用对象和调用对象的方法 --> <!-- 调

j2ee项目中quartz定时任务的疑问?

问题描述 请问在j2ee项目中可以设置多个定时任务吗?若可以是不是要考虑用多线程来实现定时任务?因为我在操作项目的同时有可能定时任务也在执行,并发操作了.疑惑中....请亲们指点迷津!!!!注(定时任务用的是spring的quartz框架)? 问题补充:hao117 写道 解决方案 这样是不行的,因为Quartz是和spring分离的你的类都需要自己去注入,而且你的services不应该写到一起去啊建议把定时任务类,写在单独的类中自己写个Utils类 里面定义个static 的Applicati

最流行的java后台框架spring quartz定时任务_java

配置quartz 在spring中需要三个jar包: quartz-1.8.5.jar.commons-collections-3.2.1.jar.commons-logging-1.1.jar 首先要配置我们的spring.xml xmlns 多加下面的内容. xmlns:task="http://www.springframework.org/schema/task"  然后xsi:schemaLocation多加下面的内容. http://www.springframework.

Spring集成Quartz定时任务框架介绍和Cron表达式详解

原文地址:http://www.cnblogs.com/obullxl/archive/2011/07/10/spring-quartz-cron-integration.html 在JavaEE系统中,我们会经常用到定时任务,比如每天凌晨生成前天报表,每一小时生成汇总数据等等.我们可以使用java.util.Timer结合java.util.TimerTask来完成这项工作,但时调度控制非常不方便,并且我们需要大量的代码.使用Quartz框架无疑是非常好的选择,并且与Spring可以非常方便的

quartz 定时任务-问个问题 quartz 在Linux下 定时任务不执行是个什么情况!

问题描述 问个问题 quartz 在Linux下 定时任务不执行是个什么情况! 数据库 在Linux下 ! 应用在Windows下 如果数据库在Windows下 定时任务正常,反之不行!

springmvc中实现quartz定时任务(每分钟的第3秒执行任务调度方法)

1:实现触发器,最大的问题是jar包的处理(*.jar定时jar和sourcecodesource code): 此处,最关键的jar为第二个,名字最长. maven依赖: <dependency> <groupId>org.apache.servicemix.bundles</groupId> <artifactId>org.apache.servicemix.bundles.spring-context-support</artifactId>

【JAVA秒会技术之搞定Quartz定时任务】Quartz在Spring中的集成与应用

  Quartz在Spring中的集成与应用   一.Quqrtz简介     Quartz是一个完全由Java编写的开源任务调度的框架,通过触发器设置作业定时运行规则,控制作业的运行时间.主要用来执行定时任务,如:定时发送信息.定时生成报表等等. 简而言之,Quartz是一个定时器组件,是可以整合Spring使用的一个定时器.     二.Quqrtz的配置文件     1.在maven中引入: <dependency> <groupId>org.quartz-scheduler