Project

General

Profile

« Previous | Next » 

Revision 38792

Abort "prepare for shutdown"

View differences:

ShutdownUtils.java
14 14

  
15 15
public class ShutdownUtils {
16 16

  
17
	@Autowired(required=false)
17
	@Autowired(required = false)
18 18
	private List<Stoppable> stoppables = Lists.newArrayList();
19
		
19

  
20 20
	private StopStatus status = StopStatus.RUNNING;
21
	
21

  
22 22
	private static final Log log = LogFactory.getLog(ShutdownUtils.class);
23
	
24
	public  List<StoppableDetails> listStoppableDetails() {
23

  
24
	public List<StoppableDetails> listStoppableDetails() {
25 25
		final List<StoppableDetails> list = Lists.newArrayList();
26
		
26

  
27 27
		for (Stoppable s : stoppables) {
28 28
			list.add(s.getStopDetails());
29 29
		}
30
		
30

  
31 31
		return list;
32 32
	}
33
	
33

  
34 34
	public void stopAll() {
35 35
		this.status = StopStatus.STOPPING;
36
		
36

  
37 37
		for (Stoppable s : stoppables) {
38 38
			final StoppableDetails info = s.getStopDetails();
39 39
			if (info.getStatus() == StopStatus.RUNNING) {
......
42 42
			}
43 43
		}
44 44
	}
45
	
45

  
46
	public void resumeAll() {
47
		for (Stoppable s : stoppables) {
48
			final StoppableDetails info = s.getStopDetails();
49
			if (info.getStatus() != StopStatus.RUNNING) {
50
				log.info("Resuming " + info.getName());
51
				s.resume();
52
			}
53
		}
54
		this.status = StopStatus.RUNNING;
55
	}
56

  
46 57
	public StopStatus currentStatus() {
47 58
		if (status == StopStatus.STOPPING) {
48 59
			int running = 0;

Also available in: Unified diff