SpEL getValue()函数随着时间的推移而变慢

时间:2017-12-23 17:24:26

标签: java tomcat tomcat8 spring-el

我正在尝试评估某些表达式,这些表达式正在比较两个日期,然后在某些字段中添加值作为结果。

例如,[${Submission Date} != null] ? ([${Submission Date} > ${Due Date}] ..然后sum(${30},${83030},${4040},${83040})

当我重新启动tomcat(version: 8.5.24)时,我在2秒内从SpelExpression.getValue()函数得到结果,但每当我重新提交时再次调用相同的request( SpelExpression.getValue()时,时间从2开始增加到4到5到6 ......它会继续增加。

在其中一个生产服务器中,我发现这个函数的响应在10分钟内完成,当我重新启动tomcat时,一切都运行正常,因为前几个请求。 应用日志后,我发现这个getValue()函数是罪魁祸首。

我正在使用Spring 4和java 7。

为什么这个功能会随着时间的推移而变慢?

以下是表达式:

@expressionEvaluatorService.evaluateSubExpression(#expr1,#params,#entityContext,#errorConditions,#entityFields) ? (@expressionEvaluatorService.evaluateSubExpression(#expr2,#params,#entityContext,#errorConditions,#entityFields) ? T(com.sirionlabs.service.ExpressionEvaluatorServiceImpl).duration(#F1047,#med41806) :  T(com.sirionlabs.service.ExpressionEvaluatorServiceImpl).duration(#F1046,#med41806) ) :  (@expressionEvaluatorService.evaluateSubExpression(#expr3,#params,#entityContext,#errorConditions,#entityFields) ? T(com.sirionlabs.service.ExpressionEvaluatorServiceImpl).duration(#F1047,#med41806): 0)

和上下文是:

0 = {HashMap$Entry@24411} "ssd41780" -> "Fri Dec 22 10:40:57 IST 2017"
 1 = {HashMap$Entry@24412} "F100118" -> "20230111"
 2 = {HashMap$Entry@24413} "F100117" -> "20230125"
 3 = {HashMap$Entry@24414} "ssd41755" -> "Wed Dec 20 17:09:55 IST 2017"
 4 = {HashMap$Entry@24415} "F100113" -> "0"
 5 = {HashMap$Entry@24416} "entity" -> "ChildDNO[dnoStatus=<null>,dnoType=Disaster Recovery/Business Continuity,dno=<null>,pageRefrences=[com.sirionlabs.model.PageReference@26c6083],performanceStatus=<null>,weekTypeObject=com.sirionlabs.bentity.admin.IdName@31086ff9,clientOwner=<null>,vendorOwner=<null>,escalationOwner=<null>,type=<null>,clause=<null>,sharedWith=<null>,sharedBy=<null>,responsibility=com.sirionlabs.bentity.admin.IdName@27df7a,revisedDueDate=<null>,currency=Currency[linkContractCurrencies=<null>,masterRegions=<null>,value=<null>,integrationSystem=<null>,oldSystemId=<null>,dynamicMetadata=<null>,dynamicMetadataJson=<null>,parentEntityTypeId=<null>,actualParentEntityId=<null>,actualParentEntityTypeId=<null>,parentEntityId=<null>,rootInfo=<null>,draft=<null>,privateCommunication=<null>,entitySpecificType=<null>,blocked=false,parentEntity=<null>,sourceEntity=<null>,entityContract=<null>,entityRelation=<null>,autoCreateEntities=<null>,entityId=<null>,currentFeatureVersion=<null>,entityType=<null>,actio
 6 = {HashMap$Entry@24417} "ssd41759" -> "Fri Dec 22 10:40:28 IST 2017"
 7 = {HashMap$Entry@24418} "F100323" -> "73"
 8 = {HashMap$Entry@24419} "msd41755" -> "Thu Dec 21 00:00:00 IST 2017"
 9 = {HashMap$Entry@24420} "F100327" -> "20221214"
 10 = {HashMap$Entry@24421} "med41788" -> "Thu Jan 18 14:20:40 IST 2018"
 11 = {HashMap$Entry@24422} "sed41780" -> "Thu Jan 18 14:18:14 IST 2018"
 12 = {HashMap$Entry@24423} "t41780" -> " size = 58"
 13 = {HashMap$Entry@24424} "ssd41788" -> "Fri Dec 22 10:41:18 IST 2017"
 14 = {HashMap$Entry@24425} "med41780" -> "Thu Jan 18 14:18:14 IST 2018"
 15 = {HashMap$Entry@24426} "sed41788" -> "Thu Jan 18 14:20:40 IST 2018"
 16 = {HashMap$Entry@24427} "med41806" -> "2018-01-18T14:20:41.614Z"
 17 = {HashMap$Entry@24428} "F119" -> "null"
 18 = {HashMap$Entry@24429} "F100195" -> "20170101"
 19 = {HashMap$Entry@24430} "F100166" -> 
 20 = {HashMap$Entry@24431} "F11720" -> "null"
 21 = {HashMap$Entry@24432} "med41759" -> "Fri Dec 22 10:40:28 IST 2017"
 22 = {HashMap$Entry@24433} "F100122" -> "false"
 23 = {HashMap$Entry@24434} "t41788" -> " size = 58"
 24 = {HashMap$Entry@24435} "sed41755" -> "Wed Dec 20 17:09:55 IST 2017"
 25 = {HashMap$Entry@24436} "F1047" -> "Wed Dec 14 23:59:59 IST 2022"
 26 = {HashMap$Entry@24437} "sed41759" -> "Fri Dec 22 10:40:28 IST 2017"
 27 = {HashMap$Entry@24438} "msd41788" -> "Fri Dec 22 10:41:18 IST 2017"
 28 = {HashMap$Entry@24439} "med41755" -> "Thu Dec 21 00:00:00 IST 2017"
 29 = {HashMap$Entry@24440} "F1046" -> "Thu Jan 18 23:59:59 IST 2018"
 30 = {HashMap$Entry@24441} "entityContext" -> 
 31 = {HashMap$Entry@24442} "msd41780" -> "Fri Dec 22 10:40:57 IST 2017"
 32 = {HashMap$Entry@24443} "F11036" -> "null"
 33 = {HashMap$Entry@24444} "errorConditions" -> " size = 0"
 34 = {HashMap$Entry@24445} "F1060" -> "null"
 35 = {HashMap$Entry@24446} "t41759" -> " size = 1"
 36 = {HashMap$Entry@24447} "expr3" -> "${Due Date} <'current_date'"
 37 = {HashMap$Entry@24448} "F1023" -> "null"
 38 = {HashMap$Entry@24449} "expr1" -> "${Submission Date} != null"
 39 = {HashMap$Entry@24450} "F1024" -> "null"
 40 = {HashMap$Entry@24451} "expr2" -> "${Submission Date} > ${Due Date}"
 41 = {HashMap$Entry@24452} "t41755" -> " size = 1"
 42 = {HashMap$Entry@24453} "ssd41766" -> "Fri Dec 22 10:40:44 IST 2017"
 43 = {HashMap$Entry@24454} "med41766" -> "Fri Dec 22 10:40:44 IST 2017"
 44 = {HashMap$Entry@24455} "sed41766" -> "Fri Dec 22 10:40:44 IST 2017"
 45 = {HashMap$Entry@24456} "F1156" -> "null"
 46 = {HashMap$Entry@24457} "F1157" -> "null"
 47 = {HashMap$Entry@24458} "F1158" -> "Wed Dec 14 23:59:59 IST 2022"
 48 = {HashMap$Entry@24459} "t41766" -> " size = 1"
 49 = {HashMap$Entry@24460} "msd41766" -> "Fri Dec 22 10:40:44 IST 2017"
 50 = {HashMap$Entry@24461} "params" -> " size = 48"
 51 = {HashMap$Entry@24462} "msd41759" -> "Fri Dec 22 10:40:28 IST 2017"
 52 = {HashMap$Entry@24463} "F417" -> "null"
 53 = {HashMap$Entry@24464} "entityFields" -> " size = 148"
 54 = {HashMap$Entry@24465} "F1061" -> "Thu Jan 18 23:59:59 IST 2018"

1 个答案:

答案 0 :(得分:0)

我最终找到了一个解决方案,我使用4.0.0版本的弹簧版本有一个错误.RELEASE,我将它升级到4.0.2并且工作正常。