Skip to content

Commit

Permalink
More primitive RelationshipCursor.hasChanges implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
fickludd committed Mar 1, 2018
1 parent e476d09 commit 496f1ba
Showing 1 changed file with 8 additions and 12 deletions.
Expand Up @@ -28,7 +28,8 @@
abstract class RelationshipCursor extends RelationshipRecord implements RelationshipDataAccessor, RelationshipVisitor<RuntimeException>
{
Read read;
private HasChanges hasChanges = HasChanges.MAYBE;
private boolean hasChanges;
private boolean checkHasChanges;

RelationshipCursor()
{
Expand All @@ -38,7 +39,7 @@ abstract class RelationshipCursor extends RelationshipRecord implements Relation
protected void init( Read read )
{
this.read = read;
this.hasChanges = HasChanges.MAYBE;
this.checkHasChanges = true;
}

@Override
Expand Down Expand Up @@ -103,22 +104,17 @@ public long propertiesReference()
*/
protected boolean hasChanges()
{
if ( hasChanges == HasChanges.MAYBE )
if ( checkHasChanges )
{
boolean changes = read.hasTxStateWithChanges();
if ( changes )
hasChanges = read.hasTxStateWithChanges();
if ( hasChanges )
{
collectAddedTxStateSnapshot();
hasChanges = HasChanges.YES;
}
else
{
hasChanges = HasChanges.NO;
}
return changes;
checkHasChanges = false;
}

return hasChanges == HasChanges.YES;
return hasChanges;
}

// Load transaction state using RelationshipVisitor
Expand Down

0 comments on commit 496f1ba

Please sign in to comment.