On Wednesday, November 6, 2002, 4:05:45 PM, Antoni wrote:
AR> Hi, I don't speak english very very well, so this is a bit AR> difficult for me to explain, but I'll try ;-) .... No problem. Most American's don't speak English very well (including myself I'm sure:) AR> I have'nt looked at the beanutils Converter registration, do you have to AR> register a class or an instance? It registers an instance one time in the static block at the top of the action: static { DateBeanUtilsConverter dateConverter = new DateBeanUtilsConverter(); dateConverter.setFormatPattern( "MMddyyyy" ); StringBeanUtilsConverterDate myStringConverter = new StringBeanUtilsConverterDate(); myStringConverter.setFormatPattern( "MMddyyyy" ); ConvertUtils.register( dateConverter, java.util.Date.class ); ConvertUtils.register( myStringConverter, String.class ); } AR> The problem here is that if there is only one instance of your class, and AR> setFormatPattern is only called once, then if there are two request that AR> require the use of your class a the same time, served by different threads, AR> the parse method in your instance of SimpleDateFormat might be called AR> concurrently, so (as it isn't thread save) it might fail. I'm not sure how this would happen as Eddie have both pointed out that the static block will only get called one time regardless of how many instances are created (at least on a single JVM I'm pretty sure that's the case). (On top of that I'm pretty sure on one JVM user's all share one servlet instance unless you maybe use that SingleThreadModel which I think hands them out from a pool. Moot point though I think if I do the stuff in the static block. But I could be wrong). -- Rick mailto:maillist@;reumann.net -- To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>