List of usage examples for java.lang Thread setDaemon
public final void setDaemon(boolean on)
From source file:MyThread.java
public static void main(String[] argv) throws Exception { Thread thread = new MyThread(); thread.setDaemon(true); thread.start();/*w w w .j a v a2 s. c om*/ }
From source file:Main.java
public static void main(String[] args) { Thread t = new Thread(Main::print); t.setDaemon(true); t.start();/*w ww . j av a 2 s .c om*/ System.out.println("Exiting main method"); }
From source file:Main.java
public static void main(String[] args) { Thread t = new Thread(Main::print); t.setDaemon(false); t.start();//from w w w. ja va2 s . co m System.out.println("Exiting main method"); }
From source file:DaemonThread.java
public static void main(String[] args) { System.out.println("entering main()"); Thread t = new Thread(new DaemonThread()); t.setDaemon(true); t.start();/*from w w w. j a v a 2s . co m*/ try { Thread.sleep(3000); } catch (InterruptedException x) { } System.out.println("leaving main()"); }
From source file:FlagComm.java
public static void main(String args[]) { FlagSend s = new FlagSend(); FlagRec r = new FlagRec(s); Thread st = new Thread(s); Thread rt = new Thread(r); rt.setDaemon(true); st.start();/* w w w. ja v a2s . co m*/ rt.start(); try { while (s.isValid) { Thread.sleep(100); } } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:WaitComm.java
public static void main(String args[]) { WFlagSend s = new WFlagSend(); WFlagRec r = new WFlagRec(s); Thread st = new Thread(s); Thread rt = new Thread(r); rt.setDaemon(true); st.start();/*from ww w . j a va 2 s. c o m*/ rt.start(); try { st.join(); while (s.isValid) { Thread.sleep(100); } } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:MyThread.java
public static void main(String[] args) throws Exception { Thread thread = new MyThread(); System.out.println("thread = " + thread.currentThread()); thread.setDaemon(false); thread.start();//from w ww . j a va 2 s.c om }
From source file:MyThread.java
public static void main(String[] args) throws Exception { Thread thread = new MyThread(); System.out.println("thread = " + thread.currentThread()); thread.setDaemon(true); // this will call run() method thread.start();//from www .j av a2 s.c om }
From source file:com.autodomum.example.Example1.java
public static void main(String[] args) throws Exception { final ConfigurableApplicationContext context = SpringApplication.run(Example1.class, args); final JsonLampDao jsonLampDao = context.getBean(JsonLampDao.class); final EventComponent eventComponent = context.getBean(EventComponent.class); final EventContext eventContext = context.getBean(EventContext.class); final TelldusComponent telldusComponent = context.getBean(TelldusComponent.class); final NashornScriptComponent nashornScriptComponent = context.getBean(NashornScriptComponent.class); final Thread eventComponentThread = new Thread(eventComponent); eventComponentThread.setDaemon(true); eventComponentThread.setPriority(Thread.MIN_PRIORITY); eventComponentThread.setName("EventComponent"); eventComponentThread.start();// w w w. j a v a2 s . c o m // Coordinates of Stockholm eventContext.setCoordinate(new Coordinate(18.063240d, 59.334591d)); eventComponent.updateEventContext(); eventComponent.register(LampStateChangedEvent.class, telldusComponent); final Thread telldusComponentThread = new Thread(telldusComponent); telldusComponentThread.setDaemon(true); telldusComponentThread.setPriority(Thread.MIN_PRIORITY); telldusComponentThread.setName("Telldus"); telldusComponentThread.start(); try (InputStream inputStream = Example1.class.getResourceAsStream("/lamps.json")) { jsonLampDao.load(inputStream); } try (InputStream inputStream = Example1.class.getResourceAsStream("/ai.js")) { nashornScriptComponent.replaceScript(inputStream); } }
From source file:org.jfree.chart.demo.BubblyBubblesDemo.java
/** * Starting point for the demonstration application. * * @param args ignored./*from www. ja v a2 s . c om*/ */ public static void main(final String[] args) { final BubblyBubblesDemo demo = new BubblyBubblesDemo(TITLE); demo.pack(); demo.setSize(800, 600); RefineryUtilities.centerFrameOnScreen(demo); demo.setVisible(true); final Thread updater = demo.new UpdaterThread(); updater.setDaemon(true); updater.start(); }