ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/tomcat/util/net/SocketProcessorBase.java

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

      
    
Rootfs path

      
    
Size
2162 (2.1 KB)
MD5
036e968ed59a759b93accc90486edabc
SHA1
05e7b82ba74101642f0e63314243f1f57f58617c
SHA256
57cd5363730c57a003e5e0ff725b71b660c501f1a044d842f2f9b93805931829
SHA512

      
    
SHA1_git
a7c4e70867e4221c14349830256c533f3fec8797
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
SocketProcessorBase.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.tomcat.util.net; import java.util.Objects; import java.util.concurrent.locks.Lock; public abstract class SocketProcessorBase<S> implements Runnable { protected SocketWrapperBase<S> socketWrapper; protected SocketEvent event; public SocketProcessorBase(SocketWrapperBase<S> socketWrapper, SocketEvent event) { reset(socketWrapper, event); } public void reset(SocketWrapperBase<S> socketWrapper, SocketEvent event) { Objects.requireNonNull(event); this.socketWrapper = socketWrapper; this.event = event; } @Override public final void run() { Lock lock = socketWrapper.getLock(); lock.lock(); try { // It is possible that processing may be triggered for read and // write at the same time. The lock above makes sure that processing // does not occur in parallel. The test below ensures that if the // first event to be processed results in the socket being closed, // the subsequent events are not processed. if (socketWrapper.isClosed()) { return; } doRun(); } finally { lock.unlock(); } } protected abstract void doRun(); }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
47.41
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