directmemory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "小武" <o...@qq.com>
Subject collectExpired about org.apache.directmemory.memory.AbstractMemoryManager#collectExpired
Date Mon, 04 Nov 2013 00:32:20 GMT
hi,
  I recently read the directmemroy's souce code and found org.apache.directmemory.memory.AbstractMemoryManager#collectExpired
is implement like this:


    public long collectExpired()
    {
        int limit = 50;
        return free( limit( filter( pointers, relative ), limit ) )
            + free( limit( filter( pointers, absolute ), limit ) );


    }



but the "relative"  and "absolute" are the same!


    final Predicate<Pointer<V>> relative = new Predicate<Pointer<V>>()
    {


        @Override
        public boolean apply( Pointer<V> input )
        {
            return !input.isFree() && input.isExpired();
        }


    };



    final Predicate<Pointer<V>> absolute = new Predicate<Pointer<V>>()
    {


        @Override
        public boolean apply( Pointer<V> input )
        {
            return !input.isFree() && input.isExpired();
        }


    };



why? why are they same? why free two times "!input.isFree() && input.isExpired()"?






------------------
Best Regards!
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message