org.compass.core.converter.basic
Class ThreadSafeFormat

java.lang.Object
  extended by org.compass.core.converter.basic.ThreadSafeFormat

public class ThreadSafeFormat
extends Object

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

Format has a high overhead in creating and is not thread safe. To make best use of resources, the ThreadSafeFormat 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:
kimchy

Nested Class Summary
static interface ThreadSafeFormat.FormatterFactory
           
 
Constructor Summary
ThreadSafeFormat(int initialPoolSize, int maxPoolSize, ThreadSafeFormat.FormatterFactory formatterFactory)
           
 
Method Summary
 String format(Object obj)
           
 Object parse(String date)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadSafeFormat

public ThreadSafeFormat(int initialPoolSize,
                        int maxPoolSize,
                        ThreadSafeFormat.FormatterFactory formatterFactory)
Method Detail

format

public String format(Object obj)

parse

public Object parse(String date)
             throws ParseException
Throws:
ParseException


Copyright (c) 2004-2006 The Compass Project.