Changeset 1991 for trunk/autoquest-httpmonitor/src/main/java/de/ugoe/cs/autoquest/httpmonitor/proxy/HttpMonitoringProxy.java
- Timestamp:
- 07/08/15 09:03:46 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-httpmonitor/src/main/java/de/ugoe/cs/autoquest/httpmonitor/proxy/HttpMonitoringProxy.java
r1384 r1991 22 22 import de.ugoe.cs.autoquest.httpmonitor.HttpMonitorLogManager; 23 23 import de.ugoe.cs.autoquest.httpmonitor.HttpMonitorServer; 24 import de.ugoe.cs.autoquest.httpmonitor.IdGenerator; 24 25 import de.ugoe.cs.autoquest.httpmonitor.Runner; 25 26 import de.ugoe.cs.autoquest.httpmonitor.ShutdownHook; 27 import de.ugoe.cs.autoquest.httpmonitor.SimpleIdGenerator; 26 28 import de.ugoe.cs.util.console.Console; 27 29 … … 29 31 * <p> 30 32 * The HTTP monitory proxy monitor starts a web server ({@link HttpMonitorServer}) that receives 31 * proxie sHTTP messages and response. Each exchange of a request and a response is forwarded to33 * proxied HTTP messages and response. Each exchange of a request and a response is forwarded to 32 34 * an exchange handler. The exchange handler is either a local log manager 33 35 * ({@link HttpMonitorLogManager}) or a connection to an external and central HTTP monitor via 34 * an {@link HttpMonitorRemoteExchangeHandler}. The class ensures that on shutdown e.g. caused 36 * an {@link HttpMonitorRemoteExchangeHandler}. It also holds a reference to an id generator. If 37 * the exchanges are handled locally, then also a local {@link SimpleIdGenerator} is used. If 38 * the exchanges are send to a central HTTP monitor, then this monitor is used as id generator via 39 * an {@link HttpMonitorRemoteIdGenerator}. The class ensures that on shutdown e.g. caused 35 40 * by CTRL-C the server and all other requied components are stopped correctly. 36 41 * </p> … … 59 64 */ 60 65 private HttpMonitorExchangeHandler exchangeHandler; 66 67 /** 68 * the id generator used to generate order ids for the requests and responses 69 */ 70 private IdGenerator idGenerator; 61 71 62 72 /** … … 170 180 exchangeHandler = 171 181 new HttpMonitorRemoteExchangeHandler(httpMonitorServer, httpMonitorPort); 182 183 idGenerator = new HttpMonitorRemoteIdGenerator(httpMonitorServer, httpMonitorPort); 172 184 } 173 185 else { 174 186 Console.println("storing logs locally into directory " + logFileBaseDir); 175 187 exchangeHandler = new HttpMonitorLogManager(logFileBaseDir); 188 idGenerator = new SimpleIdGenerator(); 176 189 } 177 190 } … … 187 200 188 201 exchangeHandler.init(); 189 190 exchangeListenerManager = new ExchangeListenerManager(exchangeHandler); 202 idGenerator.init(); 203 204 exchangeListenerManager = new ExchangeListenerManager(exchangeHandler, idGenerator); 191 205 exchangeListenerManager.init(); 192 206 … … 205 219 @Override 206 220 public synchronized void start() { 207 if ((exchangeHandler == null) || (exchangeListenerManager == null) || (server == null)) { 221 if ((exchangeHandler == null) || (idGenerator == null) || 222 (exchangeListenerManager == null) || (server == null)) 223 { 208 224 throw new IllegalStateException("not initialized."); 209 225 } … … 212 228 Runtime.getRuntime().addShutdownHook(shutdownHook); 213 229 exchangeHandler.start(); 230 idGenerator.start(); 214 231 exchangeListenerManager.start(); 215 232 server.start(); … … 226 243 @Override 227 244 public synchronized void stop() { 228 if ((exchangeHandler == null) || (exchangeListenerManager == null) || (server == null)) { 245 if ((exchangeHandler == null) || (idGenerator == null) || 246 (exchangeListenerManager == null) || (server == null)) 247 { 229 248 throw new IllegalStateException("not initialized."); 230 249 } … … 233 252 server.stop(); 234 253 exchangeListenerManager.stop(); 254 idGenerator.stop(); 235 255 exchangeHandler.stop(); 236 256 237 257 server = null; 238 258 exchangeListenerManager = null; 259 idGenerator = null; 239 260 exchangeHandler = null; 240 261 }
Note: See TracChangeset
for help on using the changeset viewer.