com.thoughtworks.xstream.converters.basic
Class ThreadSafeSimpleDateFormat

java.lang.Object
  extended bycom.thoughtworks.xstream.converters.basic.ThreadSafeSimpleDateFormat

public class ThreadSafeSimpleDateFormat
extends java.lang.Object

Wrapper around java.text.SimpleDateFormat that can be called by multiple threads concurrently.

SimpleDateFormat has a high overhead in creating and is not thread safe. To make best use of resources, the ThreadSafeSimpleDateFormat provides a dynamically sizing pool of instances, each of which will only be called by a single thread at a time.

The pool has a maximum capacity, to limit overhead. If all instances in the pool are in use and another is required, it shall block until one becomes available.

Author:
Joe Walnes

Constructor Summary
ThreadSafeSimpleDateFormat(java.lang.String format, int initialPoolSize, int maxPoolSize)
           
 
Method Summary
 java.lang.String format(java.util.Date date)
           
 java.util.Date parse(java.lang.String date)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadSafeSimpleDateFormat

public ThreadSafeSimpleDateFormat(java.lang.String format,
                                  int initialPoolSize,
                                  int maxPoolSize)
Method Detail

format

public java.lang.String format(java.util.Date date)

parse

public java.util.Date parse(java.lang.String date)
                     throws java.text.ParseException
Throws:
java.text.ParseException


Joe Walnes, http://xstream.codehaus.org/