List of usage examples for java.lang Thread setDaemon
public final void setDaemon(boolean on)
From source file:org.jfree.chart.demo.BubblyBubblesDemo2.java
/** * Starting point for the demonstration application. * * @param args ignored.//from w w w. j a v a 2s . co m */ public static void main(final String[] args) { final BubblyBubblesDemo2 demo = new BubblyBubblesDemo2(TITLE); demo.pack(); demo.setSize(800, 600); RefineryUtilities.centerFrameOnScreen(demo); demo.setVisible(true); final Thread updater = demo.new UpdaterThread(); updater.setDaemon(true); updater.start(); }
From source file:webdriver.test.BasicHttpServer.java
public static void main(String[] args) throws Exception { if (args.length < 1) { System.err.println("Please specify HTTP document root directory as "); System.err.println("a argument relative to the run directory."); Thread.sleep(10);//w ww. j a va 2s .c o m System.exit(1); } Thread t = new RequestListenerThread(8001, args[0]); t.setDaemon(false); t.start(); }
From source file:org.jfree.chart.demo.LegendManiaDemo.java
/** * Starting point for the demonstration application. * /*from ww w. ja va 2 s . c o m*/ * @param args * ignored. */ public static void main(final String[] args) { final LegendManiaDemo demo = new LegendManiaDemo(CHART_TITLE); demo.pack(); demo.setSize(800, 600); RefineryUtilities.centerFrameOnScreen(demo); demo.setVisible(true); final Thread updater = demo.new UpdaterThread(); updater.setDaemon(true); updater.start(); }
From source file:io.aos.protocol.http.httpcommon.ElementalHttpServer.java
public static void main(String... args) throws Exception { if (args.length < 1) { System.err.println("Please specify document root directory"); System.exit(1);/*from w w w .jav a 2 s. co m*/ } Thread t = new RequestListenerThread(8080, args[0]); t.setDaemon(false); t.start(); }
From source file:net.minder.httpcap.HttpCap.java
public static void main(String[] args) throws Exception { PropertyConfigurator.configure(ClassLoader.getSystemResourceAsStream("log4j.properties")); int port = DEFAULT_PORT; if (args.length > 0) { try {/* w w w.j a v a 2s. co m*/ port = Integer.parseInt(args[0]); } catch (NumberFormatException nfe) { port = DEFAULT_PORT; } } HttpProcessor httpproc = HttpProcessorBuilder.create().add(new ResponseDate()) .add(new ResponseServer("HttpCap/1.1")).add(new ResponseContent()).add(new ResponseConnControl()) .build(); UriHttpRequestHandlerMapper reqistry = new UriHttpRequestHandlerMapper(); reqistry.register("*", new HttpCapHandler()); // Set up the HTTP service HttpService httpService = new HttpService(httpproc, reqistry); SSLServerSocketFactory sf = null; // if (port == 8443) { // // Initialize SSL context // ClassLoader cl = HttpCap.class.getClassLoader(); // URL url = cl.getResource("my.keystore"); // if (url == null) { // System.out.println("Keystore not found"); // System.exit(1); // } // KeyStore keystore = KeyStore.getInstance("jks"); // keystore.load(url.openStream(), "secret".toCharArray()); // KeyManagerFactory kmfactory = KeyManagerFactory.getInstance( // KeyManagerFactory.getDefaultAlgorithm()); // kmfactory.init(keystore, "secret".toCharArray()); // KeyManager[] keymanagers = kmfactory.getKeyManagers(); // SSLContext sslcontext = SSLContext.getInstance("TLS"); // sslcontext.init(keymanagers, null, null); // sf = sslcontext.getServerSocketFactory(); // } Thread t = new RequestListenerThread(port, httpService, sf); t.setDaemon(false); t.start(); }
From source file:com.adhi.webserver.WebServer.java
public static void main(String[] args) throws Exception { int port = 9999; // Set up the HTTP protocol processor HttpProcessor httpproc = HttpProcessorBuilder.create().add(new ResponseDate()) .add(new ResponseServer("Test/1.1")).add(new ResponseContent()).add(new ResponseConnControl()) .build();//from w w w. j a v a 2 s. c o m // Set up request handlers UriHttpRequestHandlerMapper reqistry = new UriHttpRequestHandlerMapper(); reqistry.register("*", new MessageCommandHandler()); // Set up the HTTP service HttpService httpService = new HttpService(httpproc, reqistry); SSLServerSocketFactory sf = null; if (port == 8443) { // Initialize SSL context ClassLoader cl = WebServer.class.getClassLoader(); URL url = cl.getResource("my.keystore"); if (url == null) { System.out.println("Keystore not found"); System.exit(1); } KeyStore keystore = KeyStore.getInstance("jks"); keystore.load(url.openStream(), "secret".toCharArray()); KeyManagerFactory kmfactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); kmfactory.init(keystore, "secret".toCharArray()); KeyManager[] keymanagers = kmfactory.getKeyManagers(); SSLContext sslcontext = SSLContext.getInstance("TLS"); sslcontext.init(keymanagers, null, null); sf = sslcontext.getServerSocketFactory(); } Thread t = new RequestListenerThread(port, httpService, sf); t.setDaemon(false); t.start(); }
From source file:com.vikram.kdtree.ElementalHttpServer.java
public static void main(String[] args) throws Exception { // Set up the HTTP protocol processor HttpProcessor httpproc = HttpProcessorBuilder.create().add(new ResponseDate()) .add(new ResponseServer("Test/1.1")).add(new ResponseContent()).add(new ResponseConnControl()) .build();// www .j a va 2 s. c o m // Set up request handlers UriHttpRequestHandlerMapper reqistry = new UriHttpRequestHandlerMapper(); reqistry.register("*", new HttpPostReceiver()); // Set up the HTTP service HttpService httpService = new HttpService(httpproc, reqistry); Properties properties = new Properties(); properties.load(new FileInputStream("Config.properties")); Thread t = new RequestListenerThread(Integer.valueOf(properties.getProperty("requestPort")), httpService, null); t.setDaemon(false); t.start(); }
From source file:dm.Interceptors.ElementalReverseProxy.java
public static void main(final String[] args) throws Exception { /* if (args.length < 1) { System.err.println("Please specified target hostname and port"); System.exit(1);/*from w w w . j a v a2 s .co m*/ } final String hostname = args[0]; int port = 80; if (args.length > 1) { port = Integer.parseInt(args[1]); }*/ final HttpHost target = new HttpHost("127.0.0.1", 80); final Thread t = new RequestListenerThread(8888, target); t.setDaemon(false); t.start(); }
From source file:cn.heroes.ud.protocol.ElementalReverseProxy.java
public static void main(final String[] args) throws Exception { if (args.length < 1) { System.err.println("Please specified target hostname and port"); System.exit(1);/*from w ww. j av a2 s . c o m*/ } final String hostname = args[0]; int port = 80; if (args.length > 1) { port = Integer.parseInt(args[1]); } final HttpHost target = new HttpHost(hostname, port); final Thread t = new RequestListenerThread(8888, target); t.setDaemon(false); t.start(); }
From source file:com.bfd.job.testClient.t04.ElementalHttpServer.java
public static void main(String[] args) throws Exception { /**/*from ww w. java 2 s .co m*/ * if (args.length < 1) { * System.err.println("Please specify document root directory"); * System.exit(1); } // Document root directory String docRoot = * args[0]; */ String docRoot = "c:/root"; int port = 8080; if (args.length >= 2) { port = Integer.parseInt(args[1]); } // Set up the HTTP protocol processor HttpProcessor httpproc = HttpProcessorBuilder.create().add(new ResponseDate()) .add(new ResponseServer("Test/1.1")).add(new ResponseContent()).add(new ResponseConnControl()) .build(); // Set up request handlers UriHttpRequestHandlerMapper reqistry = new UriHttpRequestHandlerMapper(); reqistry.register("*", new HttpFileHandler(docRoot)); // Set up the HTTP service HttpService httpService = new HttpService(httpproc, reqistry); SSLServerSocketFactory sf = null; if (port == 8443) { // Initialize SSL context ClassLoader cl = ElementalHttpServer.class.getClassLoader(); URL url = cl.getResource("my.keystore"); if (url == null) { System.out.println("Keystore not found"); System.exit(1); } KeyStore keystore = KeyStore.getInstance("jks"); keystore.load(url.openStream(), "secret".toCharArray()); KeyManagerFactory kmfactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); kmfactory.init(keystore, "secret".toCharArray()); KeyManager[] keymanagers = kmfactory.getKeyManagers(); SSLContext sslcontext = SSLContext.getInstance("TLS"); sslcontext.init(keymanagers, null, null); sf = sslcontext.getServerSocketFactory(); } Thread t = new RequestListenerThread(port, httpService, sf); t.setDaemon(false); t.start(); }