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

Andy Seaborne edited comment on JENA-120 at 9/21/11 4:22 PM:
-------------------------------------------------------------

BindingKey don't mutate if everything is working because the Binding they 
depend on should not change.  

Bindings are create-once objects, the whole parent hierarchy helps that.  
Changing a binding, not extending is via the partent mechanism, must only be 
done in one step of the execution (e.g. a BGP evaluation or an assignment).  
Once let out, it should be unchanging.

We can fix up the codebase to force this by removing .add and .addAll in 
interface Binding.

A common pattern is 

Binding b = new BindingMap(input) ;

and we just need to have:

BindingMap b = new BindingMap(input) ;

and/or BindingFactory.create() -> BindingMutable that does have .add/.addAll.


      was (Author: andy.seaborne):
    BindingKey don't mutate if everything is working because the Binding they 
depend on should not change.  

Bindings are create-once objects, the whole parent hierarchy helps that.  
Changing a binding, not extending is via the partent mechanism, must only be 
done in one step of the execution (e.g. a BGP evaluation or an assignment).  
Once let out, it should be unchanging.

We can fix up the codebase to force this by removing .add and .addAll in 
interface Binding.

A common pattern is 

Binding b = new BindingMap(input) ;

and we just need to have:

BindingMap b = new BindingMap(input) ;

  
> Query objects with aggregators cannot be reused
> -----------------------------------------------
>
>                 Key: JENA-120
>                 URL: https://issues.apache.org/jira/browse/JENA-120
>             Project: Jena
>          Issue Type: Bug
>          Components: ARQ
>            Reporter: Stephen Allen
>            Assignee: Andy Seaborne
>            Priority: Minor
>         Attachments: JENA-120-r1173178.patch, JENA-120-r1173729.patch, 
> JENA-120-r1173738.patch
>
>
> Query objects that contain aggregators (Group By) cannot be reused by 
> different threads because the internal state is mutable.  Even reusing a 
> query object in the same thread has problems, because it creates a new 
> Aggregator object each time you execute the query.  Users may want to reuse 
> Query objects to save having to reparse the query string.
> I believe the solution is to copy the aggregators when compiling the query.  
> I've attached a patch that does that in the 
> AlgebraGenerator.compileModifiers() method.
> See the thread at [1] for more discussion.
> [1] 
> http://mail-archives.apache.org/mod_mbox/incubator-jena-users/201109.mbox/%3cb60aca3a-db31-4fec-a72e-d81a5c2ab...@knublauch.com%3E

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

        

Reply via email to