[ https://issues.apache.org/jira/browse/RATIS-337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16634833#comment-16634833 ]
Tsz Wo Nicholas Sze commented on RATIS-337: ------------------------------------------- r337_20181001b.patch: leaderState and heartbeatMonitor are moved to RoleInfo which enforces null check by returning Optional. electionDaemon is moved as well although it does not have a bug. > In RaftServerImpl, leaderState/heartbeatMonitor may be accessed without > proper null check > ----------------------------------------------------------------------------------------- > > Key: RATIS-337 > URL: https://issues.apache.org/jira/browse/RATIS-337 > Project: Ratis > Issue Type: Bug > Components: server > Reporter: Tsz Wo Nicholas Sze > Assignee: Tsz Wo Nicholas Sze > Priority: Major > Attachments: r337_20181001b.patch > > > leaderState/heartbeatMonitor is declared as volatile. Some code like below > won't work since leaderState may be set to null in between. > {code:java} > //RaftServerImpl.checkLeaderState(..) > } else if (leaderState == null || !leaderState.isReady()) { > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)