ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/tomcat/dbcp/pool2/impl/DefaultEvictionPolicy.java

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

      
    
Rootfs path

      
    
Size
2406 (2.3 KB)
MD5
dc097700b243fca0d4dad643b5db36e1
SHA1
f490eaba6512f4e152eb93b8e039833aeb0dfa6d
SHA256
4429277dde3f712832e4210d554164cb1f8de28d7ee9a634dd15bab39f330e9f
SHA512

      
    
SHA1_git
5aeb028dbfebe6c15eb4a8f63d8c1dbb5317c045
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
DefaultEvictionPolicy.java | 2.3 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 * * https://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.dbcp.pool2.impl; import org.apache.tomcat.dbcp.pool2.PooledObject; /** * Provides the default implementation of {@link EvictionPolicy} used by the pools. * <p> * Objects will be evicted if the following conditions are met: * </p> * <ul> * <li>The object has been idle longer than * {@link GenericObjectPool#getMinEvictableIdleDuration()} / * {@link GenericKeyedObjectPool#getMinEvictableIdleDuration()}</li> * <li>There are more than {@link GenericObjectPool#getMinIdle()} / * {@link GenericKeyedObjectPoolConfig#getMinIdlePerKey()} idle objects in * the pool and the object has been idle for longer than * {@link GenericObjectPool#getSoftMinEvictableIdleDuration()} / * {@link GenericKeyedObjectPool#getSoftMinEvictableIdleDuration()}</li> * </ul> * <p> * This class is immutable and thread-safe. * </p> * * @param <T> the type of objects in the pool. * @since 2.0 */ public class DefaultEvictionPolicy<T> implements EvictionPolicy<T> { /** * Constructs a new instance. */ public DefaultEvictionPolicy() { // empty } @Override public boolean evict(final EvictionConfig config, final PooledObject<T> underTest, final int idleCount) { // @formatter:off return config.getIdleSoftEvictDuration().compareTo(underTest.getIdleDuration()) < 0 && config.getMinIdle() < idleCount || config.getIdleEvictDuration().compareTo(underTest.getIdleDuration()) < 0; // @formatter:on } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
45.59
Copyrights

      
    
Holders

      
    
Authors

      
    
License detections License expression License expression SPDX
apache_2_0-eb6b5ae0-4f88-4e9b-d67c-c6c8e733b1cd apache-2.0 Apache-2.0
URL Start line End line
https://www.apache.org/licenses/LICENSE-2.0 9 9