Currently the DistCpOptions class encapsulates all DistCp options, which may be set from command-line (via the OptionsParser) or may be set manually (eg construct an instance and call setters). As there are multiple option fields and more (e.g. HDFS-9868, HDFS-10314) to add, validating them can be cumbersome. Ideally, the DistCpOptions object should be immutable. The benefits are:
- DistCpOptions is simple and easier to use and share, plus it scales well
- validation is automatic, e.g. manually constructed DistCpOptions gets validated before usage
- validation error message is well-defined which does not depend on the order of setters
This jira is to track the effort of making the DistCpOptions immutable by using a Builder pattern for creation.