org.wildfly.clustering.context.DefaultExecutorService Maven / Gradle / Ivy
/*
* Copyright The WildFly Authors
* SPDX-License-Identifier: Apache-2.0
*/
package org.wildfly.clustering.context;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadFactory;
import java.util.function.Function;
/**
* {@link ExecutorService} that performs contextual execution of submitted tasks.
* @author Paul Ferraro
*/
public class DefaultExecutorService extends ContextualExecutorService {
public DefaultExecutorService(Function factory, ClassLoader loader) {
// Use thread group of current thread
super(factory.apply(AccessController.doPrivileged(new PrivilegedAction() {
@Override
public ThreadFactory run() {
return new DefaultThreadFactory(Thread.currentThread().getThreadGroup(), DefaultExecutorService.class.getClassLoader());
}
})), DefaultContextualizerFactory.INSTANCE.createContextualizer(loader));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy