1 20 21 package org.jacorb.orb.giop; 22 23 import java.util.List ; 24 import java.util.Iterator ; 25 26 30 31 public class LFUSelectionStrategyImpl 32 implements SelectionStrategy 33 { 34 public ServerGIOPConnection selectForClose( List connections ) 35 { 36 ServerGIOPConnection least_used = null; 37 double least_usage = Double.MAX_VALUE; 38 39 for( Iterator it = connections.iterator(); 40 it.hasNext(); 41 ) 42 { 43 ServerGIOPConnection conn = (ServerGIOPConnection) it.next(); 44 45 if( ! conn.hasPendingMessages() ) 46 { 47 LFUStatisticsProviderImpl sp = (LFUStatisticsProviderImpl) 48 conn.getStatisticsProvider(); 49 50 double frequency = sp.getFrequency(); 51 52 if( frequency < least_usage ) 53 { 54 least_used = conn; 55 least_usage = frequency; 56 } 57 } 58 } 59 60 return least_used; 61 } 62 } 63 64 65 | Popular Tags |