Skip to content

Commit

Permalink
lock the channel around the handler operation, #97
Browse files Browse the repository at this point in the history
The issue is caused by the fact that the channel cache entries
are written to the database, but are not committed. The second
operation gets woken up by the lock manager too early. The first
operation opens the transaction before locking the channel, which,
as of now, also closes the transaction _after_ releasing the lock.
  • Loading branch information
ctron committed Jun 1, 2015
1 parent 0893e09 commit 27e4e22
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -377,12 +377,16 @@ public List<ChannelAspectInformation> getChannelAspectInformations ( final Strin
@Override
public void addChannelAspect ( final String channelId, final String aspectFactoryId, final boolean withDependencies )
{
doWithHandlerVoid ( ( handler ) -> handler.addChannelAspects ( channelId, Collections.singleton ( aspectFactoryId ), withDependencies ) );
this.lockManager.modifyRun ( channelId, () -> {
doWithHandlerVoid ( ( handler ) -> handler.addChannelAspects ( channelId, Collections.singleton ( aspectFactoryId ), withDependencies ) );
} );
}

public void addChannelAspects ( final String channelId, final Set<String> aspectFactoryIds, final boolean withDependencies )
{
doWithHandlerVoid ( ( handler ) -> handler.addChannelAspects ( channelId, aspectFactoryIds, withDependencies ) );
this.lockManager.modifyRun ( channelId, () -> {
doWithHandlerVoid ( ( handler ) -> handler.addChannelAspects ( channelId, aspectFactoryIds, withDependencies ) );
} );
}

@Override
Expand Down

0 comments on commit 27e4e22

Please sign in to comment.