Mercurial Hosting > luan
annotate src/org/eclipse/jetty/util/component/AbstractLifeCycle.java @ 1070:a44fc6b53757
fix use of HttpGenerator._buffer
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 10 Nov 2016 01:23:37 -0700 |
parents | 3fa54d9d19cd |
children |
rev | line source |
---|---|
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
1 // |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
2 // ======================================================================== |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
3 // Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd. |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
4 // ------------------------------------------------------------------------ |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
5 // All rights reserved. This program and the accompanying materials |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
6 // are made available under the terms of the Eclipse Public License v1.0 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
7 // and Apache License v2.0 which accompanies this distribution. |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
8 // |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
9 // The Eclipse Public License is available at |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
10 // http://www.eclipse.org/legal/epl-v10.html |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
11 // |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
12 // The Apache License v2.0 is available at |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
13 // http://www.opensource.org/licenses/apache2.0.php |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
14 // |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
15 // You may elect to redistribute this code under either of these licenses. |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
16 // ======================================================================== |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
17 // |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
18 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
19 package org.eclipse.jetty.util.component; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
20 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
21 import java.util.concurrent.CopyOnWriteArrayList; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
22 |
820
8e9db0bbf4f9
remove org.eclipse.jetty.util.log and upgrade slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
23 import org.slf4j.Logger; |
8e9db0bbf4f9
remove org.eclipse.jetty.util.log and upgrade slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
24 import org.slf4j.LoggerFactory; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
25 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
26 /** |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
27 * Basic implementation of the life cycle interface for components. |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
28 * |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
29 * |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
30 */ |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
31 public abstract class AbstractLifeCycle implements LifeCycle |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
32 { |
847
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
33 private static final Logger LOG = LoggerFactory.getLogger(AbstractLifeCycle.class); |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
34 public static final String STOPPED="STOPPED"; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
35 public static final String FAILED="FAILED"; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
36 public static final String STARTING="STARTING"; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
37 public static final String STARTED="STARTED"; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
38 public static final String STOPPING="STOPPING"; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
39 public static final String RUNNING="RUNNING"; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
40 |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
41 private final Object _lock = new Object(); |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
42 private final int __FAILED = -1, __STOPPED = 0, __STARTING = 1, __STARTED = 2, __STOPPING = 3; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
43 private volatile int _state = __STOPPED; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
44 |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
45 protected void doStart() throws Exception |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
46 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
47 } |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
48 |
847
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
49 protected void doStop() throws Exception |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
50 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
51 } |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
52 |
847
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
53 public final void start() throws Exception |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
54 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
55 synchronized (_lock) |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
56 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
57 try |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
58 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
59 if (_state == __STARTED || _state == __STARTING) |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
60 return; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
61 setStarting(); |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
62 doStart(); |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
63 setStarted(); |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
64 } |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
65 catch (Exception e) |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
66 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
67 setFailed(e); |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
68 throw e; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
69 } |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
70 catch (Error e) |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
71 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
72 setFailed(e); |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
73 throw e; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
74 } |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
75 } |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
76 } |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
77 |
847
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
78 public final void stop() throws Exception |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
79 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
80 synchronized (_lock) |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
81 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
82 try |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
83 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
84 if (_state == __STOPPING || _state == __STOPPED) |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
85 return; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
86 setStopping(); |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
87 doStop(); |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
88 setStopped(); |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
89 } |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
90 catch (Exception e) |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
91 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
92 setFailed(e); |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
93 throw e; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
94 } |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
95 catch (Error e) |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
96 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
97 setFailed(e); |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
98 throw e; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
99 } |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
100 } |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
101 } |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
102 |
847
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
103 public boolean isRunning() |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
104 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
105 final int state = _state; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
106 |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
107 return state == __STARTED || state == __STARTING; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
108 } |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
109 |
847
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
110 public boolean isStarted() |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
111 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
112 return _state == __STARTED; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
113 } |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
114 |
847
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
115 public boolean isStarting() |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
116 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
117 return _state == __STARTING; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
118 } |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
119 |
847
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
120 public boolean isStopping() |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
121 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
122 return _state == __STOPPING; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
123 } |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
124 |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
125 public boolean isStopped() |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
126 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
127 return _state == __STOPPED; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
128 } |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
129 |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
130 public boolean isFailed() |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
131 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
132 return _state == __FAILED; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
133 } |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
134 |
847
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
135 public String getState() |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
136 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
137 switch(_state) |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
138 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
139 case __FAILED: return FAILED; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
140 case __STARTING: return STARTING; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
141 case __STARTED: return STARTED; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
142 case __STOPPING: return STOPPING; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
143 case __STOPPED: return STOPPED; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
144 } |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
145 return null; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
146 } |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
147 |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
148 public static String getState(LifeCycle lc) |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
149 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
150 if (lc.isStarting()) return STARTING; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
151 if (lc.isStarted()) return STARTED; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
152 if (lc.isStopping()) return STOPPING; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
153 if (lc.isStopped()) return STOPPED; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
154 return FAILED; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
155 } |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
156 |
847
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
157 private void setStarted() |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
158 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
159 _state = __STARTED; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
160 LOG.debug(STARTED+" {}",this); |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
161 } |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
162 |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
163 private void setStarting() |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
164 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
165 LOG.debug("starting {}",this); |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
166 _state = __STARTING; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
167 } |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
168 |
847
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
169 private void setStopping() |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
170 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
171 LOG.debug("stopping {}",this); |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
172 _state = __STOPPING; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
173 } |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
174 |
847
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
175 private void setStopped() |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
176 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
177 _state = __STOPPED; |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
178 LOG.debug("{} {}",STOPPED,this); |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
179 } |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
180 |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
181 private void setFailed(Throwable th) |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
182 { |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
183 _state = __FAILED; |
1004
3fa54d9d19cd
better handling of BindException
Franklin Schmidt <fschmidt@gmail.com>
parents:
847
diff
changeset
|
184 LOG.warn(FAILED+" " + this+": "+th); |
847
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
185 } |
5dfb10ec0ca5
remove LifeCycle.Listener
Franklin Schmidt <fschmidt@gmail.com>
parents:
820
diff
changeset
|
186 |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
187 } |