ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/tomcat/unittest/TesterLeakingServlet1.java

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

      
    
Rootfs path

      
    
Size
2093 (2.0 KB)
MD5
0c4f12c694aac17cf88ff9c135f9c019
SHA1
8cb6e041081614ba3128841cc50b7a0b42753264
SHA256
3be6ea33ae5aa9f3a7ae1fd902fa45b354fa6555fad97242ab515d34837ad7d1
SHA512

      
    
SHA1_git
9ff9a6b06f86c229e9063a5a06398712f92fbcd8
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
TesterLeakingServlet1.java | 2.0 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.tomcat.unittest; import java.io.IOException; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; public class TesterLeakingServlet1 extends HttpServlet { private static final Log log = LogFactory.getLog(TesterLeakingServlet1.class); private static final long serialVersionUID = 1L; private static ThreadLocal<TesterCounter> myThreadLocal = new ThreadLocal<>(); @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { TesterCounter counter = myThreadLocal.get(); if (counter == null) { log.info("Adding thread local to thread " + Thread.currentThread().getName()); counter = new TesterCounter(); myThreadLocal.set(counter); } counter.increment(); response.getWriter().println( "The current thread served this servlet " + counter.getCount() + " times"); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
51.29
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