You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-dev@ws.apache.org by "Hang Sun (JIRA)" <ji...@apache.org> on 2009/01/28 00:40:59 UTC

[jira] Created: (MUSE-297) XsdUtils.getLocalTimeString not thread safe

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: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org


[jira] Commented: (MUSE-297) XsdUtils.getLocalTimeString not thread safe

Posted by "Chris Twiner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MUSE-297?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12667959#action_12667959 ] 

Chris Twiner commented on MUSE-297:
-----------------------------------

http://www.thedwick.com/blog/?p=131

its a performance pig to create one each use, so tls will be employed.

> 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: Chris Twiner
>            Priority: Blocker
>             Fix For: 2.2.1
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 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: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org


[jira] Updated: (MUSE-297) XsdUtils.getLocalTimeString not thread safe

Posted by "Chris Twiner (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MUSE-297?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chris Twiner updated MUSE-297:
------------------------------

    Fix Version/s: 2.2.1
         Assignee: Chris Twiner  (was: Dan Jemiolo)

Looks like a good candidate for 2.2.1 as its truly private, and only static methods access it.

> 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: Chris Twiner
>            Priority: Blocker
>             Fix For: 2.2.1
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 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: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org


[jira] Resolved: (MUSE-297) XsdUtils.getLocalTimeString not thread safe

Posted by "Chris Twiner (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MUSE-297?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chris Twiner resolved MUSE-297.
-------------------------------

    Resolution: Fixed

fixed in head, use tls wrapping function.  Also caching the tls instance for getLocalTimeString

> 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: Chris Twiner
>            Priority: Blocker
>             Fix For: 2.2.1
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 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: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org