[
http://jira.codehaus.org/browse/XFIRE-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_97910
]
Tatu Saloranta commented on XFIRE-1001:
---------------------------------------
Hmmh. This is unfortunate -- I was hoping sjsxp didn't try to be too smart. But
I think that it does try to actually reuse stream reader instances, which (in
my opinion) is not the best level at which to reuse objects, and leads to
problems like this.
But even if it does that, it should (once again, IMO) do synchronization at
factory level, given that resulting problems are rather hard to track down
otherwise. Finally, the behavior could of course be documented... except that
Sjsxp is kind of hidden within JDK, so there's no good place to add such notes
for users.
Anyway, it is true that implementations are not required to be thread-safe. I
wish specification did mandate thread-safety; but fortunately cost of
synchronizing on input factory for construction is relatively inexpensive. So
perhaps XFire needs to add that synchronization given Sjsxp behavior, and the
fact it's bundled with Java 6.
> Concurrency issue in StaxUtils.createXMLStreamReader
> ----------------------------------------------------
>
> Key: XFIRE-1001
> URL: http://jira.codehaus.org/browse/XFIRE-1001
> Project: XFire
> Issue Type: Bug
> Components: Core
> Affects Versions: 1.2.6
> Environment: Windows XP, Java 5 update 9
> Reporter: Walter Seymore
> Assignee: Dan Diephouse
> Attachments: HelloWorldClient.java, HelloWorldService.java
>
>
> I've created a simple HelloWorld service that echoes a name back to the
> client. This works fine until i create 2 or more threads that calls the
> service at the same time. Every now and then, I get an XML parsing error. The
> content of the request is always correct however and making this small change
> to StaxUtils fixes the issue.
> 759 synchronized(factory) {
> 760 return factory.createXMLStreamReader(in, encoding);
> 761 }
> So this would indicate that it is not safe to use the same XMLInputFactory
> instance in a multi-threaded way. Obviously synchronisation is not an optimal
> solution, but hopefully you guys can think of something better :).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email