Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2014 the original author or authors.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package org.springframework.yarn.boot.app;
 
A Boot application which is used to shutdown YARN application gracefully.

Author(s):
Janne Valkealahti
 
 
 	public String run() {
 		return run(new String[0]);
 	}
 
 	public String run(String... args) {
 		builder.web(false);
 		SpringYarnBootUtils.addSources(builder.toArray(new Object[0]));
 		SpringYarnBootUtils.addProfiles(builder.toArray(new String[0]));
 		SpringYarnBootUtils.addApplicationListener(builder);
 
 		return template.execute(new SpringApplicationCallback<String>() {
 
 				OperationProperties operationProperties = context.getBean(OperationProperties.class);
 				ApplicationId applicationId = ConverterUtils.toApplicationId(operationProperties.getApplicationId());
 				YarnClient client = context.getBean(YarnClient.class);
 				ApplicationReport report = client.getApplicationReport(applicationId);
 				String trackingUrl = report.getOriginalTrackingUrl();
 
 				restTemplate.postForObject(trackingUrl + "/shutdown"nullVoid.class);
 
 				return "shutdown requested";
 			}
 
 		}, args);
 
 	}
 
 		return this;
 	}
 
 	@ConfigurationProperties(value = "spring.yarn.internal.YarnShutdownApplication")
 	public static class OperationProperties {
 		public void setApplicationId(String applicationId) {
 			this. = applicationId;
 		}
 		public String getApplicationId() {
 			return ;
 		}
 	}
New to GrepCode? Check out our FAQ X