chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Florian Müller (JIRA) <j...@apache.org>
Subject [jira] [Commented] (CMIS-432) AbstractCmisService is not thread safe
Date Tue, 20 Sep 2011 10:35:09 GMT

    [ https://issues.apache.org/jira/browse/CMIS-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13108497#comment-13108497
] 

Florian Müller commented on CMIS-432:
-------------------------------------

(Abstract)CmisService is not meant to be thread-safe. CmisServiceFactory.getService() is suposed
to provide a CmisService object for one call, handled in one thread. The CmisService object
can be reused but not used for two calls at the same time. Doing that might lead to wrong
results since different users might have different views on the same set of CMIS objects.

> AbstractCmisService is not thread safe
> --------------------------------------
>
>                 Key: CMIS-432
>                 URL: https://issues.apache.org/jira/browse/CMIS-432
>             Project: Chemistry
>          Issue Type: Improvement
>          Components: opencmis-commons
>    Affects Versions: OpenCMIS 0.5.0
>            Reporter: Carlo Sciolla
>              Labels: concurrency, multithread, thread-safety
>
> The use of an unsynchronized HashMap for storing AbstractCmisService.objectInfoMap (see
AbstractCmisService.getObjectInfoMap) makes it inherently thread unsafe. When extending that
class, we ran in busy waits on HashMap.get, which we fixed overriding the following two methods
to which we added the {{syncronized}} bit:
> {code:java}
>     @Override
>     public synchronized ObjectInfo getObjectInfo(String repositoryId, String objectId)
{
>         return super.getObjectInfo(repositoryId, objectId);
>     }
>     @Override
>     public synchronized void addObjectInfo(ObjectInfo objectInfo) {
>         super.addObjectInfo(objectInfo);
>     }
> {code}
> It would still be nice if thread safety is provided by the library itself without the
need for external synchronization.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message