All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jberet.se.BatchThreadFactory Maven / Gradle / Ivy

Go to download

JSR 352 implementation classes specific to Java SE environment

There is a newer version: 3.1.0.Final
Show newest version
/*
 * Copyright (c) 2012-2013 Red Hat, Inc. and/or its affiliates.
 *
 * This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License 2.0
 * which is available at https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 */

package org.jberet.se;

import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;

public class BatchThreadFactory implements ThreadFactory {
    final AtomicInteger threadNumber = new AtomicInteger(1);
    final static String namePrefix = "jberet-";

    @Override
    public Thread newThread(final Runnable r) {
        final Thread t = new Thread(r, namePrefix + threadNumber.getAndIncrement());
        t.setDaemon(true);
        //some libs rely on TCCL
        //t.setContextClassLoader(null);
        return t;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy