You are indeed correct, DiffTransactionState also takes responsibility for
firing events.
I experimented with pulling out just the locking, and introducing a "commit
writer" flag for COMMIT as a way for DiffTransactionState.commit() to avoid
wrappers. The result is here:
https://github.com/jodygarnett/geotools/tree/commit_flag if you would like
to look.
Jody
--
Jody Garnett
On 6 January 2015 at 12:35, Torben Barsballe <[email protected]>
wrote:
> Testing this, it looks like the requisite events are handled through
> DiffTransactionState, which causes ContentState to fire events on commit()
> etc.
> This is backed up by the fact that the
> ContentFeatureSourceEventsTest.testFeatureEventsWithTransaction test failed
> with extra events when this change was made.
>
> So I don't think we need to pull events out of the braces, just locking.
>
> Torben
>
> On Tue, Jan 6, 2015 at 11:55 AM, Jody Garnett <[email protected]>
> wrote:
>
>> Found an interesting glitch reviewing ContentFeatureStore that resolves
>> one of my long standing difficulties integrating uDig with modern versions
>> of GeoTools (I was always having trouble with events).
>>
>> Turns out due to a brace being in the wrong spot that rappers for events
>> and locking were not being applied.
>>
>> if (!canTransact() && transaction != null && transaction !=
>> Transaction.AUTO_COMMIT) {
>> ...
>> writer = new DiffContentFeatureWriter(this, state.getDiff(),
>> reader);
>> } else {
>> writer = getWriterInternal(query, flags);
>> if (!canEvent()){
>> writer = new EventContentFeatureWriter(this, writer );
>> }
>> if (!canFilter()) {
>> ..
>> }
>> if (!canLock()) {
>> ...
>> }
>> }
>>
>> The DiffContentFeatureWriter is not responsible for events and locking,
>> so the code should be:
>>
>> if (!canTransact() && transaction != null && transaction !=
>> Transaction.AUTO_COMMIT) {
>> ...
>> writer = new DiffContentFeatureWriter(this, state.getDiff(),
>> reader);
>> } else {
>> writer = getWriterInternal(query, flags);
>> if (!canFilter()) {
>> ..
>> }
>> }
>> if (!canEvent()){
>> writer = new EventContentFeatureWriter(this, writer );
>> }
>> if (!canLock()) {
>> ...
>> }
>> }
>>
>> Good times.
>> --
>> Jody Garnett
>>
>>
>> ------------------------------------------------------------------------------
>> Dive into the World of Parallel Programming! The Go Parallel Website,
>> sponsored by Intel and developed in partnership with Slashdot Media, is
>> your
>> hub for all things parallel software development, from weekly thought
>> leadership blogs to news, videos, case studies, tutorials and more. Take a
>> look and join the conversation now. http://goparallel.sourceforge.net
>> _______________________________________________
>> GeoTools-Devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>>
>>
>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel