comparison src/org/eclipse/jetty/server/handler/AbstractHandler.java @ 848:22a4e93ed20e

remove Container
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 19 Sep 2016 16:38:36 -0600
parents 8e9db0bbf4f9
children
comparison
equal deleted inserted replaced
847:5dfb10ec0ca5 848:22a4e93ed20e
33 * 33 *
34 * 34 *
35 */ 35 */
36 public abstract class AbstractHandler extends AggregateLifeCycle implements Handler 36 public abstract class AbstractHandler extends AggregateLifeCycle implements Handler
37 { 37 {
38 private static final Logger LOG = LoggerFactory.getLogger(AbstractHandler.class); 38 private static final Logger LOG = LoggerFactory.getLogger(AbstractHandler.class);
39 39
40 private Server _server; 40 private Server _server;
41 41
42 /* ------------------------------------------------------------ */ 42 /* ------------------------------------------------------------ */
43 /** 43 /**
44 * 44 *
45 */ 45 */
46 public AbstractHandler() 46 public AbstractHandler()
47 { 47 {
48 } 48 }
49 49
50 /* ------------------------------------------------------------ */ 50 /* ------------------------------------------------------------ */
51 /* 51 /*
52 * @see org.eclipse.thread.LifeCycle#start() 52 * @see org.eclipse.thread.LifeCycle#start()
53 */ 53 */
54 @Override 54 @Override
55 protected void doStart() throws Exception 55 protected void doStart() throws Exception
56 { 56 {
57 LOG.debug("starting {}",this); 57 LOG.debug("starting {}",this);
58 super.doStart(); 58 super.doStart();
59 } 59 }
60 60
61 /* ------------------------------------------------------------ */ 61 /* ------------------------------------------------------------ */
62 /* 62 /*
63 * @see org.eclipse.thread.LifeCycle#stop() 63 * @see org.eclipse.thread.LifeCycle#stop()
64 */ 64 */
65 @Override 65 @Override
66 protected void doStop() throws Exception 66 protected void doStop() throws Exception
67 { 67 {
68 LOG.debug("stopping {}",this); 68 LOG.debug("stopping {}",this);
69 super.doStop(); 69 super.doStop();
70 } 70 }
71 71
72 /* ------------------------------------------------------------ */ 72 /* ------------------------------------------------------------ */
73 public void setServer(Server server) 73 public void setServer(Server server)
74 { 74 {
75 Server old_server=_server; 75 _server=server;
76 if (old_server!=null && old_server!=server) 76 }
77 old_server.getContainer().removeBean(this);
78 _server=server;
79 if (_server!=null && _server!=old_server)
80 _server.getContainer().addBean(this);
81 }
82 77
83 /* ------------------------------------------------------------ */ 78 /* ------------------------------------------------------------ */
84 public Server getServer() 79 public Server getServer()
85 { 80 {
86 return _server; 81 return _server;
87 } 82 }
88 83
89 /* ------------------------------------------------------------ */ 84 /* ------------------------------------------------------------ */
90 public void destroy() 85 public void destroy()
91 { 86 {
92 if (!isStopped()) 87 if (!isStopped())
93 throw new IllegalStateException("!STOPPED"); 88 throw new IllegalStateException("!STOPPED");
94 super.destroy(); 89 super.destroy();
95 if (_server!=null) 90 }
96 _server.getContainer().removeBean(this);
97 }
98 91
99 /* ------------------------------------------------------------ */ 92 /* ------------------------------------------------------------ */
100 public void dumpThis(Appendable out) throws IOException 93 public void dumpThis(Appendable out) throws IOException
101 { 94 {
102 out.append(toString()).append(" - ").append(getState()).append('\n'); 95 out.append(toString()).append(" - ").append(getState()).append('\n');
103 } 96 }
104 97
105 } 98 }