1 /**
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 *
6 * If it is not possible or desirable to put the notice in a particular
7 * file, then You may include the notice in a location (such as a LICENSE
8 * file in a relevant directory) where a recipient would be likely to look
9 * for such a notice.
10
11 *
12 */
13
14 /* ---------------------------------------------------------------------------
15 * U.S. Government, Department of the Army
16 * Army Materiel Command
17 * Research Development Engineering Command
18 * Communications Electronics Research Development and Engineering Center
19 * ---------------------------------------------------------------------------
20 */
21 package org.miloss.fgsms.osagent;
22
23 import java.util.logging.Level;
24 import java.util.logging.Logger;
25
26 /**
27 *
28 * @author AO
29 */
30 public class OSAgentDaemon {
31
32 private static AgentThreadRunner runner = null;
33
34 public static void start(String[] args) {
35 runner = new AgentThreadRunner(args);
36 t = new Thread(runner);
37 t.start();
38 }
39 static Thread t;
40
41 public static void stop(String[] args) {
42 if (t != null && t.isAlive() && runner != null) {
43 runner.m.running = false;
44 try {
45 t.join();
46 } catch (InterruptedException ex) {
47 Logger.getLogger(OSAgentDaemon.class.getName()).log(Level.SEVERE, null, ex);
48 }
49 }
50 }
51 }