1 //========================================================================
2 //Copyright 2004-2008 Mort Bay Consulting Pty. Ltd.
3 //------------------------------------------------------------------------
4 //Licensed under the Apache License, Version 2.0 (the "License");
5 //you may not use this file except in compliance with the License.
6 //You may obtain a copy of the License at
7 //http://www.apache.org/licenses/LICENSE-2.0
8 //Unless required by applicable law or agreed to in writing, software
9 //distributed under the License is distributed on an "AS IS" BASIS,
10 //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 //See the License for the specific language governing permissions and
12 //limitations under the License.
13 //========================================================================
14
15 package org.mortbay.jetty.win32service;
16
17 import org.mortbay.component.AbstractLifeCycle;
18 import org.mortbay.jetty.Server;
19 import org.tanukisoftware.wrapper.WrapperManager;
20
21
22 public class Win32Service extends AbstractLifeCycle implements Runnable
23 {
24 private Server server;
25 public void doStart()
26 {
27
28
29 JettyServiceWrapperListener.setServer(server);
30
31 }
32
33 public void doStop()
34 {
35 System.out.println("Listener is stopping Jetty Service Instance!!!");
36
37 }
38
39 public void run()
40 {
41 doStop();
42
43 }
44
45 public void stopServer()
46 {
47 try
48 {
49 System.out.println("Thread Test Stopper!!!");
50 server.stop();
51 //WrapperManager.stop(0);
52 }
53 catch (Exception e)
54 {
55 e.printStackTrace();
56 }
57 }
58
59
60 public Server getServer()
61 {
62 return server;
63 }
64
65 public void setServer(Server server)
66 {
67 this.server = server;
68 }
69
70
71
72
73
74
75
76 }