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

graphql.servlet.internal.GraphQLThreadFactory Maven / Gradle / Ivy

There is a newer version: 16.0.0
Show newest version
package graphql.servlet.internal;

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

import graphql.servlet.AbstractGraphQLHttpServlet;

/**
 * {@link ThreadFactory} implementation for {@link AbstractGraphQLHttpServlet} async operations
 * 
 * @author John Nutting
 */
public class GraphQLThreadFactory implements ThreadFactory {

	final static String NAME_PREFIX = "GraphQLServlet-";
	final AtomicInteger threadNumber = new AtomicInteger(1);

	@Override
	public Thread newThread(final Runnable r) {
		Thread t = new Thread(r, NAME_PREFIX + threadNumber.getAndIncrement());
		t.setDaemon(false);
		t.setPriority(Thread.NORM_PRIORITY);
		return t;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy