Example usage for java.lang ThreadGroup setDaemon

List of usage examples for java.lang ThreadGroup setDaemon

Introduction

In this page you can find the example usage for java.lang ThreadGroup setDaemon.

Prototype

public final void setDaemon(boolean daemon) 

Source Link

Document

Changes the daemon status of this thread group.

Usage

From source file:Main.java

public ThreadGroupDemo() {

    ThreadGroup pGroup = new ThreadGroup("Parent ThreadGroup");
    pGroup.setDaemon(true);

    ThreadGroup cGroup = new ThreadGroup(pGroup, "Child ThreadGroup");
    cGroup.setDaemon(true);/*from w w  w. j  av  a 2 s  . c  om*/

    Thread t1 = new Thread(pGroup, this);
    System.out.println("Starting " + t1.getName());
    t1.start();

    Thread t2 = new Thread(cGroup, this);
    System.out.println("Starting " + t2.getName());
    t2.start();

    System.out.println("Is " + pGroup.getName() + " a daemon ThreadGroup? " + pGroup.isDaemon());
    System.out.println("Is " + cGroup.getName() + " a daemon ThreadGroup? " + cGroup.isDaemon());

}

From source file:org.eclipse.gemini.blueprint.extender.internal.support.ExtenderConfiguration.java

private TaskExecutor createDefaultTaskExecutor() {
    // create thread-pool for starting contexts
    ThreadGroup threadGroup = new ThreadGroup(
            "eclipse-gemini-blueprint-extender[" + ObjectUtils.getIdentityHexString(this) + "]-threads");
    threadGroup.setDaemon(false);

    SimpleAsyncTaskExecutor taskExecutor = new SimpleAsyncTaskExecutor();
    taskExecutor.setThreadGroup(threadGroup);
    taskExecutor.setThreadNamePrefix("EclipseGeminiBlueprintExtenderThread-");

    isTaskExecutorManagedInternally = true;

    return taskExecutor;
}

From source file:org.springframework.osgi.extender.internal.support.ExtenderConfiguration.java

private TaskExecutor createDefaultTaskExecutor() {
    // create thread-pool for starting contexts
    ThreadGroup threadGroup = new ThreadGroup(
            "spring-osgi-extender[" + ObjectUtils.getIdentityHexString(this) + "]-threads");
    threadGroup.setDaemon(false);

    SimpleAsyncTaskExecutor taskExecutor = new SimpleAsyncTaskExecutor();
    taskExecutor.setThreadGroup(threadGroup);
    taskExecutor.setThreadNamePrefix("SpringOsgiExtenderThread-");

    isTaskExecutorManagedInternally = true;

    return taskExecutor;
}