Tomcat hangs up TimeZone call

I have this problem that reduces production. On an AWS / Ubuntu / Tomcat stack, a processor running Tomcat jumps to 100%, and when I get a stream dump, this part of the code is constantly blocked in exactly the same place. (Everyone else is blocked and waiting.)

"TP-Processor6" daemon prio=10 tid=0x0000000041ec2800 nid=0x41c4 runnable [0x00007f70194b5000] java.lang.Thread.State: RUNNABLE at sun.util.calendar.ZoneInfo.getTransitionIndex(ZoneInfo.java:322) at sun.util.calendar.ZoneInfo.getOffsets(ZoneInfo.java:248) at sun.util.calendar.ZoneInfo.getOffsets(ZoneInfo.java:225) at java.util.GregorianCalendar.computeFields(GregorianCalendar.java:2024) at java.util.GregorianCalendar.computeFields(GregorianCalendar.java:1996) at java.util.Calendar.setTimeInMillis(Calendar.java:1109) at java.util.GregorianCalendar.<init>(GregorianCalendar.java:576) at java.util.Calendar.createCalendar(Calendar.java:1011) at java.util.Calendar.getInstance(Calendar.java:948) at com.xxx.core.util.DateUtil.modifyDate(DateUtil.java:385) at com.xxx.core.util.DateUtil.getDayDate(DateUtil.java:563) at com.xxx.core.util.DateUtil.getDayDate(DateUtil.java:573) at com.xxx.core.util.DateUtil.getDayDate(DateUtil.java:569) at com.xxx.core.util.DateUtil.splitByDays(DateUtil.java:496) at com.xxx.core.util.DateUtil.splitDateIntervalByIntervals(DateUtil.java:474) at com.xxx.core.util.DateUtil.splitDateIntervalByIntervals(DateUtil.java:436) 
+4
source share
1 answer

Wrap up a little better to find out what's going on here.

Make sure your instance sets the correct encoding and local system, tomcat container, application. Set to GMT as the standard and try:

 Calendar.getInstance ("GMT-0", Locale.US); // verify inputs 

If you get a copy of the Calendar, why are you resetting the date explicitly? Why not just create a new calendar? Then you will create a new calendar:

 Calendar cal = new Calendar (TimeZone zone, Locale aLocale); // new cal.setTimeZone("GMT-0"); cal.setTimeInMillis(System.currentTimeMillis ()); 

Calendar and Date objects are relatively flexible in Java, so you can change their functioning. I assume that there might be something inappropriate in the environment variables or the container, such as Local or encoding, that contradict what is being done with the Calendar instance. Try explicitly specifying everything.

This is my best intuition.

+1
source

All Articles