class RecoveryExpectedNodesSysCheck extends AbstractSysNodeCheck {

    private final ClusterService clusterService;
    private final Settings settings;

    static final int ID = 1;
    private static final String DESCRIPTION = "It has been detected that the 'gateway.expected_data_nodes' setting " +
                                              "(or the deprecated 'gateway.recovery_after_nodes' setting) is not " +
                                              "configured or it does not match the actual number of (data) nodes in the cluster.";

    @Inject
    public RecoveryExpectedNodesSysCheck(ClusterService clusterService, Settings settings) {
        super(ID, DESCRIPTION, Severity.MEDIUM);
        this.clusterService = clusterService;
        this.settings = settings;
    }

    @Override
    public boolean isValid() {<FILL_FUNCTION_BODY>}

    private static boolean validate(int actualNodes, int expectedNodes) {
        return actualNodes == 1 || actualNodes == expectedNodes;
    }
}

        int actualNodes = clusterService.state().nodes().getDataNodes().size();
        int expectedNodes = GatewayService.EXPECTED_DATA_NODES_SETTING.get(settings);
        if (expectedNodes == -1) {
            // fallback to deprecated setting for BWC
            actualNodes = clusterService.state().nodes().getSize();
            expectedNodes = GatewayService.EXPECTED_NODES_SETTING.get(settings);
        }
        return validate(actualNodes, expectedNodes);
    
<methods>public boolean acknowledged() ,public void acknowledged(boolean) ,public java.lang.String nodeId() ,public java.lang.String rowId() ,public void setNodeId(java.lang.String) <variables>private static final java.lang.String LINK_PATTERN,private static final Function<List<java.lang.String>,java.lang.String> PK_FUNC,private boolean acknowledged,private java.lang.String nodeId,private java.lang.String rowId