From: <the...@us...> - 2003-12-18 09:14:35
|
Update of /cvsroot/junk/junk/WEB-INF/classes/junk/controller In directory sc8-pr-cvs1:/tmp/cvs-serv31401 Modified Files: WhoIsOnlineAction.java Log Message: speed enhancements Index: WhoIsOnlineAction.java =================================================================== RCS file: /cvsroot/junk/junk/WEB-INF/classes/junk/controller/WhoIsOnlineAction.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WhoIsOnlineAction.java 17 Dec 2003 23:06:59 -0000 1.2 --- WhoIsOnlineAction.java 18 Dec 2003 09:14:32 -0000 1.3 *************** *** 44,51 **** /** * ! * @author flow */ public class WhoIsOnlineAction extends Action { public static final String KEY_ONLINE_ITERATOR = "wio-iterator"; public ActionForward execute(ActionMapping actionMapping, --- 44,52 ---- /** * ! * @author mp */ public class WhoIsOnlineAction extends Action { public static final String KEY_ONLINE_ITERATOR = "wio-iterator"; + public static final String KEY_NUM_ONLINE = "wio-num-online"; public ActionForward execute(ActionMapping actionMapping, *************** *** 57,61 **** .getAttribute(ScannerPlugin.KEY_HOSTS_MAP); ! Iterator i = hosts.keySet().iterator(); TreeSet sortedOnline = new TreeSet(); --- 58,62 ---- .getAttribute(ScannerPlugin.KEY_HOSTS_MAP); ! Iterator i = hosts.getOnlineIterator(); TreeSet sortedOnline = new TreeSet(); *************** *** 64,85 **** NameOnline no = (NameOnline) hosts.get(ip); ! if (no.getOnline().equals(Boolean.TRUE)) { ! Computer c = new Computer(); ! c.setIp(ip); ! c.setName(no.getName()); ! c.setNetFiles(null); ! c.setOnline(no.getOnline()); ! sortedOnline.add(c); ! } } i = sortedOnline.iterator(); ! int w = 4; //this will be a parameter ! ! //modulo stuff to get even values (yes... i know) ! int h = ((sortedOnline.size() % w) + sortedOnline.size()) / w; ArrayList col = new ArrayList(); --- 65,82 ---- NameOnline no = (NameOnline) hosts.get(ip); ! Computer c = new Computer(); ! c.setIp(ip); ! c.setName(no.getName()); ! c.setNetFiles(null); ! c.setOnline(no.getOnline()); ! sortedOnline.add(c); } i = sortedOnline.iterator(); ! int w = 3; //this will be a parameter + int h = (sortedOnline.size() / w) + 1; ArrayList col = new ArrayList(); *************** *** 97,107 **** } ! if (i.hasNext()) { ! col.add(row); ! } else { ! break; ! } } //free mem as soon as possible --- 94,103 ---- } ! col.add(row); } + httpServletRequest.setAttribute(KEY_ONLINE_ITERATOR, col); + httpServletRequest.setAttribute(KEY_NUM_ONLINE, new Integer(sortedOnline.size())); + //free mem as soon as possible *************** *** 109,114 **** hosts = null; i = null; - - httpServletRequest.setAttribute(KEY_ONLINE_ITERATOR, col); return actionMapping.findForward("wio"); --- 105,108 ---- |