Description
The constant value used in getProxy() in HAAdmin.java should be configurable
In HAAdmin.java, the "HAServiceTarget.getProxy()" is used 6 times. In 3 times of usage in method "getAllServiceState()", "getServiceState()" and "checkHealth()", the timeout as the second parameter is configurable (with configuration option "ha.failover-controller.cli-check.rpc-timeout.ms").
... rpcTimeoutForChecks = conf.getInt( CommonConfigurationKeys.HA_FC_CLI_CHECK_TIMEOUT_KEY, CommonConfigurationKeys.HA_FC_CLI_CHECK_TIMEOUT_DEFAULT);
protected int getAllServiceState() { ... HAServiceProtocol proto = target.getProxy(getConf(), rpcTimeoutForChecks); ... }
private int checkHealth(final CommandLine cmd) throws IOException, ServiceFailedException { ... HAServiceProtocol proto = resolveTarget(argv[0]).getProxy( getConf(), rpcTimeoutForChecks); ... }
private int getServiceState(final CommandLine cmd) throws IOException, ServiceFailedException { ... HAServiceProtocol proto = resolveTarget(argv[0]).getProxy( getConf(), rpcTimeoutForChecks); ... }
However, the other 3 times of usage is not configurable in method "transitionToActive()", "isOtherTargetNodeActive()", and "transitionToStandby()". The constants used in "HAServiceTarget.getProxy()" in these three method are 0, 5000, and 0.
private int transitionToActive(final CommandLine cmd) throws IOException, ServiceFailedException { ... HAServiceProtocol proto = target.getProxy( getConf(), 0); ... }
private boolean isOtherTargetNodeActive(String targetNodeToActivate, boolean forceActive) throws IOException { ... HAServiceProtocol proto = target.getProxy(getConf(), 5000); ... }
private int transitionToStandby(final CommandLine cmd) throws IOException, ServiceFailedException { ... HAServiceProtocol proto = target.getProxy( getConf(), 0); ... }
I think this three constant should also be configurable, since there are no difference from the former ones.