package edu.nyu.cs9053.concurrency.threadconfinement;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * User: blangel
 * Date: 11/9/14
 * Time: 6:05 PM
 */
public class ThreadConfinement {

    private static final String FORMAT = "dd/mm/yyyy";

    private final ThreadLocal<SimpleDateFormat> formatter = new ThreadLocal<SimpleDateFormat>() {
        @Override protected SimpleDateFormat initialValue() {
            return new SimpleDateFormat(FORMAT);
        }
    };

    public String format(Date date) {
        return formatter.get().format(date);
    }

}
