// -------------------------------------------------------------- Variables
- protected static final int CACHE_SIZE =
+ private static final int CACHE_SIZE =
Integer.parseInt(System.getProperty("org.apache.tomcat.util.http.FastHttpDateFormat.CACHE_SIZE", "1000"));
/**
* HTTP date format.
*/
- protected static final SimpleDateFormat format =
+ private static final SimpleDateFormat format =
new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
/**
* The set of SimpleDateFormat formats to use in getDateHeader().
*/
- protected static final SimpleDateFormat formats[] = {
+ private static final SimpleDateFormat formats[] = {
new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US),
new SimpleDateFormat("EEEEEE, dd-MMM-yy HH:mm:ss zzz", Locale.US),
new SimpleDateFormat("EEE MMMM d HH:mm:ss yyyy", Locale.US)
};
- protected final static TimeZone gmtZone = TimeZone.getTimeZone("GMT");
+ private static final TimeZone gmtZone = TimeZone.getTimeZone("GMT");
/**
/**
* Instant on which the currentDate object was generated.
*/
- protected static long currentDateGenerated = 0L;
+ private static volatile long currentDateGenerated = 0L;
/**
* Current formatted date.
*/
- protected static String currentDate = null;
+ private static String currentDate = null;
/**
* Formatter cache.
*/
- protected static final ConcurrentHashMap<Long, String> formatCache =
+ private static final ConcurrentHashMap<Long, String> formatCache =
new ConcurrentHashMap<Long, String>(CACHE_SIZE);
/**
* Parser cache.
*/
- protected static final ConcurrentHashMap<String, Long> parseCache =
+ private static final ConcurrentHashMap<String, Long> parseCache =
new ConcurrentHashMap<String, Long>(CACHE_SIZE);
if ((now - currentDateGenerated) > 1000) {
synchronized (format) {
if ((now - currentDateGenerated) > 1000) {
- currentDateGenerated = now;
currentDate = format.format(new Date(now));
+ currentDateGenerated = now;
}
}
}