HDFS-4699. TestPipelinesFailover#testPipelineRecoveryStress fails sporadically. Contributed by Chris Nauroth.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1469839 13f79535-47bb-0310-9956-ffa450edef68
Merge remote-tracking branch 'apache/trunk' into YARN-549
1. Do throw the exception in YarnClientImpl. IMHO, the exception should
be thrown here in case interruption disturbs the application submission.
2. RM_CLIENT_STATE_POLL_INTERVAL has be renamed as
YARN_CLIENT_APP_SUBMISSION_POLL_INTERVAL. 3. Throwing exceptions is
refactored in RMAppManager#submitApplication. And log level (warn) is
unified when exception is logged. 4. Refactor TestAppManager to move
some duplicate init code to setup(). 5. Re-visit the validation code in
RMAppManager#submitApplication and ClientRMService#submitApplication.
Some validations depend on the RM's configuration (dynamic), such that
they need to be done whether during new submission or recovery. These
validations need to be put in RMAppManager#submitApplication. The others
are independent of the RM's configuration (static), such that the are
only need to be done once during newly submission. These validations are
put in ClientRMService#submitApplication. 6. After rebalance the
validation code among RMAppManager#submitApplication and
ClientRMService#submitApplication. The corresponding test code in
TestAppManager and TestClientRMService are reorganized as well.