Java Calendar Create getCalendar()

Here you can find the source of getCalendar()

Description

get Calendar

License

Mozilla Public License

Declaration

private static Calendar getCalendar() 

Method Source Code

//package com.java2s;
/*// w  w  w . j av a 2 s.  c om
 * Copyright 2004-2014 H2 Group. Multiple-Licensed under the MPL 2.0,
 * and the EPL 1.0 (http://h2database.com/html/license.html).
 * Initial Developer: H2 Group
 * Iso8601:
 * Initial Developer: Robert Rathsack (firstName dot lastName at gmx dot de)
 */

import java.util.Calendar;

public class Main {
    /**
     * The thread local. Can not override initialValue because this would result
     * in an inner class, which would not be garbage collected in a web
     * container, and prevent the class loader of H2 from being garbage
     * collected. Using a ThreadLocal on a system class like Calendar does have
     * that problem, and while it is still a small memory leak, it is not a
     * class loader memory leak.
     */
    private static final ThreadLocal<Calendar> CACHED_CALENDAR = new ThreadLocal<Calendar>();

    private static Calendar getCalendar() {
        Calendar c = CACHED_CALENDAR.get();
        if (c == null) {
            c = Calendar.getInstance();
            CACHED_CALENDAR.set(c);
        }
        return c;
    }
}

Related

  1. createIsoCalendar()
  2. createResetCalendar()
  3. createTimestampStr(Calendar para_calendar)
  4. getCalendar()
  5. getCalendar()
  6. getCalendar()
  7. getCalendar()
  8. getCalendar()
  9. getCalendar()