Java Date Format Pattern toThreadSafeFormat(final String format)

Here you can find the source of toThreadSafeFormat(final String format)

Description

to Thread Safe Format

License

Open Source License

Declaration

private static ThreadLocal<SimpleDateFormat> toThreadSafeFormat(final String format) 

Method Source Code


//package com.java2s;
/*// w w w.java2s. c  om
 * This file is part of ConfigHub.
 *
 * ConfigHub is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * ConfigHub is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.??See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with ConfigHub.??If not, see <http://www.gnu.org/licenses/>.
 */

import java.text.SimpleDateFormat;

public class Main {
    private static ThreadLocal<SimpleDateFormat> toThreadSafeFormat(final String format) {
        return new ThreadLocal<SimpleDateFormat>() {
            @Override
            protected SimpleDateFormat initialValue() {

                return new SimpleDateFormat(format);
            }
        };
    }
}

Related

  1. log(String format, Object... args)
  2. logFormat(String msg)
  3. subFiles(String formatString, File[] files)
  4. subtraiHora(String horaFim, String horaIni, String formatoHora)
  5. sysdateStringddMMyyyyhhmmss()
  6. traceInformation(String message)