Record Class EvictionPolicy.IdleTime<T>
java.lang.Object
java.lang.Record
cloud.opencode.base.pool.policy.EvictionPolicy.IdleTime<T>
- Type Parameters:
T- the pooled object type - 池化对象类型- Record Components:
maxIdleTime- the maximum idle time - 最大空闲时间
- All Implemented Interfaces:
EvictionPolicy<T>
- Enclosing interface:
EvictionPolicy<T>
public static record EvictionPolicy.IdleTime<T>(Duration maxIdleTime)
extends Record
implements EvictionPolicy<T>
Idle time based eviction policy.
基于空闲时间的驱逐策略。
Evicts objects that have been idle longer than the max idle time.
驱逐空闲时间超过最大空闲时间的对象。
- Since:
- JDK 25, opencode-base-pool V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Nested Class Summary
Nested classes/interfaces inherited from interface EvictionPolicy
EvictionPolicy.Composite<T>, EvictionPolicy.IdleTime<T>, EvictionPolicy.LFU<T>, EvictionPolicy.LRU<T>, EvictionPolicy.MaxAge<T> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.booleanevict(PooledObject<T> obj, EvictionContext context) Determines if the object should be evicted.final inthashCode()Returns a hash code value for this object.Returns the value of themaxIdleTimerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
IdleTime
Creates an instance of aIdleTimerecord class.- Parameters:
maxIdleTime- the value for themaxIdleTimerecord component
-
-
Method Details
-
evict
Description copied from interface:EvictionPolicyDetermines if the object should be evicted. 确定对象是否应被驱逐。- Specified by:
evictin interfaceEvictionPolicy<T>- Parameters:
obj- the pooled object - 池化对象context- the eviction context - 驱逐上下文- Returns:
- true if should evict - 如果应驱逐返回true
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
maxIdleTime
Returns the value of themaxIdleTimerecord component.- Returns:
- the value of the
maxIdleTimerecord component
-