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> abstract class RelationshipCursor extends RelationshipRecord implements RelationshipDataAccessor, RelationshipVisitor<RuntimeException>
{ {
Read read; Read read;
private HasChanges hasChanges = HasChanges.MAYBE; private boolean hasChanges;
private boolean checkHasChanges;


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


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


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


// Load transaction state using RelationshipVisitor // Load transaction state using RelationshipVisitor
Expand Down

0 comments on commit 496f1ba

Please sign in to comment.