2019-11-21 18:51

使用JFinalJson.getJson().toJson(record.getList())方法时,JSONObject要使用net.sf.json就不会出现把record.getList()变成字符串,jsonObject.put就是JsonObject

2019-11-12 16:35

有企业管理器了,为什么还要用navcat?

2019-10-29 14:51

DbKit.getConfig(uuid).getName()
在stop前是可以获取到uuid的,stop后就为null了,应该可以认为被释放了吧

2019-10-29 14:43

以下是报错信息:
[ERROR]-[Thread: XNIO-1 task-2]-[com.jfinal.core.ActionHandler.handle()]: com.xxkd.index.IndexController.g() : /g?page=1&limit=10
java.lang.IllegalArgumentException: Config already exists: getLedger
at com.jfinal.plugin.activerecord.DbKit.addConfig(DbKit.java:63)
at com.jfinal.plugin.activerecord.ActiveRecordPlugin.start(ActiveRecordPlugin.java:227)
at com.xxkd.index.IndexController.getLedger(IndexController.java:54)
at com.xxkd.index.IndexController.g(IndexController.java:28)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.jfinal.aop.Invocation.invoke(Invocation.java:97)
at com.jfinal.core.ActionHandler.handle(ActionHandler.java:89)
at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:89)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.SessionRestoringHandler.handleRequest(SessionRestoringHandler.java:119)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:269)
at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:78)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:133)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:130)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:249)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:78)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:99)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:376)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
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)
======
加上时间变量进行信息打印
线程一:
dp start==>2019-10-29 14:30:10|null
ap start before==>2019-10-29 14:30:10|getLedger
ap start after==>2019-10-29 14:30:10|getLedger
....
ap stop before==>2019-10-29 14:30:10|getLedger
ap stop after==>2019-10-29 14:30:10|getLedger
dp stop==>2019-10-29 14:30:10|null
线程二:
dp start==>2019-10-29 14:30:10|null
ap start before==>2019-10-29 14:30:10|getLedger
ap start after==>2019-10-29 14:30:10|getLedger
....
ap stop before==>2019-10-29 14:30:10|getLedger
ap stop after==>2019-10-29 14:30:10|getLedger
dp stop==>2019-10-29 14:30:10|null
跟踪下,我想应该是多个线程同时访问产生的问题,以上复制了两个线程,发现时间是一样的。
所以,用了uuid后,发现是多线同一时间访问。
======
但是,activerecord stop后还是能获取到ap.getConfig().getName()名称
现在是不清楚该被调用的函数中的ActiveRecordPlugin和DruidPlugin是否被释放

2019-10-29 12:35

如果以 try(...) {} 方式来写,会报以下错误:
Incompatible types.
Required: java.lang.AutoCloseable
Found: com.jfinal.plugin.druid.DruidPlugin

Incompatible types.
Required: java.lang.AutoCloseable
Found: com.jfinal.plugin.activerecord.ActiveRecordPlugin

不支持close()。

代码改成以下:
DruidPlugin dp = null;
ActiveRecordPlugin ap = null;
try {
dp = new DruidPlugin(...);
ap = new ActiveRecordPlugin("getLedger", dp);
dp.start();
ap.start();
...
return
} finally {
ap.stop();
dp.stop();
ap = null; <-- 此处IDEA提示多余,但不这样写,总感觉没有释放掉
dp = null;
System.gc();
}
以上使用JMeter测试,10线程1秒时长,循环两次,测试时debug重启,还是会出现 Config already exists,将ActiveRecordPlugin的name改成uuid方式,则不再报错,但总感觉好像没有彻底释放,还有其他的什么方法没?

2019-10-29 09:37

stop()以后,会自动被回收吗?还是需要手工处理一下?

2019-10-28 17:45

我增加了try finally,应该能释放掉吧。或者我把名称改为唯一值(UUID?),这个只是多次被调用,调用时才连接数据并不再使用,或者 dp = null; 和 ap = null;一下,让JAVA自动回收?
场景是URL参数传递主连接数据表中查询到数据库名称,再连接查询到的数据库,使用完成后就不再使用。

2019-10-08 15:02

Connected to the target VM, address: '127.0.0.1:2836', transport: 'socket'
Starting JFinal 4.5 -> http://0.0.0.0:8124
Info: jfinal-undertow 1.9, undertow 2.0.25.Final, jvm 1.8.0_20
Starting Complete in 2.2 seconds. Welcome To The JFinal World (^_^)

Exception in thread "HotSwapWatcher" java.lang.RuntimeException: java.io.IOException: 函数不正确。


还是提示这个
另外,WIN7是虚拟机

2019-09-26 18:00

补充说明 :虽然提示这个错误,但整个程序不影响。

2019-07-23 10:57

把WARN改成INFO,就可以打印log.info

2018-06-06 09:47

这个字段名是个变量,可不可以按变量方式去调用模板?如果不行只能是拼接SQL语句了