comparison src/org/eclipse/jetty/server/Server.java @ 880:00b3bd6e0ada

remove Server._graceful
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 04 Oct 2016 15:59:35 -0600
parents a3775d0c6985
children d850a5e6ff15
comparison
equal deleted inserted replaced
879:a3775d0c6985 880:00b3bd6e0ada
61 private static final String __version = "8"; 61 private static final String __version = "8";
62 62
63 private final AttributesMap _attributes = new AttributesMap(); 63 private final AttributesMap _attributes = new AttributesMap();
64 public final ThreadPoolExecutor threadPool; 64 public final ThreadPoolExecutor threadPool;
65 public final Connector connector; 65 public final Connector connector;
66 private int _graceful=0;
67 private boolean _dumpAfterStart=false; 66 private boolean _dumpAfterStart=false;
68 private boolean _dumpBeforeStop=false; 67 private boolean _dumpBeforeStop=false;
69 private boolean _uncheckedPrintWriter=false; 68 private boolean _uncheckedPrintWriter=false;
70 69
71 70
164 { 163 {
165 if (isDumpBeforeStop()) 164 if (isDumpBeforeStop())
166 dumpStdErr(); 165 dumpStdErr();
167 166
168 MultiException mex=new MultiException(); 167 MultiException mex=new MultiException();
169 168 /*
170 if (_graceful>0) 169 if (_graceful>0)
171 { 170 {
172 LOG.info("Graceful shutdown {}",connector); 171 LOG.info("Graceful shutdown {}",connector);
173 try{connector.close();}catch(Throwable e){mex.add(e);} 172 try{connector.close();}catch(Throwable e){mex.add(e);}
174 173
179 LOG.info("Graceful shutdown {}",context); 178 LOG.info("Graceful shutdown {}",context);
180 context.setShutdown(true); 179 context.setShutdown(true);
181 } 180 }
182 Thread.sleep(_graceful); 181 Thread.sleep(_graceful);
183 } 182 }
184 183 */
185 try{connector.stop();}catch(Throwable e){mex.add(e);} 184 try{connector.stop();}catch(Throwable e){mex.add(e);}
186 185
187 threadPool.shutdownNow(); 186 threadPool.shutdownNow();
188 187
189 try {super.doStop(); } catch(Throwable e) { mex.add(e);} 188 try {super.doStop(); } catch(Throwable e) { mex.add(e);}
305 { 304 {
306 _attributes.setAttribute(name, attribute); 305 _attributes.setAttribute(name, attribute);
307 } 306 }
308 307
309 /* ------------------------------------------------------------ */ 308 /* ------------------------------------------------------------ */
310 /**
311 * @return the graceful
312 */
313 public int getGracefulShutdown()
314 {
315 return _graceful;
316 }
317
318 /* ------------------------------------------------------------ */
319 /**
320 * Set graceful shutdown timeout. If set, the internal <code>doStop()</code> method will not immediately stop the
321 * server. Instead, all {@link Connector}s will be closed so that new connections will not be accepted
322 * and all handlers that implement {@link Graceful} will be put into the shutdown mode so that no new requests
323 * will be accepted, but existing requests can complete. The server will then wait the configured timeout
324 * before stopping.
325 * @param timeoutMS the milliseconds to wait for existing request to complete before stopping the server.
326 *
327 */
328 public void setGracefulShutdown(int timeoutMS)
329 {
330 _graceful=timeoutMS;
331 }
332
333 /* ------------------------------------------------------------ */
334 @Override 309 @Override
335 public String toString() 310 public String toString()
336 { 311 {
337 return this.getClass().getName()+"@"+Integer.toHexString(hashCode()); 312 return this.getClass().getName()+"@"+Integer.toHexString(hashCode());
338 } 313 }