2020-06-04 08:56

@myth4ian 这个问题有办法解决吗

2020-06-01 14:45

@JFinal 谢谢回复。确实没认真看到配置,但是我设置不设置,如果我故意在定时任务线程执行的时候,去shutdown Tomcat,会抛出一个内存错误,能指点下我应该怎么解决吗? 如果我等待线程结束后关闭Tomcat就不会报错。

Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.121-b13 mixed mode):

"localhost-startStop-2" #35 daemon prio=5 os_prio=0 tid=0x00007fb5740d0800 nid=0x7eca in Object.wait() [0x00007fb55fdfe000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.Thread.join(Thread.java:1249)
- locked <0x00000000d8baf220> (a java.lang.Thread)
at java.lang.Thread.join(Thread.java:1323)
at it.sauronsoftware.cron4j.TaskExecutor.join(Unknown Source)
at it.sauronsoftware.cron4j.Scheduler.tillExecutorDies(Unknown Source)
at it.sauronsoftware.cron4j.Scheduler.stop(Unknown Source)
- locked <0x00000000d88395f0> (a java.lang.Object)
at com.jfinal.plugin.cron4j.Cron4jPlugin$TaskInfo.stop(Cron4jPlugin.java:279)
at com.jfinal.plugin.cron4j.Cron4jPlugin.stop(Cron4jPlugin.java:226)
at com.jfinal.core.JFinal.stopPlugins(JFinal.java:115)
at com.jfinal.core.JFinalFilter.destroy(JFinalFilter.java:91)
at org.apache.catalina.core.ApplicationFilterConfig.release(ApplicationFilterConfig.java:312)
at org.apache.catalina.core.StandardContext.filterStop(StandardContext.java:4733)
- locked <0x00000000d5cabdb8> (a java.util.HashMap)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5528)
- locked <0x00000000d59e19d8> (a org.apache.catalina.core.StandardContext)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:221)
- locked <0x00000000d59e19d8> (a org.apache.catalina.core.StandardContext)
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1424)
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1413)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

"Catalina-startStop-2" #34 daemon prio=5 os_prio=0 tid=0x00007fb59021b000 nid=0x7ec9 waiting on condition [0x00007fb580bfa000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000000c0707990> (a java.util.concurrent.FutureTask)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.FutureTask.awaitDone(FutureTask.java:429)
at java.util.concurrent.FutureTask.get(FutureTask.java:191)
at org.apache.catalina.core.ContainerBase.stopInternal(ContainerBase.java:999)
- locked <0x00000000d59e1e88> (a org.apache.catalina.core.StandardHost)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:221)
- locked <0x00000000d59e1e88> (a org.apache.catalina.core.StandardHost)
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1424)
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1413)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

"cron4j::scheduler[2bff2bb57426fc7c0fbc094a000001726e9c4f040b710954]::executor[2bff2bb57426fc7c52ae49a8000001726e9ca8966f71a121]" #32 prio=5 os_prio=0 tid=0x00007fb560077000 nid=0x7eb1 runnable [0x00007fb580dfb000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:171)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
at sun.security.ssl.InputRecord.read(InputRecord.java:503)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
- locked <0x00000000d9423d48> (a java.lang.Object)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:930)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
- locked <0x00000000d9423ec8> (a sun.security.ssl.AppInputStream)
at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137)
at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:153)
at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:280)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:157)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
at com.amazonaws.http.protocol.SdkHttpRequestExecutor.doReceiveResponse(SdkHttpRequestExecutor.java:82)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
at com.amazonaws.http.apache.client.impl.SdkHttpClient.execute(SdkHttpClient.java:72)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1330)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1145)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:802)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:770)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:744)
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:704)
at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:686)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:550)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:530)
at com.amazonaws.services.sqs.AmazonSQSClient.doInvoke(AmazonSQSClient.java:2207)
at com.amazonaws.services.sqs.AmazonSQSClient.invoke(AmazonSQSClient.java:2174)
at com.amazonaws.services.sqs.AmazonSQSClient.invoke(AmazonSQSClient.java:2163)
at com.amazonaws.services.sqs.AmazonSQSClient.executeReceiveMessage(AmazonSQSClient.java:1607)
at com.amazonaws.services.sqs.AmazonSQSClient.receiveMessage(AmazonSQSClient.java:1578)
at com.amazonaws.services.sqs.AmazonSQSClient.receiveMessage(AmazonSQSClient.java:1619)
at com.cms.task.AwsSqsReceiveTask.run(AwsSqsReceiveTask.java:41)
at it.sauronsoftware.cron4j.RunnableTask.execute(Unknown Source)
at it.sauronsoftware.cron4j.TaskExecutor$Runner.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)

"ajp-nio-8009-Acceptor-0" #29 daemon prio=5 os_prio=0 tid=0x00007fb59048c800 nid=0x7eae waiting on condition [0x00007fb56c7ad000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at org.apache.tomcat.util.net.NioEndpoint$Acceptor.run(NioEndpoint.java:674)
at java.lang.Thread.run(Thread.java:745)

"ajp-nio-8009-ClientPoller-0" #28 daemon prio=5 os_prio=0 tid=0x00007fb590222800 nid=0x7ead waiting on condition [0x00007fb56c8ae000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at org.apache.tomcat.util.net.NioEndpoint$Poller.run(NioEndpoint.java:1023)
at java.lang.Thread.run(Thread.java:745)

"http-nio-5566-Acceptor-0" #27 daemon prio=5 os_prio=0 tid=0x00007fb590220800 nid=0x7eac waiting on condition [0x00007fb5809f8000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at org.apache.tomcat.util.net.NioEndpoint$Acceptor.run(NioEndpoint.java:674)
at java.lang.Thread.run(Thread.java:745)

"http-nio-5566-ClientPoller-0" #26 daemon prio=5 os_prio=0 tid=0x00007fb59021f000 nid=0x7eab waiting on condition [0x00007fb580af9000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at org.apache.tomcat.util.net.NioEndpoint$Poller.run(NioEndpoint.java:1023)
at java.lang.Thread.run(Thread.java:745)

"config.data" #22 prio=5 os_prio=0 tid=0x00007fb57467d000 nid=0x7ea7 waiting on condition [0x00007fb56ceb0000]
java.lang.Thread.State: TIMED_WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000000d8824d58> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

2019-11-08 10:43

https://www.jfinal.com/feedback/6685 你看看我这。应该是没有问题的。

2019-11-04 09:48

@JFinal updateStockInOrderToDelete方法从private改成public后可以注入Tx拦截器

2019-11-02 12:07

@JFinal 业务层的拦截器的触发条件是不是说,先在业务层使用@before方法注入拦截器,然后再controller控制层使用@Inject注入,并且控制层必须要有 service.方法名 调用这个方法,这个方法的拦截器才会被触发。

如果这个业务层的方法,是被业务层的其他方法调用的,那么这个方法的拦截器就无法触发。

2019-11-01 08:57

@JFinal forceToComplete这个方法在controller,updateStockInOrderToDelete这个方法在Service业务层,不是controller里面的方法,不clear的话,异常情况数据库没有插入数据,说明事务是开启的,Config中已经配置了me.setInjectDependency(true)。

2019-10-25 16:44

@JFinal 此处呼叫大佬,我也遇到这个问题了

2019-10-19 09:45

@小不点JSW 前端用特殊字符替代一下,接收后再转回来。。