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 LRUSelectionStrategyImpl 32 implements SelectionStrategy 33 { 34 public ServerGIOPConnection selectForClose( List connections ) 35 { 36 ServerGIOPConnection oldest = null; 37 long last_usage = Long.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 LRUStatisticsProviderImpl sp = (LRUStatisticsProviderImpl) 48 conn.getStatisticsProvider(); 49 50 if( sp.getLastUsage() < last_usage ) 51 { 52 oldest = conn; 53 last_usage = sp.getLastUsage(); 54 } 55 } 56 } 57 58 return oldest; 59 } 60 } 61 62 63 64 | Popular Tags |