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

A. Soroka commented on JENA-1536:
---------------------------------

{{synchronized}} seems much too strong here-- it makes everyone (including 
single-threaded applications) pay the cost. I think the right approach here is 
to pass a thread-safe {{Collection}} into the constructor.

In your example, that would occur if {{TriplestoreResourceService}} used the 
constructor {{QuadDataAcc(List)}} with an appropriate thread-safe {{List}}.

 

> unsynchronized collection in jena.atlas.lib.SinkToCollection causes 
> ArrayIndexOutOfBoundsException
> --------------------------------------------------------------------------------------------------
>
>                 Key: JENA-1536
>                 URL: https://issues.apache.org/jira/browse/JENA-1536
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: Base
>            Reporter: Christopher Johnson
>            Priority: Major
>         Attachments: AtlasSinkNonSynchronizedCollectionException.txt
>
>
> Attached is a stack trace that shows the issue. 
> [^AtlasSinkNonSynchronizedCollectionException.txt]
> This is produced by a repeated client test through
> {noformat}
> RDFConnection.update{noformat}
> via this [Trellis 
> method|https://github.com/trellis-ldp/trellis/blob/master/components/triplestore/src/main/java/org/trellisldp/triplestore/TriplestoreResourceService.java#L212-L227]
>  that streams quads quite fast.  
> Changing the method signature to this:
> {code:java}
> @Override
> public synchronized void send(T item) { c.add(item); }{code}
> Solves the problem for me.
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to