提交 a73ec088 authored 作者: Thomas Mueller Graf's avatar Thomas Mueller Graf

Pull request #163: improved performance when not using the default timezone.

上级 d5b47315
...@@ -21,6 +21,8 @@ Change Log ...@@ -21,6 +21,8 @@ Change Log
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul> <ul>
<li>Pull request #163: improved performance when not using the default timezone.
</li>
<li>Local temporary tables with many rows did not work correctly due to automatic analyze. <li>Local temporary tables with many rows did not work correctly due to automatic analyze.
</li> </li>
<li>Server mode: concurrently using the same connection could throw an exception <li>Server mode: concurrently using the same connection could throw an exception
......
...@@ -73,12 +73,18 @@ public class DateTimeUtils { ...@@ -73,12 +73,18 @@ public class DateTimeUtils {
} }
/** /**
* Reset the calendar, for example after changing the default timezone. * Reset the cached calendar for default timezone, for example after
* changing the default timezone.
*/ */
public static void resetCalendar() { public static void resetCalendar() {
CACHED_CALENDAR.remove(); CACHED_CALENDAR.remove();
} }
/**
* Get a calendar for the default timezone.
*
* @return a calendar instance. A cached instance is returned where possible
*/
private static Calendar getCalendar() { private static Calendar getCalendar() {
Calendar c = CACHED_CALENDAR.get(); Calendar c = CACHED_CALENDAR.get();
if (c == null) { if (c == null) {
...@@ -89,8 +95,10 @@ public class DateTimeUtils { ...@@ -89,8 +95,10 @@ public class DateTimeUtils {
} }
/** /**
* Get a calendar for the given timezone.
*
* @param tz timezone for the calendar, is never null * @param tz timezone for the calendar, is never null
* @return a calendar instance for the specified timezone. A cached instance is returned where possible * @return a calendar instance. A cached instance is returned where possible
*/ */
private static Calendar getCalendar(TimeZone tz) { private static Calendar getCalendar(TimeZone tz) {
Calendar c = CACHED_CALENDAR_NON_DEFAULT_TIMEZONE.get(); Calendar c = CACHED_CALENDAR_NON_DEFAULT_TIMEZONE.get();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论