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.support;
 
 
Base support class for org.springframework.boot.CommandLineRunner implementations.

Author(s):
Janne Valkealahti
 
 public abstract class CommandLineRunnerSupport implements Ordered {
 
 	private static final Log log = LogFactory.getLog(CommandLineRunnerSupport.class);
 
 	private CountDownLatch latch = new CountDownLatch(1);
 
 	private boolean waitLatch = true;
 
 	private int order = .;
 
 	private static SystemExiter systemExiter = new JvmSystemExiter();
 
 
 	public int getOrder() {
 		return ;
 	}

Sets the order used fororg.springframework.core.Ordered. The order used in this class is Ordered.HIGHEST_PRECEDENCE.

Parameters:
order the new order
 
 	public void setOrder(int order) {
 		this. = order;
 	}

Exit method wrapping handling through org.springframework.yarn.launch.SystemExiter.

Parameters:
status the exit code
 
 	public void exit(int status) {
 		.info("About to exit using code= " + status);
 		.exit(status);
 	}

Exit method wrapping handling through org.springframework.yarn.launch.SystemExiter. As exist status for this method is given as String, status value is translated via org.springframework.yarn.launch.ExitCodeMapper.

Parameters:
status the exit code
 
 	public void exit(String status) {
 	}

Sets the wait latch.

Parameters:
waitLatch the new wait latch
 
 	public void setWaitLatch(boolean waitLatch) {
 		this. = waitLatch;
 	}

Checks if is wait latch.

Returns:
true, if is wait latch
 
	public boolean isWaitLatch() {
		return ;
	}

Sets the exit code mapper.

Parameters:
exitCodeMapper the new exit code mapper
	public void setExitCodeMapper(ExitCodeMapper exitCodeMapper) {
		this. = exitCodeMapper;
	}

Gets the exit code mapper.

Returns:
the exit code mapper
	}

Count down current latch by one.
	protected void countDownLatch() {
		if (isWaitLatch()) {
		}
	}

	protected void waitLatch() {
		try {
catch (InterruptedException e) {
			.info("CommandLineRunner wait latch interrupted");
		}
	}

Simply delegates to java.util.concurrent.CountDownLatch.await(long,java.util.concurrent.TimeUnit).

Parameters:
timeout the timeout
unit the unit
	protected void waitLatch(long timeoutTimeUnit unit) {
		try {
			.await(timeoutunit);
catch (InterruptedException e) {
			.info("CommandLineRunner wait latch interrupted");
		}
	}
New to GrepCode? Check out our FAQ X