Example usage for org.springframework.core.task SimpleAsyncTaskExecutor setDaemon

List of usage examples for org.springframework.core.task SimpleAsyncTaskExecutor setDaemon

Introduction

In this page you can find the example usage for org.springframework.core.task SimpleAsyncTaskExecutor setDaemon.

Prototype

public void setDaemon(boolean daemon) 

Source Link

Document

Set whether this factory is supposed to create daemon threads, just executing as long as the application itself is running.

Usage

From source file:com.apress.prospringintegration.concurrency.taskexecutorexample.TaskExecutorExampleConfiguration.java

@Bean
public SimpleAsyncTaskExecutor simpleAsyncTaskExecutor() {
    SimpleAsyncTaskExecutor simpleAsyncTaskExecutor = new SimpleAsyncTaskExecutor();
    simpleAsyncTaskExecutor.setDaemon(false);
    return simpleAsyncTaskExecutor;

}

From source file:org.openspaces.events.adapter.TaskExecutorEventListenerAdapter.java

/**
 * Initializes the task executor adapter. Expects the delegate to be set. If no {@link
 * #setTaskExecutor(org.springframework.core.task.TaskExecutor) taskExecutor} is provided will
 * create a default one using {@link org.springframework.core.task.SimpleAsyncTaskExecutor}.
 *//*from   w ww. j  a  va2  s  .  c o  m*/
public void afterPropertiesSet() throws Exception {
    Assert.notNull(delegate, "delegate SpaceDataEventListener must not be null");
    if (taskExecutor == null) {
        SimpleAsyncTaskExecutor simpleAsyncTaskExecutor = new SimpleAsyncTaskExecutor();
        simpleAsyncTaskExecutor.setDaemon(true);
        taskExecutor = simpleAsyncTaskExecutor;
    }
}

From source file:org.springframework.amqp.rabbit.admin.RabbitBrokerAdmin.java

/**
 * Create an instance by supplying the erlang node name, port number and cookie (unique string). If the node name
 * does not contain an <code>@</code> character, it will be prepended with an alivename <code>rabbit@</code>
 * (interpreting the supplied value as just the hostname).
 *
 * @param nodeName the node name or hostname to use
 * @param port the port number (overriding the default which is 5672)
 * @param cookie the cookie value to use
 */// w w w.  j  a va  2s.c om
public RabbitBrokerAdmin(String nodeName, int port, String cookie) {

    if (!nodeName.contains("@")) {
        nodeName = "rabbit@" + nodeName; // it was just the host
    }

    String[] parts = nodeName.split("@");
    Assert.state(parts.length == 2, "The node name should be in the form alivename@host, e.g. rabbit@myserver");
    if (Os.isFamily("windows") && !DEFAULT_NODE_NAME.equals(nodeName)) {
        nodeName = parts[0] + "@" + parts[1].toUpperCase();
    }

    this.port = port;
    this.cookie = cookie;
    this.nodeName = nodeName;
    SimpleAsyncTaskExecutor executor = new SimpleAsyncTaskExecutor();
    executor.setDaemon(true);
    this.executor = executor;

}