XsdUtils.getLocalTimeString not thread safe
-------------------------------------------

                 Key: MUSE-297
                 URL: https://issues.apache.org/jira/browse/MUSE-297
             Project: Muse
          Issue Type: Bug
          Components: WSDM Event Format (WEF)
    Affects Versions: 2.2.0
         Environment: Discovered on MacOS 10.5.5. But I believe it happens on 
all platforms
            Reporter: Hang Sun
            Assignee: Dan Jemiolo
            Priority: Blocker


The XsdUtils class uses a static SimpleDateFormat object to format date objects 
(see below). According to JDK:

>>>
Synchronization

Date formats are not synchronized. It is recommended to create separate format 
instances for each thread. If multiple threads access a format concurrently, it 
must be synchronized externally.
<<<

We did observe strange exceptions from that class when the code runs in 
multi-threaded environment. This forces us to put a hard sync. on unmarshal 
ManagementEvent objects.

------
public class XsdUtils
{
    //
    // Used to format dates in the XMLSchema dateTime format
    //
    private static DateFormat _FORMATTER =
        new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
    

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to