@@ -157,7 +157,9 @@ public ApplicationId submitApplication(ApplicationSubmissionContext appContext)
157157 @ Override
158158 public void killApplication (ApplicationId appId ) {
159159 try {
160- clientHandler .shutdownAM ();
160+ if (clientHandler != null ){
161+ clientHandler .shutdownAM ();
162+ }
161163 } catch (TezException e ) {
162164 throw new RuntimeException (e );
163165 }
@@ -403,7 +405,13 @@ protected DAGAppMaster createDAGAppMaster(ApplicationAttemptId applicationAttemp
403405 @ Override
404406 public TezAppMasterStatus getAMStatus (Configuration configuration , ApplicationId appId ,
405407 UserGroupInformation ugi ) throws TezException , ServiceException , IOException {
406- return clientHandler .getTezAppMasterStatus ();
408+ if (isLocalWithoutNetwork ) {
409+ if (clientHandler == null ) {
410+ return TezAppMasterStatus .INITIALIZING ;
411+ }
412+ return clientHandler .getTezAppMasterStatus ();
413+ }
414+ return super .getAMStatus (configuration , appId , ugi );
407415 }
408416
409417 @ Override
@@ -438,10 +446,11 @@ public DAGStatus apply(Set<StatusGetOpts> statusOpts, Long timeout) {
438446 public boolean shutdownSession (Configuration configuration , ApplicationId sessionAppId ,
439447 UserGroupInformation ugi ) throws TezException , IOException , ServiceException {
440448 if (isLocalWithoutNetwork ) {
441- clientHandler .shutdownAM ();
449+ if (clientHandler != null ){
450+ clientHandler .shutdownAM ();
451+ }
442452 return true ;
443- } else {
444- return super .shutdownSession (configuration , sessionAppId , ugi );
445453 }
454+ return super .shutdownSession (configuration , sessionAppId , ugi );
446455 }
447456}
0 commit comments