[
https://issues.apache.org/jira/browse/UIMA-1153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12624480#action_12624480
]
Marshall Schor commented on UIMA-1153:
--------------------------------------
If UIMA-1149 is implemented such that no synchronization is needed because the
framework implicitly will be locking calls to flow controller methods and flow
object methods on the associated flow controller instance, then, this Jira
should have as its action to simplify the examples by removing the
synchronization - it will no longer be needed :-).
> thread safety issue with sample flow controller AdvancedFixedFlowController
> ---------------------------------------------------------------------------
>
> Key: UIMA-1153
> URL: https://issues.apache.org/jira/browse/UIMA-1153
> Project: UIMA
> Issue Type: Bug
> Components: Async Scaleout, Examples
> Affects Versions: 2.2.2
> Reporter: Marshall Schor
> Priority: Minor
>
> The AdvancedFixedFlowController implements its Flow Object class as an inner
> class of its Flow Controller class.
> In UIMA-AS, it is possible that more than one Flow Object can be accessing
> the Flow Controller fields on different threads, and (for Cas Multipliers) it
> is possible for an individual Flow Object to be called on multiple threads at
> the same time (via the method (via the newCasProduced method).
> In the example, the newCasProduced method is marked *synchronized*, so I
> think the same Flow Object will not be running multiple threads at the same
> time, because the other methods to this are all calls done on 1 thread on
> behalf of the main CAS associated with this Flow Object.
> However, multiple flow objects running on different threads could have their
> newCasProduced method called. In this case, the references in that method to
> common mutable fields in the shared Flow Controller object are not
> synchronized. This code should be fixed so that those references are
> synchronized on the same monitor used to synchronize other field access in
> the Flow Controller. UIMA-1149 I hope will use the class instance of the
> flow controller for this purpose, and, assuming that it does, this code
> should explicitly synchronize on that same object, for references to mutable
> fields in that class. There is one field, mSequence, which is in the
> associated Flow Controller class, which is mutable (in theory). References
> to this field should be synchronized with the same monitor used by the flow
> controller class when manipulating it.
> The other field references in the flow object should be checked, and
> synchronized if they refer to mutable Flow Controller fields.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.