2017-12-06 18:33

import java.util.Date;

import com.jfinal.plugin.cron4j.ITask;

public class ZsyRechargeAPITask implements ITask{
public static int para = 1;
public void run() {
// 这里放被执行的调试任务代码
para++;
System.out.println(new Date());
System.out.println(para);
try {
Thread.sleep(60*60*60);
System.out.println("handler");
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

public void stop() {
// 这里的代码会在 task 被关闭前调用
System.out.println("stop");
}

}

这是那个任务代码,是不是因为sleep 导致的没有释放锁

我最后找到两个锁地方
第一个
"cron4j::scheduler[6c83b8156e7b52bf251cee300000016028a28cef713e5a39]::executor[6c83b8156e7b52bf379fd2410000016028a39f611b8fb1bc]" daemon prio=6 tid=0x0000000008d52000 nid=0x5eb4 runnable [0x000000001117e000]
java.lang.Thread.State: RUNNABLE
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:345)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
- locked <0x00000000e1a91e10> (a java.io.BufferedOutputStream)


第二个
"http-apr-80-exec-12" daemon prio=6 tid=0x0000000009b16000 nid=0xc8a4 runnable [0x0000000031c1c000]
java.lang.Thread.State: RUNNABLE
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:345)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:122)
- locked <0x00000000e1a91730> (a java.io.BufferedOutputStream)
at java.io.PrintStream.write(PrintStream.java:480)
- locked <0x00000000e1a91710> (a java.io.PrintStream)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295)
at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
- locked <0x00000000e1b03068> (a java.io.OutputStreamWriter)



at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:345)

最后都是这个地方锁住的,我看了源码这个地方是synchronized的。

2017-12-06 16:08

最终都在等这个
"http-apr-80-exec-12" daemon prio=6 tid=0x0000000009b16000 nid=0xc8a4 runnable [0x0000000031c1c000]
java.lang.Thread.State: RUNNABLE
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:345)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:122)
- locked <0x00000000e1a91730> (a java.io.BufferedOutputStream)
at java.io.PrintStream.write(PrintStream.java:480)
- locked <0x00000000e1a91710> (a java.io.PrintStream)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295)
at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
- locked <0x00000000e1b03068> (a java.io.OutputStreamWriter)
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
at java.util.logging.StreamHandler.flush(StreamHandler.java:242)
- locked <0x00000000e1b02fa8> (a java.util.logging.ConsoleHandler)
at java.util.logging.ConsoleHandler.publish(ConsoleHandler.java:106)
at java.util.logging.Logger.log(Logger.java:616)
at java.util.logging.Logger.doLog(Logger.java:641)
at java.util.logging.Logger.logp(Logger.java:757)
at org.apache.juli.logging.DirectJDKLog.log(DirectJDKLog.java:183)
at org.apache.juli.logging.DirectJDKLog.info(DirectJDKLog.java:126)
at org.apache.jasper.compiler.TldLocationsCache.tldScanJar(TldLocationsCache.java:487)
at org.apache.jasper.compiler.TldLocationsCache.access$100(TldLocationsCache.java:79)
at org.apache.jasper.compiler.TldLocationsCache$TldJarScannerCallback.scan(TldLocationsCache.java:261)
at org.apache.tomcat.util.scan.StandardJarScanner.process(StandardJarScanner.java:259)
at org.apache.tomcat.util.scan.StandardJarScanner.scan(StandardJarScanner.java:178)
at org.apache.jasper.compiler.TldLocationsCache.init(TldLocationsCache.java:245)
- locked <0x00000000e2f2d7d0> (a org.apache.jasper.compiler.TldLocationsCache)
at org.apache.jasper.compiler.TldLocationsCache.getLocation(TldLocationsCache.java:205)
at org.apache.jasper.JspCompilationContext.getTldLocation(JspCompilationContext.java:618)
at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:409)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:475)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1427)
at org.apache.jasper.compiler.Parser.parse(Parser.java:138)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:242)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:657)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
- locked <0x00000000e4e4a568> (a org.apache.jasper.servlet.JspServletWrapper)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
at com.jfinal.render.JspRender.render(JspRender.java:67)
at com.jfinal.core.ActionHandler.handle(ActionHandler.java:99)
at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.jdxweb.common.session.SessionFilter.doFilter(SessionFilter.java:34)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)
- locked <0x00000000e4f15fe8> (a org.apache.tomcat.util.net.AprEndpoint$AprSocketWrapper)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

2017-12-02 20:28

波总回复还是相当及时的

2017-12-02 20:18

.关了这个确实可以了,那个jsprender在高并发时候也就死锁,我把tomcat线程数和内存调大了就没再出现

2017-12-01 15:59

所谓的高并发就是我用东西压着F5Y一直刷新

2017-12-01 15:39

request.getRequestDispatcher(view).forward(request, response);这个地方

2017-12-01 15:38

除了这个地方 jsprender 的render在高并发下也会被阻塞

2017-12-01 15:37

就是很多线程在waiting to lock <0x00000000c0392ee0>

2017-11-09 17:27

@JFinal 我在web.xml里面配置了com.alibaba.druid.support.http.WebStatFilter 然后web 和url监控出来了

2017-11-06 13:20

@JFinal 这个我也加了,但是确实是没有

2017-11-03 17:19

写sql简单高效暴力好理解