class GlobalMasterInfo {

    private final static NodeInfo NO_MASTER = new NodeInfo(false, "");

    private volatile boolean supportElection;
    private volatile NodeInfo masterNodeInfo;

    private volatile Id nodeId;
    private volatile NodeRole nodeRole;

    public GlobalMasterInfo() {
        this(NO_MASTER);
    }

    public GlobalMasterInfo(NodeInfo masterInfo) {
        this.supportElection = false;
        this.masterNodeInfo = masterInfo;

        this.nodeId = null;
        this.nodeRole = null;
    }

    public void supportElection(boolean featureSupport) {
        this.supportElection = featureSupport;
    }

    public boolean supportElection() {
        return this.supportElection;
    }

    public void resetMasterInfo() {
        this.masterNodeInfo = NO_MASTER;
    }

    public void masterInfo(boolean isMaster, String nodeUrl) {<FILL_FUNCTION_BODY>}

    public NodeInfo masterInfo() {
        return this.masterNodeInfo;
    }

    public Id nodeId() {
        return this.nodeId;
    }

    public NodeRole nodeRole() {
        return this.nodeRole;
    }

    public void initNodeId(Id id) {
        this.nodeId = id;
    }

    public void initNodeRole(NodeRole role) {
        E.checkArgument(role != null, "The server role can't be null");
        E.checkArgument(this.nodeRole == null,
                        "The server role can't be init twice");
        this.nodeRole = role;
    }

    public void changeNodeRole(NodeRole role) {
        E.checkArgument(role != null, "The server role can't be null");
        this.nodeRole = role;
    }

    public static GlobalMasterInfo master(String nodeId) {
        NodeInfo masterInfo = new NodeInfo(true, nodeId);
        GlobalMasterInfo nodeInfo = new GlobalMasterInfo(masterInfo);
        nodeInfo.nodeId = IdGenerator.of(nodeId);
        nodeInfo.nodeRole = NodeRole.MASTER;
        return nodeInfo;
    }

    public static class NodeInfo {

        private final boolean isMaster;
        private final String nodeUrl;

        public NodeInfo(boolean isMaster, String url) {
            this.isMaster = isMaster;
            this.nodeUrl = url;
        }

        public boolean isMaster() {
            return this.isMaster;
        }

        public String nodeUrl() {
            return this.nodeUrl;
        }
    }
}

        // final can avoid instruction rearrangement, visibility can be ignored
        this.masterNodeInfo = new NodeInfo(isMaster, nodeUrl);
    
<no_super_class>