ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/catalina/tribes/util/TcclThreadFactory.java

Path
ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/catalina/tribes/util/TcclThreadFactory.java
Status
scanned
Type
file
Name
TcclThreadFactory.java
Extension
.java
Programming language
Java
Mime type
text/plain
File type
ASCII text, with CRLF line terminators
Tag

      
    
Rootfs path

      
    
Size
2132 (2.1 KB)
MD5
7d1958bbe6cf66c66ffe6c9dc1ab3b43
SHA1
6d262005110a05bc6b41ccf27e668fc80a71a366
SHA256
ace787d0b5b0843f2020ce87cf30ae505491e559ee12cd872db42f26e723a124
SHA512

      
    
SHA1_git
fdcb01b7bb0a22ade416cc5f49b722c723e7b17b
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
TcclThreadFactory.java | 2.1 KB |

/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.catalina.tribes.util; import java.util.concurrent.ThreadFactory; import java.util.concurrent.atomic.AtomicInteger; /** * ThreadFactory implementation that creates threads with the thread context class loader set to the class loader that * loaded this factory. It is intended to be used when tasks may be passed to executors when the web application class * loader is set as the thread context class loader, such as in async session replication. */ public class TcclThreadFactory implements ThreadFactory { private static final AtomicInteger poolNumber = new AtomicInteger(1); private final ThreadGroup group; private final AtomicInteger threadNumber = new AtomicInteger(1); private final String namePrefix; public TcclThreadFactory() { this("pool-" + poolNumber.getAndIncrement() + "-thread-"); } public TcclThreadFactory(String namePrefix) { group = Thread.currentThread().getThreadGroup(); this.namePrefix = namePrefix; } @Override public Thread newThread(Runnable r) { final Thread t = new Thread(group, r, namePrefix + threadNumber.getAndIncrement()); t.setContextClassLoader(this.getClass().getClassLoader()); t.setDaemon(true); return t; } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
46.48
Copyrights

      
    
Holders

      
    
Authors

      
    
License detections License expression License expression SPDX
apache_2_0-4bde3f57-78aa-4201-96bf-531cba09e7de apache-2.0 Apache-2.0
URL Start line End line
http://www.apache.org/licenses/LICENSE-2.0 9 9