NutzCN Logo
问答 MainSetup 里面启用线程,无法启动
发布于 2193天前 作者 啊哈 1637 次浏览 复制 上一个帖子 下一个帖子
标签:
public class MainSetup implements Setup {

	public void init(NutConfig nc) {
		Ioc ioc = nc.getIoc();
		Dao dao = ioc.get(Dao.class);
		Dao daocheck = ioc.get(Dao.class,"daoCheck");
		Thread t1 = new Danger(dao, daocheck);
		t1.start();
		
	}
13-Nov-2018 13:49:49.727 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-apr-9999"]
13-Nov-2018 13:49:49.780 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-apr-8009"]
13-Nov-2018 13:49:49.781 INFO [main] org.apache.catalina.core.StandardService.stopInternal Stopping service Catalina
13-Nov-2018 13:49:49.833 WARNING [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [importData] registered the JDBC driver [com.alibaba.druid.proxy.DruidDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
13-Nov-2018 13:49:49.834 WARNING [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [importData] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
13-Nov-2018 13:49:49.836 WARNING [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [importData] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.lang.Object.wait(Native Method)
 java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
 com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:43)
13-Nov-2018 13:49:49.838 WARNING [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [importData] appears to have started a thread named [Thread-3] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.net.SocketInputStream.socketRead0(Native Method)
 java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
 java.net.SocketInputStream.read(SocketInputStream.java:170)
 java.net.SocketInputStream.read(SocketInputStream.java:141)
 com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:101)
 com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:144)
 com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:174)
 com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3005)
 com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3466)
 com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3456)
 com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3897)
 com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524)
 com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2677)
 com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2549)
 com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)
 com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1192)
 com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2931)
 com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)
 com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929)
 com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:131)
 com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493)
 org.nutz.dao.impl.sql.run.NutDaoExecutor._runPreparedStatement(NutDaoExecutor.java:308)
 org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:90)
 org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:66)
 org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22)
 org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64)
 org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139)
 org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:159)
 org.nutz.dao.impl.sql.run.NutDaoRunner._runWithTransaction(NutDaoRunner.java:105)
 org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:89)
 org.nutz.dao.impl.sql.run.NutDaoRunner$1.run(NutDaoRunner.java:75)
 org.nutz.trans.Trans.exec(Trans.java:174)
 org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:73)
 org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:240)
 org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:252)
 org.nutz.dao.impl.EntityOperator.exec(EntityOperator.java:55)
 org.nutz.dao.impl.NutDao.update(NutDao.java:336)
 bxa.main.Danger$1.run(Danger.java:176)
 org.nutz.trans.Trans.exec(Trans.java:174)
 org.nutz.trans.Trans.exec(Trans.java:132)
 bxa.main.Danger.run(Danger.java:170)
13-Nov-2018 13:49:49.845 SEVERE [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [importData] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@26d66cf6]) and a value of type [com.alibaba.druid.support.profile.ProfileEntry] (value [com.alibaba.druid.support.profile.ProfileEntry@3bcc84f5]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
13-Nov-2018 13:49:49.847 SEVERE [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [importData] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@7daf85e6]) and a value of type [org.nutz.trans.NutTransaction] (value [org.nutz.trans.NutTransaction@249ef656]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
13-Nov-2018 13:49:49.864 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-apr-9999"]
13-Nov-2018 13:49:49.916 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-apr-9999"]
13-Nov-2018 13:49:49.917 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-apr-8009"]
13-Nov-2018 13:49:49.918 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-apr-8009"]
2 回复

线程里的方法执行两句后,tomcat 一闪就退了

t1.start(); 注释掉会怎样

来自炫酷的 NutzCN

添加回复
请先登陆
回到顶部