Skip to content

Feature/heartbeat transaction - #88

Merged
alanmasu merged 9 commits into
mainfrom
feature/heartbeatTransaction
Aug 24, 2026
Merged

Feature/heartbeat transaction#88
alanmasu merged 9 commits into
mainfrom
feature/heartbeatTransaction

Conversation

@alanmasu

Copy link
Copy Markdown
Owner

I fixed some static code analysis errors and applied the styling convention

@alanmasu
alanmasu marked this pull request as ready for review August 22, 2026 20:31
@alanmasu
alanmasu requested a review from Tech-Matt August 22, 2026 20:50
Comment thread src/main/java/it/unitn/ds/Replica.java Outdated
Comment on lines 194 to 196

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines repeted each time, should we move it on the onMessage function??

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that the guard is repeated. I would move only replicaStatus == CRASHED into onMessage path. I would keep heartbeatTransaction == null heartbeat-specific, because onMessage also handles other messages.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After merging #81 will be removed completely the method, and di per se there is no error if we don't check the non-null value of the heartbeatTransaction

Comment thread src/main/java/it/unitn/ds/HeartbeatTransaction.java Outdated
Comment thread src/main/java/it/unitn/ds/Replica.java Outdated
Comment on lines 194 to 196

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that the guard is repeated. I would move only replicaStatus == CRASHED into onMessage path. I would keep heartbeatTransaction == null heartbeat-specific, because onMessage also handles other messages.

Comment on lines -312 to -315
// The scheduled timeout has fired, so no active scheduled timeout remains.
timeout = null;


Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the watchdog timer fires, line 262 changes the state to ELECTION_REQUESTED, but timeout still points to the timer that has already finished. Current behavior seems fine, but setting timeout = null here would make it clear that no timer is active anymore. Could we keep that line?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is violating the Static Code Analysis, if is not strict necessary I would remove it, if you think is necessary a better solution will be to change it from Cancellable to Optional<Cancellable> and use this API.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you find other occurences of this "error" please telll me!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is actually fine, we can remove it

@alanmasu
alanmasu requested a review from Tech-Matt August 23, 2026 13:21

@Tech-Matt Tech-Matt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job, no new feedback from me. We can merge!

@alanmasu
alanmasu merged commit 84846dc into main Aug 24, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from In review to Done in Distributed Systems Project Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants